"No model was supplied..." message during import statement?
HiCan someone please explain to this newb why I get a “No model was supplied…” message during the Python import call? That is surprising to me since it should only be importing namespaces and not actually calling anything in those imported libs. I’m also a newb to Python although not to coding in generalThis code is running on Colab.Thank you!print("trace 0")
from transformers import pipeline, AutoModelForTokenClassification, AutoTokenizer
#from transformers import pipeline, AutoModel, AutoTokenizer

# Sentiment analysis pipeline
print("trace 1")
analyzer = pipeline("sentiment-analysis")
print("trace 2")

# Question answering pipeline, specifying the checkpoint identifier
print("trace 3")
oracle = pipeline(
    "question-answering", model="distilbert/distilbert-base-cased-distilled-squad", tokenizer="google-bert/bert-base-cased"
)
print("trace 4")

# Named entity recognition pipeline, passing in a specific model and tokenizer
print("trace 5")
model = AutoModelForTokenClassification.from_pretrained("dbmdz/bert-large-cased-finetuned-conll03-english")
#model = AutoModel.from_pretrained("dbmdz/bert-large-cased-finetuned-conll03-english")
print("trace 6")
tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
print("trace 7")
recognizer = pipeline("ner", model=model, tokenizer=tokenizer)
print("trace 8")Output:trace 0No model was supplied, defaulted to distilbert-base-uncased-finetuned-sst-2-english and revision af0f99b (distilbert/distilbert-base-uncased-finetuned-sst-2-english · Hugging Face).Using a pipeline without specifying a model name and revision in production is not recommended.trace 1/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:88: UserWarning:[snip]
2024-02-27T16:59:14Z
I’m starting to understand that certain global code in imported Python modules are executed during the import statement, that makes sense. But, I’m still wondering if I’m doing something sub optimal or does everyone get and ignore this warning all the time? Sorry for such a beginner question.
2025-01-03T13:04:53Z
I’m facing same. But trying to figure out how to pass model here. Looks like it is not defaulting to valid model as per shown in HF NLP course