IDNA-ABF代码运行记录

切换国内安装镜像源:

pip install [需要安装的库] -i https://pypi.tuna.tsinghua.edu.cn/simple

清华: https://pypi.tuna.tsinghua.edu.cn/simple

阿里: http://mirrors.aliyun.com/pypi/simple/

豆瓣: http://pypi.douban.com/simple/

pytorch安装与配置

pytorch官网:https://pytorch.org/

一、运行train.py报错:

TypeError: type torch.cuda.LongTensor not available. Torch not compiled with CUDA enabled.

原因:镜像源下载的一般为CPU版本,也是这导致前面所说一直返回false。

解决:

  1. 使用conda卸载pytorch

conda uninstall pytorch
conda uninstall libtorch
  1. cmd查看cuda版本

nvcc --version

cuda版本是10.2

  1. 离线下载pytorch,并拷贝到安装的环境中

网址:https://download.pytorch.org/whl/torch_stable.html

下载地址:

https://download.pytorch.org/whl/cu102/torch-1.8.1%2Bcu102-cp39-cp39-win_amd64.whl

  1. 安装

pip install numpy-1.24.2-cp39-cp39-win_amd64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install torch-1.8.1+cu102-cp39-cp39-win_amd64.whl

Use --force-reinstall to force an installation of the wheel.

  1. 检查

import torch
print(torch.__version__)
print(torch.cuda.is_available())
print(torch.cuda.device_count())

报错:

OSError: Can't load the configuration of '../pretrain/DNAbert_3mer'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure '../pretrain/DNAbert_3mer' is the correct path to a directory containing a config.json file

OSError:无法加载'../pretrain/DNAbert_3mer'的配置。如果您试图从https://huggingface.co/models加载它,确保你没有一个同名的本地目录。否则,请确保../pretrain/DNAbert_3mer是包含config.json文件的目录的正确路径。

服务器运行

报错:TypeError: type torch.cuda.LongTensor not available. Torch not compiled with CUDA enabled.

查看显卡版本

lspci | grep -i nvidia

没有输出

重新输入:

lspci | grep -i vga

返回:

00:02.0 VGA compatible controller: Cirrus Logic GD 5446

没有nvidia显卡,只有一个普通显卡,即便安装cuda也没用,不能加速计算。

(参考:https://blog.csdn.net/feng_1_ying/article/details/107307015

确认Linux版本是否支持CUDA

uname -m && cat /etc/*release

若有信息输出,说明linux支持

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值