'Loading Custom SentenceTransformer Models from local not working
I am using the SentenceTransformers library (here: https://pypi.org/project/sentence-transformers/#pretrained-models). I have chosen BERT Model[https://huggingface.co/bert-base-uncased] for implementing the text classification model and after implementation, saved model for the trained data locally.
But when I tried to load model from my local using -->
"" sample = SentenceTransformer('Downloads/bert_base_uncased') ""
am getting following __version__ error
File C:\ProgramData\Anaconda3\lib\site-
packages\sentence_transformers\SentenceTransformer.py:112, in
SentenceTransformer.__init__(self, model_name_or_path, modules, device)
110 with open(os.path.join(model_path, 'config.json')) as fIn:
111 config = json.load(fIn)
--> 112 if config['__version__'] > __version__:
113 logger.warning("You try to use a model that was created with version {},
however, your version is {}. This might cause unexpected behavior or errors. In that case,
try
to update to the latest version.\n\n\n".format(config['__version__'], __version__))
115 with open(os.path.join(model_path, 'modules.json')) as fIn:
KeyError: '__version__'
Earlier am using sentence_transformers==1.1.1 but even i tried to upgraded verison to sentence_transformers==2.1.0
still am facing KeyError: '__version__' for sentence_transformers
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
