Private model usage problem 
Author: micktsai
Pull request: no

I upload a private model for myself, and when I want to use it by “AutoModel.from_pretrained” there appears a error as I show bleow.
I have used huggingface-cli login with the access token with read grant and use “trust_remote_code=True” as it recommands but it still has error 401.
How can I use my private model?

Explicitly passing a revision is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a revision is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Could not locate the model.py inside micktsai/resnet50_try.
Traceback (most recent call last):
File “test.py”, line 9, in
model = AutoModel.from_pretrained(“micktsai/resnet50_try”, trust_remote_code=True,use_auth_token=True)
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\models\auto\auto_factory.py”, line 441, in from_pretrained
pretrained_model_name_or_path, module_file + “.py”, class_name, **kwargs
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\dynamic_module_utils.py”, line 382, in get_class_from_dynamic_module
local_files_only=local_files_only,
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\dynamic_module_utils.py”, line 239, in get_cached_module_file
use_auth_token=use_auth_token,
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\utils\hub.py”, line 292, in cached_path
local_files_only=local_files_only,
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\utils\hub.py”, line 495, in get_from_cache
_raise_for_status(r)
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\utils\hub.py”, line 418, in _raise_for_status
f"401 Client Error: Repository not found for url: {response.url}. "
transformers.utils.hub.RepositoryNotFoundError: 401 Client Error: Repository not found for url: [https://huggingface.co/micktsai/resnet50_try/resolve/main/model.py 1](https://huggingface.co/micktsai/resnet50_try/resolve/main/model.py). If the repo is private, make sure you are authenticated.

C:\Users\User\Downloads>py test.py
Explicitly passing a revision is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a revision is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Could not locate the model.py inside micktsai/resnet50_try.
Traceback (most recent call last):
File “test.py”, line 10, in
“micktsai/resnet50_try”, use_auth_token=True, trust_remote_code=True)
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\models\auto\auto_factory.py”, line 441, in from_pretrained
pretrained_model_name_or_path, module_file + “.py”, class_name, **kwargs
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\dynamic_module_utils.py”, line 382, in get_class_from_dynamic_module
local_files_only=local_files_only,
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\dynamic_module_utils.py”, line 239, in get_cached_module_file
use_auth_token=use_auth_token,
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\utils\hub.py”, line 292, in cached_path
local_files_only=local_files_only,
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\utils\hub.py”, line 495, in get_from_cache
_raise_for_status(r)
File “C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\transformers\utils\hub.py”, line 418, in _raise_for_status
f"401 Client Error: Repository not found for url: {response.url}. "
transformers.utils.hub.RepositoryNotFoundError: 401 Client Error: Repository not found for url: [https://huggingface.co/micktsai/resnet50_try/resolve/main/model.py 1](https://huggingface.co/micktsai/resnet50_try/resolve/main/model.py). If the repo is private, make sure you are authenticated.

Comments:
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.

Same problem, something wrong with private models with unsupported architecture. It doesn't see modeling file.