Arnold icon indicating copy to clipboard operation
Arnold copied to clipboard

No such file or directory, confusing concatenation?

Open JadenTravnik opened this issue 7 years ago • 3 comments

(I'm using a conda environment on windows) When trying to run from the root directory:

python arnold.py --exp_name test --main_dump_path dumped --scenario defend_the_center --frame_skip 2 --action_combinations "turn_lr+attack" --reload pretrained/defend_the_center.pth --evaluate 1 --visualize 1 --gpu_id 0

I get the error No such file or directory: 'dumped\\test\\<testid>\\pretrained/defend_the_center.pth'. Looking into this I saw that the paths are concatenated.

Shouldn't the weights be loaded from the pretrained directory instead? Eg: model_path = params.reload

What is the expected functionality?

JadenTravnik avatar Jul 11 '18 18:07 JadenTravnik

Mmm I never tried on Windows. In the run.sh script there is $PWD at the beginning of the model location, but this may not work on Windows as it works on Linux. Can you try to give the full path to the reload argument?

glample avatar Jul 12 '18 01:07 glample

Giving either the full path or the relative pretrained/defend_the_center.pth works fine after this change:

model_path = params.reload #os.path.join(params.dump_path, params.reload)

because the model is stored in <path_to_root>/pretrained/defend_the_center.pth in the root directory not <path_to_root>/dumped/test/<testid>/pretrained/defend_the_center.pth.

I was successfully able to train and test after this change so the os.path.join is unnecessary.

Rather, the --reload parameter should be the relative path to the weights (.pth) one wants to reload, independent of the --dumped directory. This would allow one to run experiments using the pretrained weights from a different experiment.

Eg:

python arnold.py --exp_name experiment_B --dump_path dumped --scenario defend_the_center --frame_skip 2 --action_combinations "turn_lr+attack" --reload dumped/experiment_A/ngeuokc6ja/best-630000.pth --gpu_id 0

Also, great repo 🥇!

JadenTravnik avatar Jul 12 '18 16:07 JadenTravnik

I'm eager to run this programm on windows, but the requirements are so complex , could you show your enviroments and some utilities?

Throne-myworld avatar Nov 17 '21 10:11 Throne-myworld