我一直在使用 gpu 加速器在 kaggle 笔记本上训练强化学习模型,因为我只有一台 cpu 笔记本电脑可以使用。但是,当我尝试将模型导入本地 jupyter 笔记本时,为了渲染它,我收到以下错误。
AssertionError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_13752/2941311152.py in <module>
2 # device = torch.device('cpu')
3 # model = PPO('CnnPolicy', env, verbose = 1, tensorboard_log = Log_Dir, learning_rate = 0.000001, n_steps = 512)
----> 4 PPO.load('./Training/Saved Models/Mario Models/best_model_100000', env)
c:\users\test\appdata\local\programs\python\python39\lib\site-packages\stable_baselines3\common\base_class.py in load(cls, path, env, device, custom_objects, print_system_info, force_reset, **kwargs)
728 model.__dict__.update(data)
729 model.__dict__.update(kwargs)
--> 730 model._setup_model()
731
732 # put state_dicts back in place
c:\users\test\appdata\local\programs\python\python39\lib\site-packages\stable_baselines3\ppo\ppo.py in _setup_model(self)
156
157 # Initialize schedules for policy/value clipping
--> 158 self.clip_range = get_schedule_fn(self.clip_range)
159 if self.clip_range_vf is not None:
160 if isinstance(self.clip_range_vf, (float, int)):
c:\users\test\appdata\local\programs\python\python39\lib\site-packages\stable_baselines3\common\utils.py in get_schedule_fn(value_schedule)
89 value_schedule = constant_fn(float(value_schedule))
90 else:
---> 91 assert callable(value_schedule)
92 return value_schedule
93
AssertionError:
我尝试查看文档以纠正错误,但转移标准 pytorch 模型的指南不适用于稳定的基线模型。