marktrovinger
commited on
Commit
•
8757697
1
Parent(s):
35b8849
Update cartpole_gym_replay.py
Browse files- cartpole_gym_replay.py +14 -14
cartpole_gym_replay.py
CHANGED
@@ -59,17 +59,17 @@ class DecisionTransformerGymDataset(datasets.GeneratorBasedBuilder):
|
|
59 |
]
|
60 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
61 |
def _generate_examples(self, filepath, split):
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
59 |
]
|
60 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
61 |
def _generate_examples(self, filepath, split):
|
62 |
+
|
63 |
+
#trajectories = pickle.load(f)
|
64 |
+
traj = np.load(filepath)
|
65 |
+
obs = traj["observations"]
|
66 |
+
act = traj["actions"]
|
67 |
+
rew = traj["rewards"]
|
68 |
+
done = traj["dones"]
|
69 |
+
for idx, value in enumerate(obs):
|
70 |
+
yield idx, {
|
71 |
+
"observations": obs[i],
|
72 |
+
"actions": act[i],
|
73 |
+
"rewards": rew[i],
|
74 |
+
"dones": done[i],
|
75 |
+
}
|