does not appear to have a file named config.json 
Author: riyaj8888
Pull request: no

initially i was able to load this model , now suddenly its giving below error, in the same notebook

codellama/CodeLlama-7b-Instruct-hf does not appear to have a file named config.json 

Comments:
Can't reproduce. On colab, the following works

```
from transformers import AutoModel
AutoModel.from_pretrained("codellama/CodeLlama-7b-Instruct-hf")
```

Please follow the template to provide the necessary information when opening an issue, like system info and a code snippet.

first i did this

!pip install git+https://github.com/huggingface/transformers.git@main accelerate


from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch

model_id = "codellama/CodeLlama-7b-Instruct-hf"
quantization_config = BitsAndBytesConfig(
   load_in_4bit=True,
   bnb_4bit_compute_dtype=torch.float16
)

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    quantization_config=quantization_config,
    device_map="cuda:0",cache_dir="codellama/CodeLlama-7b-Instruct-hf",
)

ur suggestions also failed.

OSError                                   Traceback (most recent call last)
Cell In[3], line 2
      1 from transformers import AutoModel
----> 2 AutoModel.from_pretrained("codellama/CodeLlama-7b-Instruct-hf")

File ~/.local/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:526, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
    523 if kwargs.get("quantization_config", None) is not None:
    524     _ = kwargs.pop("quantization_config")
--> 526 config, kwargs = AutoConfig.from_pretrained(
    527     pretrained_model_name_or_path,
    528     return_unused_kwargs=True,
    529     trust_remote_code=trust_remote_code,
    530     code_revision=code_revision,
    531     _commit_hash=commit_hash,
    532     **hub_kwargs,
    533     **kwargs,
    534 )
    536 # if torch_dtype=auto was passed here, ensure to pass it on
    537 if kwargs_orig.get("torch_dtype", None) == "auto":

File ~/.local/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py:1082, in AutoConfig.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
   1079 trust_remote_code = kwargs.pop("trust_remote_code", None)
   1080 code_revision = kwargs.pop("code_revision", None)
-> 1082 config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
   1083 has_remote_code = "auto_map" in config_dict and "AutoConfig" in config_dict["auto_map"]
   1084 has_local_code = "model_type" in config_dict and config_dict["model_type"] in CONFIG_MAPPING

File ~/.local/lib/python3.10/site-packages/transformers/configuration_utils.py:644, in PretrainedConfig.get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
    642 original_kwargs = copy.deepcopy(kwargs)
    643 # Get config dict associated with the base config file
--> 644 config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
    645 if "_commit_hash" in config_dict:
    646     original_kwargs["_commit_hash"] = config_dict["_commit_hash"]

File ~/.local/lib/python3.10/site-packages/transformers/configuration_utils.py:699, in PretrainedConfig._get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
    695 configuration_file = kwargs.pop("_configuration_file", CONFIG_NAME)
    697 try:
    698     # Load from local folder or from cache or download from model Hub and cache
--> 699     resolved_config_file = cached_file(
    700         pretrained_model_name_or_path,
    701         configuration_file,
    702         cache_dir=cache_dir,
    703         force_download=force_download,
    704         proxies=proxies,
    705         resume_download=resume_download,
    706         local_files_only=local_files_only,
    707         token=token,
    708         user_agent=user_agent,
    709         revision=revision,
    710         subfolder=subfolder,
    711         _commit_hash=commit_hash,
    712     )
    713     commit_hash = extract_commit_hash(resolved_config_file, commit_hash)
    714 except EnvironmentError:
    715     # Raise any environment error raise by `cached_file`. It will have a helpful error message adapted to
    716     # the original exception.

File ~/.local/lib/python3.10/site-packages/transformers/utils/hub.py:360, in cached_file(path_or_repo_id, filename, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, subfolder, repo_type, user_agent, _raise_exceptions_for_missing_entries, _raise_exceptions_for_connection_errors, _commit_hash, **deprecated_kwargs)
    358 if not os.path.isfile(resolved_file):
    359     if _raise_exceptions_for_missing_entries:
--> 360         raise EnvironmentError(
    361             f"{path_or_repo_id} does not appear to have a file named {full_filename}. Checkout "
    362             f"'[https://huggingface.co/{path_or_repo_id}/{](https://huggingface.co/%7Bpath_or_repo_id%7D/%7Brevision)[revision](https://huggingface.co/%7Bpath_or_repo_id%7D/%7Brevision)}' for available files."
    363         )
    364     else:
    365         return None

OSError: codellama/CodeLlama-7b-Instruct-hf does not appear to have a file named config.json. Checkout 'https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf/None' for available files.

You mentioned you work on a colab notebook. Could you share it? As it works on my notebook, except the memory issue at the end (not enough RAM), but the config is loaded without issue.

i have enough RAM approximately 80GB

> You mentioned you work on a colab notebook. Could you share it? As it works on my notebook, except the memory issue at the end (not enough RAM), but the config is loaded without issue.

NOT COLAB NOTEBOOK , its jupyter notebook. in the morning same notebook worked without any issue.

unable to run this line also

