Jingliang-Duan / DSAC-v2

DSAC-v2; DSAC-T; DASC; Distributional Soft Actor-Critic
253 stars 25 forks source link

Train with GPU #2

Closed ZDDWLIG closed 7 months ago

ZDDWLIG commented 1 year ago

Thank you for your great work! I run through the code but the GPU seems not to be used. Are there any parameters that need to be set? How can I train on GPU?

Jingliang-Duan commented 1 year ago

Hi,

Thank you for your generous compliments and the keen interest you've shown in my project!

To facilitate GPU usage, please proceed as follows: navigate to the "key parameters" section in the "example_train/main.py" file (typically found around line 28). Within this section, set the "enable_cuda" parameter to true. By default, it's configured as "False." Provided that your system is equipped with a compatible GPU that includes the necessary CUDA support, the training will automatically utilize it.

Should you have any additional questions or face any difficulties, don't hesitate to get in touch.

Best regards

ZDDWLIG commented 1 year ago

Hi, Thank you for your reply! Now I can use GPU. One more request, could you provide your test code ? I am trying to get some visual results. Look forward to your reply. Best regards

Jingliang-Duan commented 1 year ago

We have revised the code to enable testing and simulation. For more details, please refer to the instructions provided in the Readme file. Please note that the updated test function does not support policies learned from the old version.

ZDDWLIG commented 1 year ago

Thank you for your reply! I still ran into some problems when I tested Humanoid-v3 *** Begin to run policy 1 *** Traceback (most recent call last): File "run_policy.py", line 13, in <module> runner.run() File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/sys_run.py", line 657, in run self.__run_data() File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/sys_run.py", line 606, in __run_data env = self.__load_env() File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/sys_run.py", line 562, in __load_env env = create_env(**env_args) File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/initialization.py", line 17, in create_env file = __import__(env_name_data) ModuleNotFoundError: No module named 'Humanoid-v3_data'

ZDDWLIG commented 1 year ago

Thank you for your reply! I still ran into some problems when I tested Humanoid-v3 *** Begin to run policy 1 *** Traceback (most recent call last): File "run_policy.py", line 13, in <module> runner.run() File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/sys_run.py", line 657, in run self.__run_data() File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/sys_run.py", line 606, in __run_data env = self.__load_env() File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/sys_run.py", line 562, in __load_env env = create_env(**env_args) File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/initialization.py", line 17, in create_env file = __import__(env_name_data) ModuleNotFoundError: No module named 'Humanoid-v3_data'

I have fix it. Thank you!

Jingliang-Duan commented 1 year ago

Thank you for your reply! I still ran into some problems when I tested Humanoid-v3 *** Begin to run policy 1 *** Traceback (most recent call last): File "run_policy.py", line 13, in <module> runner.run() File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/sys_run.py", line 657, in run self.__run_data() File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/sys_run.py", line 606, in __run_data env = self.__load_env() File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/sys_run.py", line 562, in __load_env env = create_env(**env_args) File "/hy-tmp/test/Distributional-Soft-Actor-Critic-2.0-main/utils/initialization.py", line 17, in create_env file = __import__(env_name_data) ModuleNotFoundError: No module named 'Humanoid-v3_data'

Yes, it's easy to solve this problem by replace "Humanoid-v3" in the main.py with "gym_humanoid". Then it will call env_gym's data file, same for other envs.