Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
475f793
init luanch file for debugging PickandPlace SAC
CleiverRuiz Apr 4, 2025
44321d8
Peg Insertion Task demos with corrected flags
rojas70 Apr 10, 2025
dcff2b2
insertion task config and franka_server files corrected
rojas70 Apr 10, 2025
7e23bbd
Pick and Place bash script corrections
rojas70 Apr 10, 2025
422d207
Fix bug in the way Mujoco renders the panda_pick_gym_env.py and shows…
rojas70 Jun 11, 2025
a3bae6d
Documented dataset.py. Included detailed explanatory notes and docstr…
rojas70 Jun 12, 2025
99e84de
ignore vs workspaces
rojas70 Jun 12, 2025
5bced50
learner param settings changes: xla_python_client_mem_fraction and ba…
rojas70 Jun 16, 2025
8465a97
small adjustment to target pose in PegEnvConfig
rojas70 Jun 16, 2025
ef39140
Merge branch 'main' of https://github.com/learningLogisticsLab/serl i…
rojas70 Jun 16, 2025
eccbe90
reminder to install custom packages from serl
CleiverRuiz Jul 2, 2025
bd049a0
created file for fractal symmetry replay buffer
ryanvanderstelt Jul 3, 2025
b687719
phase 1 of reach env, no V&V test yet
CleiverRuiz Jul 4, 2025
bdac873
Organization underway, not functional or tested
ryanvanderstelt Jul 7, 2025
8e6eed4
additional bash script for REACH
CleiverRuiz Jul 7, 2025
358f26e
Fleshed out several functions, created TODO list for development
ryanvanderstelt Jul 8, 2025
7b3e345
Insert function completed, requires testing
ryanvanderstelt Jul 8, 2025
8971a9e
Created test file for fsrb and tested insert() and fractal_branch()
ryanvanderstelt Jul 9, 2025
7338bcb
Updated test file and removed various bugs
ryanvanderstelt Jul 10, 2025
836e404
Tackling how bad rounding errors are tomorrow
ryanvanderstelt Jul 11, 2025
457f707
Finished basic test file
ryanvanderstelt Jul 14, 2025
ed940dd
very basic spacing addition
rojas70 Jul 14, 2025
c813108
Merge branch 'main' of github.com:learningLogisticsLab/serl into main
rojas70 Jul 14, 2025
234ec1e
prevent latest version of opencv-python for compatibility reasons
ryanvanderstelt Jul 14, 2025
efece64
hooked up fractal_symmetry_replay_buffer in data_store.py and launche…
ryanvanderstelt Jul 15, 2025
a23330f
code clean up
ryanvanderstelt Jul 15, 2025
a108f6b
ready for testing with real environment
ryanvanderstelt Jul 15, 2025
266b6e2
Merge branch 'main' of https://github.com/learningLogisticsLab/serl i…
ryanvanderstelt Jul 15, 2025
0e6d65b
reach task using serl
rojas70 Jul 15, 2025
610f00c
peg insert changes
rojas70 Jul 15, 2025
2137609
Merge branch 'reach' of https://github.com/learningLogisticsLab/serl …
ryanvanderstelt Jul 15, 2025
a80b818
async_sac_state_sim uses fractal_replay_buffer
ryanvanderstelt Jul 15, 2025
729a640
launch json file for debugging reach
rojas70 Jul 15, 2025
5335995
Merge remote-tracking branch 'origin/fractal_replay_buffer' into reach
rojas70 Jul 16, 2025
45e7ee2
fixed jax and jaxlib version errors (now should use 0.6.2)
ryanvanderstelt Jul 17, 2025
5098d78
Update README.md
ryanvanderstelt Jul 18, 2025
653ed82
phone files
rojas70 Jul 18, 2025
f669788
Update README.md
ryanvanderstelt Jul 18, 2025
cf135b7
Added y-dimension
ryanvanderstelt Jul 18, 2025
a88b3e5
Merge branch 'main' of https://github.com/learningLogisticsLab/serl i…
ryanvanderstelt Jul 18, 2025
9696837
Merge branch 'reach' of https://github.com/learningLogisticsLab/serl …
ryanvanderstelt Jul 18, 2025
05893d9
created equivalence tests for fsrb (1 by 1) and rb
ryanvanderstelt Jul 18, 2025
dc31956
update test file
ryanvanderstelt Jul 18, 2025
002c0e0
minor comments.
rojas70 Jul 19, 2025
be72ea7
Successful base functionality achieved for fsrb
ryanvanderstelt Jul 19, 2025
cf4d885
Merge branch 'fractal_replay_buffer' of https://github.com/learningLo…
ryanvanderstelt Jul 19, 2025
35a2bca
Merge pull request #1 from learningLogisticsLab/reach
rojas70 Jul 21, 2025
0ddcbd3
Reach demo motion stable.
rojas70 Jul 21, 2025
d39f9bf
Re-adjusted gains slightly.
rojas70 Jul 21, 2025
0552bf4
New testing scripts for fractal symmetry benchmarks.
rojas70 Jul 22, 2025
0f146a6
simple comment
rojas70 Jul 22, 2025
69400ce
Merge branch 'main' of github.com:learningLogisticsLab/serl into demos
rojas70 Jul 22, 2025
f0e40ba
Removed undesired features, fixed bugs, and created
ryanvanderstelt Jul 22, 2025
a03c6f6
General enhancements:
rojas70 Jul 23, 2025
6807623
Imitate an insertion into data_store or queued data store
rojas70 Jul 23, 2025
2aeb8cc
Converted code into a class that can be imported for easy running in …
rojas70 Jul 23, 2025
a2dd594
Merge branch 'demos' of https://github.com/learningLogisticsLab/serl …
ryanvanderstelt Jul 23, 2025
2c71b36
Reformated the class to better fit with the functionality we want in …
rojas70 Jul 23, 2025
dcaf5a5
commented out main
rojas70 Jul 23, 2025
11f7c00
Added temporal awareness to fsrb with time_split function
ryanvanderstelt Jul 24, 2025
9f0701f
fixed fractal test in fsrb_test.py
ryanvanderstelt Jul 24, 2025
27360ca
Refactor current_depth handling in FractalSymmetryReplayBuffer and en…
rojas70 Jul 24, 2025
a28a959
Scaled actions in reach script and changed async_sac_state to immedia…
rojas70 Jul 24, 2025
c499cd6
include demo flags
rojas70 Jul 24, 2025
da91b85
created more robust and successful bash script from which more advanc…
rojas70 Jul 24, 2025
9324896
Merge branch 'fractal_replay_buffer' of github.com:learningLogisticsL…
rojas70 Jul 24, 2025
1e89d4c
hide viewer
rojas70 Jul 24, 2025
863ada5
progress on automated testing
ryanvanderstelt Jul 24, 2025
b5a8718
Merge branch 'fractal_replay_buffer' of https://github.com/learningLo…
ryanvanderstelt Jul 24, 2025
eae091e
Merge branch 'main' of github.com:learningLogisticsLab/serl into frac…
rojas70 Jul 24, 2025
defe5d0
Merge branch 'fractal_replay_buffer' of github.com:learningLogisticsL…
rojas70 Jul 24, 2025
fe292d9
Modified suprocess script using functions and logging
rojas70 Jul 24, 2025
f97c291
update for run_tests.py
ryanvanderstelt Jul 24, 2025
fadec73
Merge branch 'fractal_replay_buffer' of https://github.com/learningLo…
ryanvanderstelt Jul 24, 2025
159051d
reverted run scripts
ryanvanderstelt Jul 24, 2025
ec55fcb
test if relying on child actor/learner .sh files for conda might solv…
rojas70 Jul 24, 2025
a70ed8d
Merge branch 'fractal_replay_buffer' of github.com:learningLogisticsL…
rojas70 Jul 24, 2025
53e0612
commit for consistency
ryanvanderstelt Jul 24, 2025
3903818
Merge branch 'fractal_replay_buffer' of https://github.com/learningLo…
ryanvanderstelt Jul 24, 2025
8e28173
Working automated script
rojas70 Jul 24, 2025
41711d8
Merge branch 'fractal_replay_buffer' of github.com:learningLogisticsL…
rojas70 Jul 24, 2025
b8674e9
changed for automate_funds.py
rojas70 Jul 24, 2025
30424ed
Add tests for insert() functionality in replay buffer
rojas70 Jul 25, 2025
9501629
almost functional automate_func.py
ryanvanderstelt Jul 25, 2025
f2b5058
Merge branch 'fractal_replay_buffer' of https://github.com/learningLo…
ryanvanderstelt Jul 25, 2025
9392889
Needed to create another demos folder as a child in order for setup.p…
rojas70 Jul 25, 2025
3af4401
Bug fix with dict key string. Use single quotes in f-string.
rojas70 Jul 25, 2025
a18e1d5
missed including child demo folder
rojas70 Jul 25, 2025
fd6111c
Reverted these to standard files with demo flags inside
rojas70 Jul 25, 2025
b38b60e
hardly functional automated testing
ryanvanderstelt Jul 25, 2025
5400702
cleaning up test scripts as we have made advances there in fractal br…
rojas70 Jul 25, 2025
9b62012
improved testing, fixed fsrb bugs
ryanvanderstelt Jul 25, 2025
2cd298f
Set conda once only at the beginning.
rojas70 Jul 25, 2025
82f65ac
Merge branch 'fractal_replay_buffer' of github.com:learningLogisticsL…
rojas70 Jul 25, 2025
c901bad
Wrong env used in training.
CleiverRuiz Jul 26, 2025
bd5d65d
General Enhancements
rojas70 Jul 28, 2025
ad8d38e
Merge branch 'fractal_replay_buffer' into demos
rojas70 Jul 28, 2025
f0b4df0
Buf fix. Datastore should not be required at instantiation time. Only…
rojas70 Jul 28, 2025
98657d8
Fractal Contraction defined and tested.
rojas70 Jul 28, 2025
5be8915
Merge branch 'fractal_replay_buffer' of github.com:learningLogisticsL…
rojas70 Jul 28, 2025
3959cc7
Merge pull request #2 from learningLogisticsLab/fractal_replay_buffer
rojas70 Jul 28, 2025
6add31a
omit time measurement printouts
crosen77 Jul 28, 2025
f410a37
Merge branch 'fractal_replay_buffer' of github.com:learningLogisticsL…
crosen77 Jul 28, 2025
fd7093b
Fixed bugs
rojas70 Jul 29, 2025
c84f08b
Complete Fractal Contraction
CleiverRuiz Jul 30, 2025
65987e1
some options for demos
rojas70 Jul 30, 2025
088fc28
Merge branch 'main' of github.com:learningLogisticsLab/serl into demos
rojas70 Jul 30, 2025
6783f44
Merge branch 'fractal_replay_buffer' of github.com:learningLogisticsL…
rojas70 Jul 30, 2025
0ea596b
letting sh files to have demo info commented out
rojas70 Jul 30, 2025
e0e0633
update sh files to work with fractal_symmetry_replay_buffer
rojas70 Jul 30, 2025
5201223
Merge branch 'fractal_replay_buffer' of github.com:learningLogisticsL…
rojas70 Jul 30, 2025
794caf5
Undoing comments on constant methods for branch/split.
rojas70 Jul 30, 2025
85448ff
Merge branch 'fractal_replay_buffer' into demos
rojas70 Jul 30, 2025
692682c
Updating .sh files and launch.json to have fractal + demo options to …
rojas70 Jul 30, 2025
bdfb6f6
Bug fixing for demos + fractals
rojas70 Jul 30, 2025
592f80e
Workspace Width Method
rojas70 Aug 1, 2025
0aeed37
Merge branch 'fractal_replay_buffer'
rojas70 Aug 1, 2025
d760188
Updated readme + comments
rojas70 Aug 1, 2025
7c000f8
Merge branch 'demos'
rojas70 Aug 1, 2025
8c09c2c
first attempt at disassociated
crosen77 Aug 1, 2025
7c86a82
Merge branch 'fractal_replay_buffer' of github.com:learningLogisticsL…
crosen77 Aug 1, 2025
b3dfcc3
made some debugging changes. Now it will run and learn. still have to…
crosen77 Aug 1, 2025
776c768
First incomplete draft of parallel fractal replay buffer.
rojas70 Aug 1, 2025
b81e547
Merge branch 'disassociated' into main
crosen77 Aug 4, 2025
d947657
First draft of optimized/parallelized fractal_symmetry_replay_buffer_…
rojas70 Aug 4, 2025
e4d7ac2
Merge branch 'main' of github.com:learningLogisticsLab/serl into frac…
rojas70 Aug 4, 2025
422b548
Merge branch 'fractal_replay_buffer' of github.com:learningLogisticsL…
rojas70 Aug 4, 2025
a6eae2f
draft 2. improved batch class. still no testing.
rojas70 Aug 4, 2025
6b1bad9
Modified FractalSymmetryReplayBufferParallel so that it subclasses Fr…
rojas70 Aug 4, 2025
23aa69f
Updated ancillary files to called the function appropriately.
rojas70 Aug 4, 2025
5585112
updated shell files.
rojas70 Aug 4, 2025
b04e871
small change to test 3 translations with parallel
rojas70 Aug 4, 2025
84b19c4
forgot to update launch.json with parallel friendly parameters
rojas70 Aug 4, 2025
654e8f5
Bug fixes
rojas70 Aug 4, 2025
dafd77f
Parallelized insert function including batch insert. Created _handle_…
ryanvanderstelt Aug 5, 2025
ded80ef
Overhaul of automated testing. Removed multiple unneeded files and fl…
ryanvanderstelt Aug 5, 2025
2f30c18
Fixed alpha type
ryanvanderstelt Aug 6, 2025
227480d
Added automated testing with parallel run support
ryanvanderstelt Aug 7, 2025
6f7a7a4
testing
ryanvanderstelt Aug 8, 2025
5454828
Merge pull request #4 from learningLogisticsLab/fractal_replay_buffer
rojas70 Aug 8, 2025
ee08618
improved test files
ryanvanderstelt Aug 12, 2025
43bea82
Merge pull request #5 from learningLogisticsLab/fractal_replay_buffer
ryanvanderstelt Aug 12, 2025
d88b11f
Created sparse env for reach
ryanvanderstelt Aug 13, 2025
a04447f
Added optional images to fractal_symmetry_replay_buffer
ryanvanderstelt Aug 14, 2025
efb19e3
Improved tests
ryanvanderstelt Aug 14, 2025
c6986a5
added offline to testing options
ryanvanderstelt Aug 14, 2025
1531be9
test changes
ryanvanderstelt Aug 14, 2025
c9a0941
begun functionality for images for fractal_symmetry_replay_buffer
ryanvanderstelt Aug 15, 2025
84bbca4
testing changes
ryanvanderstelt Aug 15, 2025
1dbb044
fractal_symmetry_replay_buffer with images finished, awaiting demos f…
ryanvanderstelt Aug 15, 2025
a828d50
compiling code pieces to set things up
rojas70 Aug 15, 2025
4173234
adding oxe_logger dependency
rojas70 Aug 15, 2025
18e6ea3
commented out some lines that i think are not needed
rojas70 Aug 15, 2025
8178bdf
set demo call to simply return action, but block_pos is not available…
rojas70 Aug 18, 2025
4db34a4
testing
ryanvanderstelt Aug 19, 2025
53d4d8e
testing
ryanvanderstelt Aug 20, 2025
1d3138c
v0.2.0 - Complete Redo.
rojas70 Aug 21, 2025
0e52c8e
- Do not incude env.close()
rojas70 Aug 21, 2025
134a211
v.0.3.0
rojas70 Aug 22, 2025
de3d3a1
improved docstrings
rojas70 Aug 22, 2025
e7d677c
finished images for FSRB
ryanvanderstelt Sep 1, 2025
0819935
Updated franka_rearch_drq_demo_script to be able to move the camera a…
rojas70 Sep 1, 2025
ee1107d
v.0.2.0 - Working version in debug mode
rojas70 Sep 2, 2025
88a1eb0
Merge branch 'main' of https://github.com/LearningLogisticsLab/serl i…
ryanvanderstelt Sep 3, 2025
ad69fd3
Merge branch 'fractal_replay_buffer' of https://github.com/LearningLo…
ryanvanderstelt Sep 3, 2025
a4509b0
Merge branch 'demos' of https://github.com/LearningLogisticsLab/serl …
ryanvanderstelt Sep 3, 2025
178b800
finished sparse reach
ryanvanderstelt Sep 8, 2025
808b7e7
- Cleaning up code.
rojas70 Sep 9, 2025
687d07e
finished merge
rojas70 Sep 9, 2025
9b6e8a6
- Number of max steps adjustement.
rojas70 Sep 9, 2025
78b84cc
Corrected sparse environment definition.
rojas70 Sep 12, 2025
b532809
This file maintains latest changes where 2 or more demos are recorded…
rojas70 Sep 15, 2025
285fa97
small changes
ryanvanderstelt Sep 16, 2025
b1d0952
update naming scheme for rlds demos to :#_num_demos_session_yyyymmdd_…
rojas70 Sep 16, 2025
d08da1f
Merge branch 'sparse-reach' of github.com:learningLogisticsLab/serl i…
rojas70 Sep 16, 2025
01b5ab6
fix for wrappers drq_sim
ryanvanderstelt Sep 16, 2025
43b44ee
Merge branch 'sparse-reach' of https://github.com/LearningLogisticsLa…
ryanvanderstelt Sep 16, 2025
daded7d
Updates to launch.json regarding rlds reach-sparse
rojas70 Sep 16, 2025
148728b
Merge branch 'sparse-reach' of github.com:learningLogisticsLab/serl i…
rojas70 Sep 16, 2025
d736495
Need oxe_envlogger as a git package.
rojas70 Sep 18, 2025
282b53c
added 4 dimensions to reach-sparse and begun work conserving memory
ryanvanderstelt Sep 19, 2025
3e059b8
Merge branch 'sparse-reach' of https://github.com/LearningLogisticsLa…
ryanvanderstelt Sep 19, 2025
8687ada
better memory management for testing (also batch size down to 128)
ryanvanderstelt Sep 23, 2025
53c85da
Moving towards a pick-and-place rlds demo recording system with cube …
rojas70 Sep 30, 2025
9f28809
Moving towards a pick-and-place rlds demo recording system with cube …
rojas70 Sep 30, 2025
073e59e
Merge branch 'sparse-reach' of github.com:learningLogisticsLab/serl i…
rojas70 Sep 30, 2025
2fe889c
Merge pull request #7 from learningLogisticsLab/sparse-reach
ryanvanderstelt Oct 21, 2025
5cb7419
fixed sampling bug
ryanvanderstelt Jan 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,7 @@ MUJOCO_LOG.TXT
_METADATA
checkpoint
wandb/

