Download ESG-BERT permanently
#4
by
BMU
- opened
I currently use ESG-BERT in the following way:
from transformers import pipeline
pl = pipeline("text-classification", model="nbroad/ESG-BERT", return_all_scores=True)
pl("This is the input text.")
As explained in https://huggingface.co./transformers/v4.10.1/quicktour.html: "When typing this command for the first time, a pretrained model and its tokenizer are downloaded and cached".
Now, I would like to download the model once and forever, so that I don't need to do it every time I use the model.
How can I do this?
Could I still access it using pipeline? How?
BMU
changed discussion status to
closed
BMU
changed discussion status to
open
Answer:
- Download files in https://huggingface.co./nbroad/ESG-BERT/tree/main into a directory into your local machine.
- You can still use pipeline. But "nbroad/ESG-BERT" should be substituted by the path to the directory where you saved the model files.
from transformers import pipeline
pl = pipeline("text-classification", model="path_to_directory_where_you_saved_the_model_files", return_all_scores=True)
pl("This is the input text.")
BMU
changed discussion status to
closed