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

Categories

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...