自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 收藏
  • 关注

原创 RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #2 ‘target‘

在使用CrossEntropyLoss()函数时,引发上述错误,大致意思是数据类型不匹配,CrossEntropyLoss()要求输入数据应为long型,但是我的数据必须是float类型的,所以只能改用MSELoss()函数,保持两个输入向量size一致即可。...

2022-04-20 18:37:03 2547 1

原创 -bash: activate:No such file/

没有activate相关文件,无法激活虚拟环境解决方案:添加进去export PATH="~/miniconda3/bin:$PATH"

2021-08-15 14:12:51 703

原创 Missing key(s) in state_dict:

今天调试代码的时候发现一个错误:Missing key(s) in state_dict:错误代码:model.bert.load_state_dict(torch.load(args.init_checkpoint, map_location="cpu"))解决方案:model.load_state_dict(torch.load(args.init_checkpoint), False)...

2021-08-13 18:18:05 1281

原创 查看tensorflow环境下的GPU是否可以用

print(tf.test.is_gpu_available())

2021-08-10 15:43:19 258

转载 将tensorflow版本的.ckpt模型转成pytorch的.bin模型

转载自https://www.cnblogs.com/cxq1126/p/14277134.html如上图,将bert_model.ckpt文件转化成pytorch_model.bin文件可以自己创建一个文件convert.py,复制以下代码,修改一下路径名称即可。from __future__ import absolute_importfrom __future__ import divisionfrom __future__ import print_functionimport ar

2021-04-13 10:41:52 1083

原创 安装tensorflow镜像

链接:https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/tensorflow-gpu/在命令行中输入:python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu==2.2.1

2021-04-02 21:14:52 813

原创 python中list,tensor,array相互转化

list转化为arrayarray=numpy.array(list)array转化为listlist=numpy.list()tensor转化为listlist=tensor.numpy().tolist()list转化为tensortensor=torch.Tensor(list)array转化为tensortensor=torch.from_numpy(array)tensor转化为arrayarray=tensor.numpy()array=tenor.cpu().numpy

2021-03-23 09:49:07 3066 2

原创 RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 11.17 GiB total capacity; 1.10

服务器上跑程序,出现这种错误,大概是因为程序太大内存不够,有以下两种解决方式:1、batch_size设置太大,改小一点2、cuda节点被占用,可以指定其他节点,一种方式:程序里面写device = torch.device(‘cuda:0’ if torch.cuda.is_available() else ‘cpu’),服务器里面写CUDA_VISIBLE_DEVICES=X;另一种方式:程序里面直接写os.environ[“CUDA_VISIBLE_DEVICES”] = “2,3”...

2021-03-17 13:32:36 3121 1

原创 terminate called after throwing an instance of ‘std::runtime_error‘

terminate called after throwing an instance of ‘std::runtime_error’运行pytorch程序报错:terminate called after throwing an instance of ‘std::runtime_error’what(): NCCL Error 1: unhandled cuda error解决方法:我之前下载的pytorch版本是1.4的,后来换成1.0.1的就好了...

2021-03-14 18:56:01 1358

原创 服务器常用指令

服务器常用指令查看当前GPU的占用情况创建虚拟环境进入虚拟环境退出虚拟环境查看当前存在哪些虚拟环境查看指定用户是否占用GPU查看CUDA版本指定GPU版本查看当前GPU的占用情况nvidia-smi创建虚拟环境conda create -n your_env_name python=X.X(2.7、3.6等)进入虚拟环境source activate xxx退出虚拟环境source deactivate xxx查看当前存在哪些虚拟环境conda env list查看指定用户是否占用GP

2021-02-18 22:42:31 239

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除