Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem Parsing Input Spec for Enjoy Mode Demo #469

Open
fundmntlTheorem opened this issue Dec 1, 2020 · 0 comments
Open

Problem Parsing Input Spec for Enjoy Mode Demo #469

fundmntlTheorem opened this issue Dec 1, 2020 · 0 comments

Comments

@fundmntlTheorem
Copy link

I'm going through the demo with Ubuntu OS, and, things are working so far, and I get to the part about the enjoy mode.
https://slm-lab.gitbook.io/slm-lab/using-slm-lab/resume-and-enjoy-reinforce-cartpole

This command is run, after having done a successful training run
python run_lab.py slm_lab/spec/benchmark/reinforce/reinforce_cartpole.json reinforce_cartpole enjoy@data/reinforce_cartpole_2020_11_30_185405/reinforce_cartpole_t0_s0_spec.json

But it crashes with an error about parsing the input files

[2020-11-30 21:04:00,306 PID:4659 INFO run_lab.py read_spec_and_run] Running lab spec_file:slm_lab/spec/benchmark/reinforce/reinforce_cartpole.json spec_name:reinforce_cartpole in mode:enjoy@data/reinforce_cartpole_2020_11_30_185405/reinforce_cartpole_t0_s0_spec.json
Traceback (most recent call last):
  File "run_lab.py", line 80, in <module>
    main()
  File "run_lab.py", line 72, in main
    read_spec_and_run(*args)
  File "run_lab.py", line 53, in read_spec_and_run
    spec = spec_util.get_eval_spec(spec_file, prename)
  File "/home/philip/Documents/MachineLearning/SLM-Lab/slm_lab/spec/spec_util.py", line 166, in get_eval_spec
    predir, _, _, _, _, _ = util.prepath_split(spec_file)
  File "/home/philip/Documents/MachineLearning/SLM-Lab/slm_lab/lib/util.py", line 339, in prepath_split
    experiment_ts = RE_FILE_TS.findall(prefolder)[0]
IndexError: list index out of range

I could get the demo to run by modifying a few files. It may be a hack though because I don't know what all different inputs you may be expecting. Here's the change in the run_lab.py file...the case in the #eval mode has been modified

def read_spec_and_run(spec_file, spec_name, lab_mode):
    '''Read a spec and run it in lab mode'''
    logger.info(f'Running lab spec_file:{spec_file} spec_name:{spec_name} in mode:{lab_mode}')
    if lab_mode in TRAIN_MODES:
        spec = spec_util.get(spec_file, spec_name)
    else:  # eval mode
        lab_mode, base_path = lab_mode.split('@')
        # ex prename = reinforce_cartpole_t0_s0_spec.json
        _, _, prename, _, _, _ = util.prepath_split(base_path)
        # remove the _spec.json from the name
        prename = re.search('([\w\a\d\_]+)_spec\.json', prename).group(1)
        spec = spec_util.get_eval_spec(base_path, prename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant