英文:
Hugging Face transformer - object not callable
问题
我正在尝试使用Hugging Face的T5转换器制作文本摘要器。
我从Hugging Face的网站上运行以下代码:
from transformers import T5Tokenizer, T5Model
tokenizer = T5Tokenizer.from_pretrained("t5-small")
model = T5Model.from_pretrained("t5-small")
在此之前,我使用pip安装了transformers、sentencepiece和datasets transformers[sentencepiece]。
当我运行它时,我收到以下错误信息:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In [9], line 2
1 # Load the T5 model and tokenizer
----> 2 tokenizer = T5Tokenizer.from_pretrained("t5-small")
3 model = T5Model.from_pretrained("t5-small")
TypeError: 'NoneType' object is not callable
我在这里做错了什么?
英文:
I am trying to make a text summarizer using the T5 transformer from Hugging Face.
From the Hugging Face site I am running this:
from transformers import T5Tokenizer, T5Model
tokenizer = T5Tokenizer.from_pretrained("t5-small")
model = T5Model.from_pretrained("t5-small")
Before this I pip installed transformers, sentencepiece, and datasets transformers[sentencepiece]
When I run it I get the following:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In [9], line 2
1 # Load the T5 model and tokenizer
----> 2 tokenizer = T5Tokenizer.from_pretrained("t5-small")
3 model = T5Model.from_pretrained("t5-small")
TypeError: 'NoneType' object is not callable
What am I doing wrong here?
答案1
得分: 1
我重新启动了内核,然后它正常工作了。
英文:
I restarted the kernel and then it worked
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论