Private model usage problem

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. 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. If the repo is private, make sure you are authenticated.

Hi, I have a similar problem. Have you solved it? If yes
how?

@Wauplin may have some insights on this?

You have to provide an authentication token. See User access tokens

I have similar issue.

i tried to accept terms as much as I can but Pipeline.from_pretrained(‘pyannote/speaker-diarization@2.1’, use_auth_token=“my token”) gave me the error like below.

huggingface_hub.utils._errors.RepositoryNotFoundError: 401 Client Error: Repository Not Found for url: https://huggingface.co/pyannote/segmentation/resolve/2022.07/pytorch_model.bin. If the repo is private, make sure you are authenticated.

I somehow can make it on Colab with notebook_login…

Could you give me hinst?

Sorry my bad.
I upgraded pyannote.audio and it worked!