linear(): argument ‘input‘ (position 1) must be Tensor, not str
TypeError: linear(): argument 'input' (position 1) must be Tensor, not str
在使用hugging fice加载预训练bert的时候,出现这个问题,原来是这样写的:
self.bert = BertModel.from_pretrained(pretrained_model_path, output_hidden_states=True, output_attentions=True, return_dict=True)
将 return_dict 设置为 False 即可
self.bert = BertModel.from_pretrained(pretrained_model_path, output_hidden_states=True, output_attentions=True, return_dict=False)
参考:https://blog.csdn.net/qsx123432/article/details/123984811
linear(): argument ‘input‘ (position 1) must be Tensor, not str相关推荐
- TypeError系列之:TypeError: conv2d(): argument 'input' (position 1) must be Tensor, not NoneType
这里出现类似错误往往是因为,conv2d()函数的第一个参数,需要时一个tensor行的数据,然而却赋值成了not后给的类型. 我出现问题的原因是,中间有一个函数缺少返回值,因此会造成NoneType ...
- argument ‘input‘ (position 1) must be Tensor, not XX
这里:numpy 和 tensor数据相互转换的方法: 1.numpy->tensor data = torch.tensor(data) 2.tensor->numpy 非训练数据(训练 ...
- input(position 1) must be Tensor, not NoneType
https://blog.csdn.net/qq_41368074/article/details/105560274?utm_medium=distribute.pc_relevant.none-t ...
- pytorch view(): argument 'size' (position 1) must be tuple of ints, not Tensor
view(): argument 'size' (position 1) must be tuple of ints, not Tensor pytorch的view函数参数不能是tensor,解决方 ...
- {TypeError}clamp(): argument 'min' must be Number, not Tensor
{TypeError}clamp(): argument 'min' must be Number, not Tensor x1是二维数组, xx1 = x1[order[1:]].clamp(min ...
- errors_impl.InvalidArgumentError: Input to reshape is a tensor
errors_impl.InvalidArgumentError: Input to reshape is a tensor InvalidArgumentError (see above for t ...
- pytorch torch.norm(input, p=2) → float、torch.norm(input, p, dim, out=None) → Tensor(求范数)
torch.norm 用法1: torch.norm(input, p=2) → float 返回输入张量input 的p 范数. 参数: input (Tensor) – 输入张量 p (float ...
- 2021.08.25学习内容torch.clamp(input, min, max, out=None) → Tensor,torch.mm(matrix multiply)
学习pytorch时,看到了mm和clamp,不甚理解,其他地方也看到过,所以具体了解一下 前向传递:计算预测yh = x.mm(w1)h_relu = h.clamp(min=0) 把 h 张量的最 ...
- 【tensorflow】Input to reshape is a tensor with xxx values, but the requested shape requires a multipl
今天写了一个简单的3DCNN,结果在跑的时候出现一个问题, tensorflow.python.framework.errors.InvalidArgumentError: Input to resh ...
最新文章
- 智源新闻 | 麻省理工学院教授Max Tegmark报告交流会在北京举行
- 软文的作用真的有那么神奇吗?
- Spring 源码分析 spring-core
- 2012年第一个工作日
- yolo算法_不到2MB,超轻YOLO算法!准确率接近YOLOv3,速度快上45%
- 中式装修怎么做,有哪些注意事项?
- 使用浏览器地址栏调用CXF Webservice的写法
- java类型转换的要求_java数据类型04_基本数据类型转换
- Android的cangoback方法,Android应用开发Android8.0 WebView返回上一层失效(canGoBack返回false问题)解决办法...
- Chrome 谷歌浏览器将整个网页保存为图片
- sloth(标点工具)使用说明
- [6.15] 心态 信念
- html页面ie不显示图片,IE浏览器网页不显示图片如何解决?解决方法介绍
- 零基础学FPGA(四):IP是什么东西(什么是软核,硬核)
- 直播行业的梦幻泡影:主播们的数据人生
- 浏览器同源政策之ajax请求不能发送
- 阳性,阴性,假阳性,假阴性,敏感度,特异性
- SpringBoot+Vue实现前后端分离的校园外卖配送系统
- 【软考】【系统架构设计师】2021上午真题及答案
- ItunesConnect:苹果内购项目元数据缺失