我正在尝试让以下预训练的拥抱脸模型工作: https ://huggingface.co/mmoradi/Robust-Biomed-RoBERTa-RelationClassification
我使用以下代码:
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("mmoradi/Robust-Biomed-RoBERTa-RelationClassification")
model = AutoModel.from_pretrained("mmoradi/Robust-Biomed-RoBERTa-RelationClassification")
inputs = tokenizer("""The colorectal cancer was caused by mutations in angina""")
outputs = model(**inputs)
出于某种原因,在尝试生成输出时出现以下错误,因此在我的代码的最后一行:
--> 796 input_shape = input_ids.size() 797 elif inputs_embeds 不是 None: 798 input_shape = inputs_embeds.size()[:-1]
AttributeError:“列表”对象没有属性“大小”
输入如下所示:
{'input_ids': [0, 133, 11311, 1688, 3894, 337, 1668, 21, 1726, 30, 28513, 11, 1480, 347, 2], 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
我不知道如何调试这个,所以欢迎任何帮助或提示!