x35f / unstable_baselines

Re-implementations of SOTA RL algorithms.
127 stars 12 forks source link

Errors in running the library in Win11+Anaconda #59

Closed paperplane03 closed 1 year ago

paperplane03 commented 1 year ago

I use Anaconda in win 11 to run the code. I follow the instruction, and when I run the command, error happens.

Command:

cd unstable_baselines/baselines/sac
python3 main.py configs/Ant-v3.py --gpu 0

image Besides, I try to run DQN+SpaceInvader Environment, the error is: image It seems the 41 line of util doesn't fit, what should I do to fix the error? Or I should run the library on LINUX?

typoverflow commented 1 year ago

It seems that the command is wrong. Now unstable baseline supports multiple benchmarks, and the command for running SAC in mujoco should be python3 main.py configs/mujoco/Ant-v4.py --gpu 0.

@x35f Maybe update the README?

paperplane03 commented 1 year ago

Using an existance file instead still has the same problem. I check the version of python and it is 3.10.9. (I use python rather than python3 because my environment is Win) I STFW, and find the problem is related to the structure of the library.I have no idea to solve it because I don't know the structure. What should I do to solve it? Or what should I provide to make you know it more clearly? Besides, I'll try it in XUbuntu. Can you add the "Recommend Environment" besides python env in documentation, that may help.

typoverflow commented 1 year ago

It seems that the USB prints the absolute as well as the relative path of the config file: https://github.com/x35f/unstable_baselines/blob/5556a320c6056654f0052f079350b3e79c63a185/unstable_baselines/common/util.py#L39-L40

Could you paste the log here so that we can locate the issue?

paperplane03 commented 1 year ago

image This is the debugger picture in line 41,utils.py print(default_config_path) >> .\configs\gym-discrete\default.py print(relative_path_to_module_path(default_config_path)) >> ..configs.gym-discrete.default

typoverflow commented 1 year ago

https://github.com/x35f/unstable_baselines/blob/5556a320c6056654f0052f079350b3e79c63a185/unstable_baselines/common/util.py#L31-L33

This is due to a plain substitution of SEP to . , resulting in ..config which causes a relative import. It is more plausible to directly import config files from its path, like what we did in UtilsRL: https://github.com/typoverflow/UtilsRL/blob/d1e17abcc3b1030a5cfd18fc8c102fc228ba9c3a/UtilsRL/exp/argparse.py#L62-L67

cc. @x35f to fix this issue.

x35f commented 1 year ago

Sorry for this bug. You can for now use the command without the ".\" prefix for the config path, as illustrated in the following figure: image We'll fix this ASAP.

paperplane03 commented 1 year ago

Thanks! Now it can be runned!