Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

deep learning - Pytorch already installed using Conda but fails when called

I am trying to install pytorch for using BERT but when following the installation instructions found here: https://pytorch.org/get-started/locally/ I am getting an error.

When I try and initalise the BERT model I get the following error:

ImportError: 
    BertForSequenceClassification requires the PyTorch library but it was not found in your environment. 
    Checkout the instructions on theinstallation page: https://pytorch.org/get-started/locally/
    and follow the ones that match your environment.

I have followed the instructions and run the following command line in my Conda prompt terminal AND in my current working directory:

conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

It looks to complete but when I try and call the following line I get the same error as the start as if it hasn't installed at all.

Can anyone help me out please.

EDIT:

The code I am using to execute bert is:

model = BertForSequenceClassification.from_pretrained(r'C:Users441ertpytorch_model.bin', config = r'C:Users441ertconfig.json')
question from:https://stackoverflow.com/questions/65921244/pytorch-already-installed-using-conda-but-fails-when-called

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...