# VS Code settings
*.code-workspace

15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ We fixed a major issue in the intervention action frame. See release [v0.1.1](ht

- For GPU:
```bash
pip install --upgrade "jax[cuda12_pip]==0.4.35" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
pip install --upgrade "jax[cuda12]==0.6.2"
```

- For TPU
Expand All @@ -69,6 +69,27 @@ We fixed a major issue in the intervention action frame. See release [v0.1.1](ht
pip install -r requirements.txt
```



4. **Install the franka_sim**
```bash
cd franka_sim
pip install -e .
pip install -r requirements.txt
```

5. **Install the serl_robot_infra**
```bash
cd serl_robot_infra
pip install -e .
```

6. **Install the demos**
```bash
cd demos
pip install -e .
```

## Overview and Code Structure

SERL provides a set of common libraries for users to train RL policies for robotic manipulation tasks. The main structure of running the RL experiments involves having an actor node and a learner node, both of which interact with the robot gym environment. Both nodes run asynchronously, with data being sent from the actor to the learner node via the network using [agentlace](https://github.com/youliangtan/agentlace). The learner will periodically synchronize the policy with the actor. This design provides flexibility for parallel training and inference.
Expand Down
Empty file added demos/demos/__init__.py
Empty file.
157 changes: 157 additions & 0 deletions demos/demos/demoHandling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import os
from pathlib import Path
import numpy as np
from agentlace.data.data_store import QueuedDataStore

class DemoHandling:
"""
Koads an .npz file containing demonstration data into a data object.
This class is designed to work with Gymnasium-style demonstration data
and is intended to be used with a QueuedDataStore or similar data store.

The .npz file should contain the following arrays:
- 'obs' : shape (N, T+1, *obs_shape*), list of observations
- 'acs' : shape (N, T, *act_shape*), list of actions
- 'rewards' : shape (N, T), list of rewards
- 'terminateds' : shape (N, T), list of terminated flags
- 'truncateds' : shape (N, T), list of truncated flags
- 'info' : shape (N, T), list of info dicts
- 'dones' : shape (N, T), list of done flags (if available)

Parameters
----------
demo_dir : str
Directory where demo .npz files live by default.
file_name : str
Name of the demo file to load. If not provided, a default will be used.
"""
def __init__(
self,
demo_dir: str = '/data/data/serl/demos',
file_name: str = 'data_franka_reach_random_20.npz'
):

self.debug = False # Set to True for debugging purposes
self.demo_dir = demo_dir
self.transition_ctr = 0 # Global counter for transitions across all episodes

# Load the demo data from the .npz file

# Check if the demo directory exists
if not os.path.exists(self.demo_dir):
raise FileNotFoundError(f"Demo directory '{self.demo_dir}' does not exist.")

# Construct the full path to the demo file
self.demo_npz_path = os.path.join(self.demo_dir, file_name)
if not os.path.isfile(self.demo_npz_path):
raise FileNotFoundError(f"Demo file '{self.demo_npz_path}' does not exist.")

# Load the .npz file
self.data = np.load(self.demo_npz_path, allow_pickle=True)

def get_num_transitions(self):
"""
Returns the total number of transitions counted in the demo data.
"""
return int(self.data["transition_ctr"]) if "transition_ctr" in self.data else 0

def get_num_demos(self):
"""
Returns the total number of demonstrations in the demo data.
"""
return int(self.data["num_demos"]) if "num_demos" in self.data else 0

def insert_data_to_buffer(self,data_store: QueuedDataStore):
"""
Load a raw Gymnasium-style .npz of expert episodes into data_store.
The .npz file must contain arrays named 'obs', 'acs', 'rewards',
'terminateds', 'truncateds', 'info', and optionally 'dones'.
Each episode is processed, and transitions are inserted into the data_store.
Inserted transitions in data store will remain in the data_store as pointers.

***Note***
Need to insert obs and acs in the same way as async_sac_state via jax

Parameters
----------
data_store : QueuedDataStore

Returns
-------
None
"""

obs_buffer = self.data['obs'] # shape (N, T+1, ...)
act_buffer = self.data['acs'] # shape (N, T, ...)
rew_buffer = self.data['rewards'] # shape (N, T)
term_buffer = self.data['terminateds'] # shape (N, T)
trunc_buffer = self.data['truncateds'] # shape (N, T)
info_buffer = self.data['info'] # shape (N, T)
done_buffer = self.data['dones'] # shape (N, T) #.get('dones', term_buffer | trunc_buffer)

num_demos = self.get_num_demos()
if num_demos == 0:
raise ValueError("No demonstrations found in the provided .npz file.")

num_transitions = self.get_num_transitions()
if num_transitions == 0:
raise ValueError("No transitions found in the provided .npz file.")


# Extract the number of episodes and transitions
for ep in range(num_demos):
ep_obs = obs_buffer[ep]
ep_acts = act_buffer[ep]
ep_rews = rew_buffer[ep]
ep_terms = term_buffer[ep]
ep_trunc = trunc_buffer[ep]
ep_done = done_buffer[ep]
ep_info = info_buffer[ep]

T = len(ep_acts)
for t in range(T):
obs_t = np.asarray(ep_obs[t], dtype=np.float32)
next_obs_t = np.asarray(ep_obs[t+1], dtype=np.float32)
a_t = np.asarray(ep_acts[t], dtype=np.float32)
r_t = float(ep_rews[t])
done_t = bool(ep_done[t] or ep_terms[t] or ep_trunc[t])
#info_t = ep_info[t]
# masks will be created right before insert below

if self.debug:
np.set_printoptions(precision=3, suppress=True)

print(f"Demo {ep:2}, Step {t:3} \n "
f"Obs: [{obs_t[0]:.2f} {obs_t[1]:.2f} {obs_t[2]:.2f}] \n "
f"Action: [{a_t[0]:.2f} {a_t[1]:.2f} {a_t[2]:.2f}] \n "
f"Reward: {r_t:.2f} \n "
f"Done: {done_t}")

# Insert using SERLs data_store/ReplayBuffer insert mechanism directly.
data_store.insert(
dict(
observations =obs_t,
actions =a_t,
next_observations=next_obs_t,
rewards =r_t,
masks =1.0 - done_t,
dones =done_t
)
)

print(f"Loaded a total of {num_transitions} from {num_demos} episodes from '{self.demo_npz_path}' ")


# if __name__ == "__main__":
# # Instantiate a DemoHandling object
# handler = DemoHandling(demo_dir='/data/data/serl/demos',
# file_name='data_franka_reach_random_20.npz')

# # Idenitfy the total number of transitions in the datastore
# print(f'We have {handler.data["transition_ctr"]} transitions in the datastore.')

# # Simulate SERL's datastore creation w/ capacity 2000
# ds = QueuedDataStore(2000)

# # Insert the demo data into the datastore
# handler.insert_data_to_buffer(ds)
Loading