making saving and loading functions class requirements, working on behavior cloning policy class and training function

This commit is contained in:
Arec
2021-07-20 08:29:00 -07:00
parent 1a74fa5237
commit 6794b4cad8
4 changed files with 110 additions and 12 deletions

View File

@@ -30,14 +30,11 @@ def main(method='bc', train=False, test=False, loc=0, **kwargs):
if not os.path.isdir(outdir):
os.mkdir(outdir)
filestr = opj(outdir, basestr(**kwargs))
# method-based training
if method=='bc':
from src import bc
policy_class = bc.BehaviorCloningPolicy
load_policy_fn = bc.load_policy
train_fn = bc.train
else:
raise NotImplementedError
@@ -51,7 +48,8 @@ def main(method='bc', train=False, test=False, loc=0, **kwargs):
if test:
# load policy
policy = load_policy_fn(filestr=filestr)
policy = policy_class.load_model(filestr=filestr, **kwargs)
policy.eval()
# simulate policy
test_track = 4