IndexError: list index out of range
heguangxue opened this issue · 14 comments
你好,我在运行experiment.py时弹出这个错误,请问是为什么?
Traceback (most recent call last):
File "D:\hgxdm\dm\Game-Theoretic-Deep-Reinforcement-Learning-main\Game\Experiment\experiment.py", line 7, in
tf.config.experimental.set_virtual_device_configuration(gpus[0],
IndexError: list index out of range
请确认下运行的机器是否具有GPU,gpus[0]表示第一块GPU。
一般来说,可以使用
nvidia-smi -l 1
来参看当前机器GPU的运行情况。
你好,谢谢你的回复!按照命令检查了GPU的运行情况,发现没有在运行。结果如下
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| No running processes found |
+---------------------------------------------------------------------------------------+
Thu Apr 20 09:33:13 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 531.14 Driver Version: 531.14 CUDA Version: 12.1 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce MX250 WDDM | 00000000:06:00.0 Off | N/A |
| N/A 51C P0 N/A / N/A| 0MiB / 2048MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|==============================
但是我已经安装了tensorflower2.10.0+cuda_11.2.0+cudnn-8.1,不知道是哪里出问题了?
你好,如果设备没有gpu,怎么做
因为我之前也没在CPU上跑过,可以试试修改https://github.com/neardws/Game-Theoretic-Deep-Reinforcement-Learning/blob/main/Experiment/experiment.py 中的代码。
cpus = tf.config.experimental.list_physical_devices('CPU')
你好,我在运行experiment.py时出现以下错误:
1.AttributeError: 'function' object has no attribute 'BoundedArray'
2.ModuleNotFoundError: No module named ‘Experiment’
3.AttributeError: 'function' object has no attribute ’TensorTransformation’
请问是什么原因?谢谢
可能是当前运行环境不在项目文件夹下?所以找不见Experiment包?不知道你是如何运行的,建议使用VSCode,在VSCode中打开项目文件下后,运行 experiment.py 试试。
你好,这个代码的环境在linux下,还是在windows下,还是二者都可以
最好是在Linux,Windows的话可以考虑安装下Ubuntu for WSL 2
请问您是在linux环境下用vscode跑的吗