Huggingface pre-trained model

Viewed 52

I try to use the below code:

from transformers import AutoTokenizer, AutoModel
t = "ProsusAI/finbert"
tokenizer = AutoTokenizer.from_pretrained(t)
model = AutoModel.from_pretrained(t)

The error: I think this error is due to the old version of transformers not having such pre-trained model. I checked and its confirmed.

/usr/local/lib/python3.7/dist-packages/transformers/configuration_utils.py in get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
    380                 f"- or '{pretrained_model_name_or_path}' is the correct path to a directory containing a {CONFIG_NAME} file\n\n"
    381             )
--> 382             raise EnvironmentError(msg)
    383 
    384         except json.JSONDecodeError:

OSError: Can't load config for 'ProsusAI/finbert'. Make sure that:

- 'ProsusAI/finbert' is a correct model identifier listed on 'https://huggingface.co/models'

- or 'ProsusAI/finbert' is the correct path to a directory containing a config.json file

My current versions:

  1. python 3.7
  2. transformers 3.4.0

I understand that my transformers version is old but that is the only version that is compatible with python 3.7. Also, the reason why I cant upgrade it to 3.9 is because I am using the below multimodal-transformers which only support up to 3.7.

Reasons:

  1. https://multimodal-toolkit.readthedocs.io/en/latest/ <- this only support up to 3.7
  2. Transformers only up to 3.4.0 supported by python 3.7.
  3. I need to use multimodal-transformers because it is easy to do text classification with tabular data. My dataset has text and category columns so I wish to use both, so this is the easiest practice I found. (If you have any suggestion, please do share with me thank you. )

My question is, is there a way to use the latest pre-trained model despite having the old tranformers?

0 Answers
Related