小编Den*_*nis的帖子

ModuleNotFoundError:使用 Anaconda 时没有名为“huggingface_hub.utils”的模块

我正在尝试执行 Huggingface 网站的示例代码:

from transformers import GPTJTokenizer, TFGPTJModel
import tensorflow as tf

tokenizer = GPTJTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = TFGPTJModel.from_pretrained("EleutherAI/gpt-j-6B")

inputs = tokenizer("Hello, my dog is cute", return_tensors="tf")
outputs = model(inputs)

last_hidden_states = outputs.last_hidden_state
Run Code Online (Sandbox Code Playgroud)

我正在使用 anaconda,并且按照文档conda install -c huggingface transformers中的说明预先安装了 Transformer 包。但当我尝试执行代码时,我仍然收到此错误。弹出如下错误信息:ModuleNotFoundError: No module named 'huggingface_hub.utils'

如何解决这个错误?

python anaconda modulenotfounderror huggingface

3
推荐指数
1
解决办法
2万
查看次数