简体   繁体   English

PyTorch 已安装。 但是,当我使用 BertModel 时,出现以下导入错误:

[英]PyTorch is installed. But, When I'm using BertModel, It is giving me following Import error:

I installed and imported PyTorch .我安装并导入PyTorch Still, I am getting this import error, while I'm using BertModel .不过,我在使用BertModel时遇到了这个导入错误。 I need some help here.我需要一些帮助。

Error I'm getting is this:我得到的错误是:

ImportError: BertModel requires the PyTorch library but it was not found in your environment. ImportError: BertModel 需要 PyTorch 库,但在您的环境中找不到。 However, we were able to find a TensorFlow installation.但是,我们能够找到 TensorFlow 安装。 TensorFlow classes begin with "TF", but are otherwise identica TensorFlow 类以“TF”开头,但其他方面相同

I tried this:我试过这个:

model = BertModel.from_pretrained("Rostlab/prot_bert")

I'm getting this:我明白了:

导入错误如图所示

I encountered the same error but it has disappeared after restarting jupyter.我遇到了同样的错误,但是重启jupyter后它就消失了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我不明白为什么下面的代码没有给我? - I'm not able to figure why the following code is giving me none? 我正在尝试使用 pytorch 库构建一个带有一个神经元的神经网络。 它一直给我一个错误 - I am trying to build a neural network with one neuron using the pytorch library. It keeps giving me an error 即使安装了 Matplotlib 也不会导入。 使用视觉工作室代码 - Matplotlib will not import even though it is installed. Using visual studio code 系统显示已安装所有请求的软件包。但是当我导入 pytorch 时收到错误消息 - system shows All requested packages already installed.however i get error message when i import pytorch “运行时错误:未安装默认上下文。”使用 Tensorflow Federated 时 - "RuntimeError: No default context installed. " when using Tensorflow Federated 为什么这个程序在我在 print() 函数中使用 + 时给我错误,并在我使用 ',' 时给我输出 - why does this program giving me the error when i am using + in print() function and giving me the output when i am using ',' 当我尝试导入 jupyter notebook(使用 venv)时,安装的包给出了“ModuleNotFoundError” - Installed package giving "ModuleNotFoundError" when I try to import into jupyter notebook (using venv) 我已经安装了pycrfsuite,但它仍然给出了导入错误 - I have already installed pycrfsuite still it is giving import error 导入 sutime 模块时出现以下导入错误 - 这是什么意思? - I'm getting the following Import Error when importing the sutime module - what does it mean? feedparser未安装。 使用无业游民 - feedparser not installed. Using vagrant
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM