404 Client Error: Not Found for url: https://huggingface.co/%5CHuggingface-Sentiment-Pipeline/resolve/main/config.json
Author: nithinreddyy
Pull request: no

I'm trying to use the hugging face sentimet-analysis pipeline. I've downloaded the pipeline using save.pretrained(model). And trying to load the pipeline with the help of below code

```
from transformers import pipeline
model = '\Huggingface-Sentiment-Pipeline'
classifier = pipeline(task='sentiment-analysis', model=model, tokenizer=model, from_pt=True)
```

The Huggingface-Sentiment-Pipeline contains 6 files. I'm mentioning below

```
-> Huggingface-Sentiment-Pipeline
     -> config.json
     -> modelcard.json
     -> pytorch_model.bin
     -> special_tokens_map.json
     -> tokenizer_config.json
     -> vocab.txt
```
The error I'm getting is given below 

```
404 Client Error: Not Found for url: https://huggingface.co/%5CHuggingface-Sentiment-Pipeline/resolve/main/config.json
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
~\sentiment_pipeline\lib\site-packages\transformers\configuration_utils.py in get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
    423                 local_files_only=local_files_only,
--> 424                 use_auth_token=use_auth_token,
    425             )

~\sentiment_pipeline\lib\site-packages\transformers\file_utils.py in cached_path(url_or_filename, cache_dir, force_download, proxies, resume_download, user_agent, extract_compressed_file, force_extract, use_auth_token, local_files_only)
   1085             use_auth_token=use_auth_token,
-> 1086             local_files_only=local_files_only,
   1087         )

~\sentiment_pipeline\lib\site-packages\transformers\file_utils.py in get_from_cache(url, cache_dir, force_download, proxies, etag_timeout, resume_download, user_agent, use_auth_token, local_files_only)
   1215             r = requests.head(url, headers=headers, allow_redirects=False, proxies=proxies, timeout=etag_timeout)
-> 1216             r.raise_for_status()
   1217             etag = r.headers.get("X-Linked-Etag") or r.headers.get("ETag")

~\sentiment_pipeline\lib\site-packages\requests\models.py in raise_for_status(self)
    942         if http_error_msg:
--> 943             raise HTTPError(http_error_msg, response=self)
    944 

HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/%5CHuggingface-Sentiment-Pipeline/resolve/main/config.json

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
<ipython-input-7-5074b39a82b6> in <module>
----> 1 classifier = pipeline(task='sentiment-analysis', model=model, tokenizer=model, from_pt=True)

~\sentiment_pipeline\lib\site-packages\transformers\pipelines\__init__.py in pipeline(task, model, config, tokenizer, framework, revision, use_fast, **kwargs)
    338         model = get_default_model(targeted_task, framework, task_options)
    339 
--> 340     framework = framework or get_framework(model)
    341 
    342     task_class, model_class = targeted_task["impl"], targeted_task[framework]

~\sentiment_pipeline\lib\site-packages\transformers\pipelines\base.py in get_framework(model, revision)
     64     if isinstance(model, str):
     65         if is_torch_available() and not is_tf_available():
---> 66             model = AutoModel.from_pretrained(model, revision=revision)
     67         elif is_tf_available() and not is_torch_available():
     68             model = TFAutoModel.from_pretrained(model, revision=revision)

~\sentiment_pipeline\lib\site-packages\transformers\models\auto\modeling_auto.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
    768         if not isinstance(config, PretrainedConfig):
    769             config, kwargs = AutoConfig.from_pretrained(
--> 770                 pretrained_model_name_or_path, return_unused_kwargs=True, **kwargs
    771             )
    772 

~\sentiment_pipeline\lib\site-packages\transformers\models\auto\configuration_auto.py in from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
    366             {'foo': False}
    367         """
--> 368         config_dict, _ = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
    369 
    370         if "model_type" in config_dict:

~\sentiment_pipeline\lib\site-packages\transformers\configuration_utils.py in get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
    434                 f"- or '{pretrained_model_name_or_path}' is the correct path to a directory containing a {CONFIG_NAME} file\n\n"
    435             )
--> 436             raise EnvironmentError(msg)
    437 
    438         except json.JSONDecodeError:

OSError: Can't load config for '\Huggingface-Sentiment-Pipeline'. Make sure that:

- '\Huggingface-Sentiment-Pipeline' is a correct model identifier listed on 'https://huggingface.co/models'

- or '\Huggingface-Sentiment-Pipeline' is the correct path to a directory containing a config.json file
```



Comments:
Are you able to successfully load your model with e.g. `AutoModel.from_pretrained(local_path)`?

> Are you able to successfully load your model with e.g. `AutoModel.from_pretrained(local_path)`?

No, same error.

Hi @nithinreddyy, could you share information about your setup so that we may investigate? Thanks.
What happens if you remove the backward slash in your path? Is it a local path or is `Huggingface-Sentiment-Pipeline` in the root directory?

The code is working. The actual code is 

```
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
import transformers

model = AutoModelForSequenceClassification.from_pretrained('directory')
token = AutoTokenizer.from_pretrained('directory')

classifier = pipeline(task='sentiment-analysis', model=model, tokenizer=token)

classifier("my name is nithin") #Run this code and it returns the output
```

To save the 'sentiment-analysis' pipeline, try the below code

```
from transformers import pipeline

classifier = pipeline('sentiment-analysis')
classifier.save_pretrained('directory')
```

That's it. Thank you.


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/master/CONTRIBUTING.md) are likely to be ignored.