WELCOME TO Pluto134340小行星

清风湿润,茶烟轻扬。

TrajPAC踩坑合集

 1.   RuntimeError: CUDA error: no kernel image is available for execution on the device
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
CUDA_LAUNCH_BLOCKING=1 python . --net AgentFormer --dataset zara1 --radius 0.03 --epsilon 0.01 --eta 0.01 --attack_scope full --adversary linear --robust_type pure --score_fn ade --fid 4400 --pid 65 -FT 30000 -ST 12000 --log_ext analysis --plot_heatmap --plot_sens --plot_traj

2. (TrajPAC) root@autodl-container-a3db44bd3d-bf2d09a9:~/autodl-tmp/Trajpac/TrajPAC/src# CUDA_LAUNCH_BLOCKING=1 python . --net MID --dataset zara1 --radius 0.03 --epsilon 0.01 --eta 0.01 --attack_scope full --adversary linear --robust_type pure --score_fn ade --fid 4430 --pid 69 -FT 4000 -ST 3000 --log_ext analysis --plot_heatmap --plot_sens --plot_traj
----------------------------------------------------------------------- /root/autodl-tmp/Trajpac/TrajPAC/src

Preparing pooled data...
11111111111111111111111111111111111111 MID
----------------------------------------------------------------------- /root/autodl-tmp/Trajpac/MID

FileNotFoundError: [Errno 2] No such file or directory: './config/mid.yml'分析报错原因
为什么路径切换了????————————未解决

3. AttributeError: type object 'spmatrix' has no attribute '__div__'. Did you mean: '__dir__'?
使用1.2.1版本的scikit-learn
conda install -c conda-forge scikit-learn=1.2.1 scipy=1.10.1
或者只用前一个 pip install scikit-learn==1.2.1


4. ModuleNotFoundError: No module named 'cv2'
pip install opencv-python


5. 数据在gpu cpu问题
总结
修改后的代码解决了原代码变量未定义的问题,并且能根据实际情况自动选择合适的计算设备,是正确的修改方式。
不过,在后续使用 `self.device` 时,要确保所有需要进行计算的张量和模型都通过 `.to(self.device)` 方法移动到了该设备上,
以避免出现“张量位于不同设备”的错误。例如:
```python
# 假设这是你的模型
self.model = YourModel().to(self.device)

# 假设这是你的输入数据
input_tensor = torch.randn(1, 10).to(self.device)

# 进行前向传播
output = self.model(input_tensor)
```

6. 保存环境
conda env export -n TrajPAC --file environment.yml   保存【当前路径】
conda env update --name TraiPAC --file environment.yml --prune  更新已存在的TraiPAC环境

7. 创建环境
conda env create -f environment.yml -n TrajPAC      创建


posted @ 2025-04-08 15:44  Pluto134340  阅读(120)  评论(0)    收藏  举报