dropout():参数“输入"(位置 1)必须是张量,而不是在使用 Bert 和 Huggingface 时的 str [英] dropout(): argument 'input' (position 1) must be Tensor, not str when using Bert with Huggingface

查看:173
本文介绍了dropout():参数“输入"(位置 1)必须是张量,而不是在使用 Bert 和 Huggingface 时的 str的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码运行良好,当我今天尝试在不更改任何内容的情况下运行它时,出现以下错误:

My code was working fine and when I tried to run it today without changing anything I got the following error:

dropout(): argument 'input' (position 1) must be Tensor, not str

如能提供帮助,将不胜感激.
可能是数据加载器的问题?

Would appreciate if help could be provided.
Could be an issue with the data loader?

推荐答案

如果你使用 HuggingFace,这个信息 可能有用.我有同样的错误并通过在退出之前在模型类中添加参数 return_dict=False 来修复它:输出 = 模型(**输入,return_dict=False)

if you use HuggingFace, this information could be useful. I have same error and fix it with adding parameter return_dict=False in model class before dropout: outputs = model(**inputs, return_dict=False)

这篇关于dropout():参数“输入"(位置 1)必须是张量,而不是在使用 Bert 和 Huggingface 时的 str的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