qiongwu86 / DDPG-RIS-MADDPG-POWER

13 stars 2 forks source link

运行main_test_ris和marl_test一直说找不到文件,都是同样的错误,是为啥啊 #2

Open xipinghai opened 1 month ago

xipinghai commented 1 month ago

C:\Users\hp.conda\envs\py39\python.exe D:\DaiMa\DDPG-RIS-MADDPG-POWER-main\marl_test.py ------------- lanes are ------------- up_lanes : [200.875, 202.625, 400.875, 402.625] down_lanes : [197.375, 199.125, 397.375, 399.125] left_lanes : [200.875, 202.625, 400.875, 402.625] right_lanes : [197.375, 199.125, 397.375, 399.125]

Initializing agent 0 Initializing agent 1 Initializing agent 2 Initializing agent 3 Initializing agent 4 Initializing agent 5 Initializing agent 6 Initializing agent 7 Initializing Global critic ... ... loading checkpoint ... D:\DaiMa\DDPG-RIS-MADDPG-POWER-main\networks1.py:90: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. self.load_state_dict(T.load(self.checkpoint_file, map_location='cpu')) Traceback (most recent call last): File "D:\DaiMa\DDPG-RIS-MADDPG-POWER-main\marl_test.py", line 110, in global_agent.load_models() File "D:\DaiMa\DDPG-RIS-MADDPG-POWER-main\global_critic.py", line 45, in load_models self.global_critic1.load_checkpoint() File "D:\DaiMa\DDPG-RIS-MADDPG-POWER-main\networks1.py", line 90, in load_checkpoint self.load_state_dict(T.load(self.checkpoint_file, map_location='cpu')) File "C:\Users\hp.conda\envs\py39\lib\site-packages\torch\serialization.py", line 1319, in load with _open_file_like(f, "rb") as opened_file: File "C:\Users\hp.conda\envs\py39\lib\site-packages\torch\serialization.py", line 659, in _open_file_like return _open_file(name_or_buffer, mode) File "C:\Users\hp.conda\envs\py39\lib\site-packages\torch\serialization.py", line 640, in init super().init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'D:\DaiMa\DDPG-RIS-MADDPG-POWER-main\model2/sarl_marl3\global_critic1_ddpg'

Qi1216 commented 1 month ago

因为我在训练的时候肯定要训练很多次,模型保存也有很多,你要根据错误提示在network1.py里修改要加载的模型路径,如model.py中的sarl_marl。