0

I am getting the following error when I try to load my saved Pytorch model.

ModuleNotFoundError: No module named 'transformers.models'

The way I am loading the model is : model = torch.load(r'Models-BERT\model-duplicates dropped(sampled)_v2', map_location=torch.device('cpu'))

I saved the model using: torch.save(model, 'Models-BERT/model-duplicates dropped(sampled)_v2')

The version of transformers used: 3.4.0

also tested on transformers version 4.12.2

So far I have tried upgrading the transformers library, I have tried the solution provided in the similar question on StackOverflow here:StackOverflow similar question but nothing worked. I also ran my code on Azure notebook and on my local system, both are giving same error.

When I run the same snippet on Azure, I am getting

ModuleNotFoundError: No module named 'transformers.modeling_bert'

What could be the issue here? And how can I run this code?

Saksham Dubey
  • 134
  • 2
  • 18

0 Answers0