adding function to load experts and combine them into single transition list
This commit is contained in:
@@ -4,6 +4,7 @@ sklearn
|
|||||||
pytest
|
pytest
|
||||||
json5
|
json5
|
||||||
tqdm
|
tqdm
|
||||||
tensorboard
|
|
||||||
ray[tune]
|
ray[tune]
|
||||||
hyperopt
|
hyperopt
|
||||||
|
psutil
|
||||||
|
fire
|
||||||
0
scratch/arec/intersimple/data/__init__.py
Normal file
0
scratch/arec/intersimple/data/__init__.py
Normal file
23
scratch/arec/intersimple/data/load_experts.py
Normal file
23
scratch/arec/intersimple/data/load_experts.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import pickle
|
||||||
|
import imitation.data.rollout as rollout
|
||||||
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
def load_experts(expert_files=[]):
|
||||||
|
"""
|
||||||
|
Load expert trajectories from files and combine their transitions into a single RB
|
||||||
|
|
||||||
|
Args:
|
||||||
|
expert_files (list): list of expert file strings
|
||||||
|
Returns:
|
||||||
|
transitions (list): list of combined expert episode transitions
|
||||||
|
"""
|
||||||
|
transitions = []
|
||||||
|
for file in tqdm(expert_files):
|
||||||
|
with open(file, "rb") as f:
|
||||||
|
trajectories = pickle.load(f)
|
||||||
|
transitions = transitions + rollout.flatten_trajectories(trajectories)
|
||||||
|
return transitions
|
||||||
|
|
||||||
|
if __name__=='__main__':
|
||||||
|
import fire
|
||||||
|
fire.Fire(load_experts)
|
||||||
@@ -303,6 +303,8 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
with open("data/NormalizedIntersimpleExpertMu.001_NRasterizedAgent51w36h36mppx2.pkl", "rb") as f:
|
with open("data/NormalizedIntersimpleExpertMu.001_NRasterizedAgent51w36h36mppx2.pkl", "rb") as f:
|
||||||
trajectories = pickle.load(f)
|
trajectories = pickle.load(f)
|
||||||
|
import pdb
|
||||||
|
pdb.set_trace()
|
||||||
transitions = rollout.flatten_trajectories(trajectories)
|
transitions = rollout.flatten_trajectories(trajectories)
|
||||||
generator = train(transitions)
|
generator = train(transitions)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user