ERROR: MPNetTokenizerFast' object has no attribute '_in_target_context_manager
Author: Eeshvardhanshet
Pull request: no

HI Team,

Can anyone help me on above error. I was using SentenceTransformer('paraphrase-mpnet-base-v2'). When deploy the model and testing performed I got this error. 

Comments:
Also, I get this error:

HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/sentence-transformers/paraphrase-MiniLM-L6-v2 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f2cc8a5e8d0>: Failed to establish a new connection: [Errno 111] Connection refused'))

i'm getting same issue too 
python : 3.8.12
keybert==0.5.0
transformers==4.22.2
full Traceback 

```Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/keybert/_model.py", line 113, in extract_keywords
    keywords = self._extract_keywords_single_doc(doc=docs,
  File "/usr/local/lib/python3.8/site-packages/keybert/_model.py", line 182, in _extract_keywords_single_doc
    doc_embedding = self.model.embed([doc])
  File "/usr/local/lib/python3.8/site-packages/keybert/backend/_sentencetransformers.py", line 53, in embed
    embeddings = self.embedding_model.encode(documents, show_progress_bar=verbose)
  File "/usr/local/lib/python3.8/site-packages/sentence_transformers/SentenceTransformer.py", line 161, in encode
    features = self.tokenize(sentences_batch)
  File "/usr/local/lib/python3.8/site-packages/sentence_transformers/SentenceTransformer.py", line 319, in tokenize
    return self._first_module().tokenize(texts)
  File "/usr/local/lib/python3.8/site-packages/sentence_transformers/models/Transformer.py", line 113, in tokenize
    output.update(self.tokenizer(*to_tokenize, padding=True, truncation='longest_first', return_tensors="pt", max_length=self.max_seq_length))
  File "/usr/local/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 2482, in __call__
    if not self._in_target_context_manager:
AttributeError: 'DistilBertTokenizerFast' object has no attribute '_in_target_context_manager'```


@Eeshvardhanshet , please share if you reached a solution for this 

@Eeshvardhanshet , i think i figured it out, i was using a third part library [keybert](https://github.com/MaartenGr/KeyBERT) , that was trying to install the latest version from transformers (4.22.2) , I checked the last running deployment and found that it was using `transformers==4.21.1` . <br>
so you need to downgrade your transformers version to either 4.21.1 or the last successful running version


@msaoudallah . You are right, I have downgraded transformers version to 4.21.1. It did work. Anyways, thanks @msaoudallah 

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.

>need downsizing to transformers==4.21.1

> Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.

might be more beneficial to fix the issue