NTU ML2023Spring Part3.12 reinforcement learning

colab 上环境跑不起来.做了些神秘调整(指我都忘了做了什么)在 kaggle 上跑成功了,结果发现是 simple baseline 的版本,我改后的东西没保存.

然后把 colab 上最新一版下载到本地,覆盖旧的文件,上传到 kaggle 上,又跑不起来了.

AttributeError                            Traceback (most recent call last)

<ipython-input-31-571194901> in <cell line: 0>()
----> 1 observation, reward, done, info = env.step(random_action)

5 frames

/usr/local/lib/python3.11/dist-packages/gym/wrappers/time_limit.py in step(self, action)
     58         """
     59         observation, reward, terminated, truncated, info = step_api_compatibility(
---> 60             self.env.step(action),
     61             True,
     62         )

/usr/local/lib/python3.11/dist-packages/gym/wrappers/order_enforcing.py in step(self, action)
     35         if not self._has_reset:
     36             raise ResetNeeded("Cannot call env.step() before calling env.reset()")
---> 37         return self.env.step(action)
     38 
     39     def reset(self, **kwargs):

/usr/local/lib/python3.11/dist-packages/gym/wrappers/step_api_compatibility.py in step(self, action)
     50             (observation, reward, terminated, truncated, info) or (observation, reward, done, info)
     51         """
---> 52         step_returns = self.env.step(action)
     53         if self.new_step_api:
     54             return step_to_new_api(step_returns)

/usr/local/lib/python3.11/dist-packages/gym/wrappers/env_checker.py in step(self, action)
     35         if self.checked_step is False:
     36             self.checked_step = True
---> 37             return env_step_passive_checker(self.env, action)
     38         else:
     39             return self.env.step(action)

/usr/local/lib/python3.11/dist-packages/gym/utils/passive_env_checker.py in env_step_passive_checker(env, action)
    239 
    240         # np.bool is actual python bool not np boolean type, therefore bool_ or bool8
--> 241         if not isinstance(terminated, (bool, np.bool8)):
    242             logger.warn(
    243                 f"Expects `terminated` signal to be a boolean, actual type: {type(terminated)}"

/usr/local/lib/python3.11/dist-packages/numpy/__init__.py in __getattr__(attr)
    408             return char.chararray
    409 
--> 410         raise AttributeError("module {!r} has no attribute "
    411                              "{!r}".format(__name__, attr))
    412 

AttributeError: module 'numpy' has no attribute 'bool8'

尝试回溯版本,发现 kaggle 上根本没有保存版本.

尝试找本地文件,发现新版覆盖了旧版.

尝试翻浏览器下载记录,发现下载链接是以 blob:null 开头的,我不会打开.

尝试回溯 colab 上文件的版本,发现旧版新版都跑不起来.还把新版的改动弄丢了.

代码能跑就不要动.jpg

然后借助 colab 上 gemini 的帮助把 numpy 降级到了 1.23.5,现在能跑了.

看了一下跑出来的效果,飞船着陆还挺平稳的,和随机相比有提高.没地方提交,只能在本地自娱自乐了.

posted @ 2025-06-18 21:20  383494  阅读(12)  评论(0)    收藏  举报