TSLib时序库代码复现 第一篇

配置运行环境

  • git clone
1
git clone https://github.com/thuml/Time-Series-Library.git
  • 新建 Python 环境, 激活, 并安装所需的包,Python3.8 适配的 torch 环境
1
2
3
4
5
6
conda env list
conda create -n TSLib python==3.8 -y
conda activate TSLib
pip install -r requirements.txt
conda install pytorch==2.0.0 torchvision torchaudio pytorch-cuda==11.8 -c pytorch -c nvidia -y
pip install debugpy

这个库,居然不给 torch 环境🙂‍↔️一直报错

配置调试环境

  • 配置调试环境
1
pip install debugpy
  • 修改 .sh 文件
1
2
3
4
5
python -u run.py
# 需要手动点击 调试,开始运行
python -m debugpy --listen 5998 --wait-for-client run.py 
# 可以移除 --wait-for-client 参数,让程序不必等待客户端连接就开始运行
python -m debugpy --listen 5998 run.py \
  • 修改配置文件 "configurations" , 点击小虫子配置
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
        {
            "name": "[这里更换为任意名称]",
            "type": "debugpy",
            "justMyCode": true,
            "request": "attach",
            "connect": {
                "host": "localhost",
                "port": 5998
            }
        },
  • 调试显示形状
1
import custom_repr

启动调试

  • run.py 打断点
  • 启动 shell 脚本: sh 脚本路径
  • 点击小虫子,连接调试

这个仓库复现会报错: RuntimeError No CUDA GPUs are available

👾 本站运行时间:
发表了59篇文章 · 总计11万6千字
使用 Hugo 构建
主题 StackJimmy 设计