Not able to use nli-distilroberta-base for zero-shot-classification - getting OS error

#1
by ananddadhich153 - opened

from transformers import pipeline

classifier = pipeline("zero-shot-classification", model='cross-encoder/nli-distilroberta-base')

sent = "Apple just announced the newest iPhone X"
candidate_labels = ["technology", "sports", "politics"]
res = classifier(sent, candidate_labels)
print(res)

---------------------------------------Output-----------------------------------

OSError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/transformers/configuration_utils.py in get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
355 if resolved_config_file is None:
--> 356 raise EnvironmentError
357 config_dict = cls._dict_from_json_file(resolved_config_file)

OSError:

During handling of the above exception, another exception occurred:

OSError Traceback (most recent call last)
4 frames
/usr/local/lib/python3.7/dist-packages/transformers/configuration_utils.py in get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
363 f"- or '{pretrained_model_name_or_path}' is the correct path to a directory containing a {CONFIG_NAME} file\n\n"
364 )
--> 365 raise EnvironmentError(msg)
366
367 except json.JSONDecodeError:

OSError: Can't load config for 'cross-encoder/nli-distilroberta-base'. Make sure that:

  • 'cross-encoder/nli-distilroberta-base' is a correct model identifier listed on 'https://huggingface.co/models'

  • or 'cross-encoder/nli-distilroberta-base' is the correct path to a directory containing a config.json file

Getting OSError, Can anyone please check & help me to resolve

Sign up or log in to comment