我找到了有趣的模型 - 问题生成器,但无法运行它。我收到一个错误:
Traceback (most recent call last):
File "qg.py", line 5, in <module>
model = AutoModelWithLMHead.from_pretrained("/home/user/ml-experiments/gamesgen/t5-base-finetuned-question-generation-ap/")
File "/home/user/.virtualenvs/hugging/lib/python3.7/site-packages/transformers/modeling_auto.py", line 806, in from_pretrained
return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
File "/home/user/.virtualenvs/hugging/lib/python3.7/site-packages/transformers/modeling_utils.py", line 798, in from_pretrained
import torch_xla.core.xla_model as xm
ModuleNotFoundError: No module named 'torch_xla'
我简单地搜索了一下,发现“torch_xla”是一种用于在 TPU 上训练 pytorch 模型的东西。但是我想在 cpu 上本地运行它(当然是为了推理),当 pytorch 尝试加载 tpu 绑定的张量时出现此错误。我该如何解决?
这是我试过的模型:https ://huggingface.co/mrm8488/t5-base-finetuned-question-generation-ap