linyiLYi / snake-ai

An AI agent that beats the classic game "Snake".
Apache License 2.0
1.59k stars 352 forks source link

运行test_cnn.py报错 #16

Open timing2022 opened 1 year ago

timing2022 commented 1 year ago

D:\Downloads\Astudy\setpath\python.exe "D:\Watershed APP\pycharm2021\SetPath\PyCharm 2021.3\plugins\python\helpers\pycharm_jb_pytest_runner.py" --path D:/python-code/snake-newai/snake-ai/main/test_cnn.py Testing started at 2:11 ... Launching pytest with arguments D:/python-code/snake-newai/snake-ai/main/test_cnn.py --no-header --no-summary -q in D:\python-code\snake-newai\snake-ai\main

============================= test session starts ============================= collecting ... Using seed = 404264808 for testing.

test_cnn.py:None (test_cnn.py) test_cnn.py:25: in model = MaskablePPO.load(MODEL_PATH) C:\Users\ca'd\AppData\Roaming\Python\Python39\site-packages\stable_baselines3\common\base_class.py:663: in load data, params, pytorch_variables = load_from_zip_file( C:\Users\ca'd\AppData\Roaming\Python\Python39\site-packages\stable_baselines3\common\save_util.py:390: in load_from_zip_file load_path = open_path(load_path, "r", verbose=verbose, suffix="zip") D:\Downloads\Astudy\setpath\lib\functools.py:888: in wrapper return dispatch(args[0].class)(*args, *kw) C:\Users\ca'd\AppData\Roaming\Python\Python39\site-packages\stable_baselines3\common\save_util.py:234: in open_path_str return open_path(pathlib.Path(path), mode, verbose, suffix) D:\Downloads\Astudy\setpath\lib\functools.py:888: in wrapper return dispatch(args[0].class)(args, **kw) C:\Users\ca'd\AppData\Roaming\Python\Python39\site-packages\stable_baselines3\common\save_util.py:258: in open_path_pathlib path = path.open("rb") D:\Downloads\Astudy\setpath\lib\pathlib.py:1252: in open return io.open(self, mode, buffering, encoding, errors, newline, D:\Downloads\Astudy\setpath\lib\pathlib.py:1120: in _opener return self._accessor.open(self, flags, mode) E PermissionError: [Errno 13] Permission denied: 'D:\python-code\snake-newai\snake-ai\main\trained_models_cnn\ppo_snake_final' collected 0 items / 1 error

!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!! ======================== 2 warnings, 1 error in 3.36s =========================

进程已结束,退出代码2

timing2022 commented 1 year ago

使用软件:pycharm 在装环境时没有执行:

[可选] 使用 GPU 训练需要手动安装完整版 PyTorch

conda install pytorch=2.0.0 torchvision pytorch-cuda=11.8 -c pytorch -c nvidia

[可选] 运行程序脚本测试 PyTorch 是否能成功调用 GPU

python .\utils\check_gpu_status.py

timing2022 commented 1 year ago

image 即便换成这个也会报错 image image

timing2022 commented 1 year ago

问题已解决,环境问题,库没装完全

timing2022 commented 1 year ago

image