tokenizer = AutoTokenizer.from_pretrained(model_id)

So you are running on your machine not on colab? Then it's likely some connection issue. I am afraid.

you can check here

https://colab.research.google.com/drive/15Q1_311ZhLRwqEDP3Ib4Vnd0PSeX9Qg9?usp=sharing

Maybe try (my 2 line code) with another model id (say bert, gpt2) in your local env, and see if the same issue also occurs. 

other model able to download , but not this codellama

Could you can try

```
from transformers import AutoConfig
AutoConfig.from_pretrained("codellama/CodeLlama-7b-Instruct-hf")
```
? If this gives error, please also share the full error.



Also , check if you have a local directory named

```
./codellama/CodeLlama-7b-Instruct-hf
```
If it exists, `from_pretrained` will look at that path instead of the Hub.

> from transformers import AutoConfig
> AutoConfig.from_pretrained("codellama/CodeLlama-7b-Instruct-hf")

OSError                                   Traceback (most recent call last)
Cell In[4], line 2
      1 from transformers import AutoConfig
----> 2 AutoConfig.from_pretrained("codellama/CodeLlama-7b-Instruct-hf")

File ~/.local/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py:1082, in AutoConfig.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
   1079 trust_remote_code = kwargs.pop("trust_remote_code", None)
   1080 code_revision = kwargs.pop("code_revision", None)
-> 1082 config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
   1083 has_remote_code = "auto_map" in config_dict and "AutoConfig" in config_dict["auto_map"]
   1084 has_local_code = "model_type" in config_dict and config_dict["model_type"] in CONFIG_MAPPING

File ~/.local/lib/python3.10/site-packages/transformers/configuration_utils.py:644, in PretrainedConfig.get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
    642 original_kwargs = copy.deepcopy(kwargs)
    643 # Get config dict associated with the base config file
--> 644 config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
    645 if "_commit_hash" in config_dict:
    646     original_kwargs["_commit_hash"] = config_dict["_commit_hash"]

File ~/.local/lib/python3.10/site-packages/transformers/configuration_utils.py:699, in PretrainedConfig._get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
    695 configuration_file = kwargs.pop("_configuration_file", CONFIG_NAME)
    697 try:
    698     # Load from local folder or from cache or download from model Hub and cache
--> 699     resolved_config_file = cached_file(
    700         pretrained_model_name_or_path,
    701         configuration_file,
    702         cache_dir=cache_dir,
    703         force_download=force_download,
    704         proxies=proxies,
    705         resume_download=resume_download,
    706         local_files_only=local_files_only,
    707         token=token,
    708         user_agent=user_agent,
    709         revision=revision,
    710         subfolder=subfolder,
    711         _commit_hash=commit_hash,
    712     )
    713     commit_hash = extract_commit_hash(resolved_config_file, commit_hash)
    714 except EnvironmentError:
    715     # Raise any environment error raise by `cached_file`. It will have a helpful error message adapted to
    716     # the original exception.

File ~/.local/lib/python3.10/site-packages/transformers/utils/hub.py:360, in cached_file(path_or_repo_id, filename, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, subfolder, repo_type, user_agent, _raise_exceptions_for_missing_entries, _raise_exceptions_for_connection_errors, _commit_hash, **deprecated_kwargs)
    358 if not os.path.isfile(resolved_file):
    359     if _raise_exceptions_for_missing_entries:
--> 360         raise EnvironmentError(
    361             f"{path_or_repo_id} does not appear to have a file named {full_filename}. Checkout "
    362             f"'[https://huggingface.co/{path_or_repo_id}/{](https://huggingface.co/%7Bpath_or_repo_id%7D/%7Brevision)[revision](https://huggingface.co/%7Bpath_or_repo_id%7D/%7Brevision)}' for available files."
    363         )
    364     else:
    365         return None

OSError: codellama/CodeLlama-7b-Instruct-hf does not appear to have a file named config.json. Checkout 'https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf/None' for available files.

```python
from transformers import Owlv2ForObjectDetection, Owlv2Processor


processor = Owlv2Processor.from_pretrained("google/owlv2-base-patch16-ensemble")

```

OSError: google/owlv2-base-patch16-ensemble does not appear to have a file named preprocessor_config.json. Checkout 'https://huggingface.co/google/owlv2-base-patch16-ensemble/main' for available files.

Please check this comment https://github.com/huggingface/transformers/issues/27954#issuecomment-1850480411

> Please check this comment [#27954 (comment)](https://github.com/huggingface/transformers/issues/27954#issuecomment-1850480411)

yes, a download scripts make such a directory

if you have a directory having the name the same as the repo id, and if it doesn't contain the necessary files, it will fail, as `from_pretrained` is looking for files inside that local directory instead of the remote model repository.


Delete models in hub cache by using this command `huggingface-cli delete-cache`, then delete models from local directory could resolve this issue. Reasonably, somehow the model is saved locally could cause this issue. For example. I download the model by using this `...from_pretrained().save_pretrained("./local")` then I received exact error message.

Yes, if a local directory having the same name , then it will be checked - and would fail if that directory doesn't have all the necessary files

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