# Private model usage problem

**URL:** <https://discuss.huggingface.co/t/private-model-usage-problem/20613>\
**Category:** 🤗Hub\
**Created:** [July 20, 2022, 9:12am UTC](https://discuss.huggingface.co/t/private-model-usage-problem/20613 "2022-07-20T09:12:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![micktsai](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@micktsai](https://discuss.huggingface.co/u/micktsai)\
**Post date:** [July 20, 2022, 9:12am UTC](https://discuss.huggingface.co/t/private-model-usage-problem/20613/1 "2022-07-20T09:12:03Z")

</div>

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](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](https://huggingface.co/micktsai/resnet50_try/resolve/main/model.py). If the repo is private, make sure you are authenticated.

---

<div class="post-metadata">

**Author:** ![Sancak](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sancak/32/11904_2.png) [@Sancak](https://discuss.huggingface.co/u/Sancak)\
**Post date:** [October 1, 2022, 2:53pm UTC](https://discuss.huggingface.co/t/private-model-usage-problem/20613/2 "2022-10-01T14:53:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pierric](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pierric/32/50750_2.png) [@pierric](https://discuss.huggingface.co/u/pierric)\
**Post date:** [October 4, 2022, 11:48pm UTC](https://discuss.huggingface.co/t/private-model-usage-problem/20613/3 "2022-10-04T23:48:51Z")

</div>

@Wauplin may have some insights on this?

---

<div class="post-metadata">

**Author:** ![Rictus](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@Rictus](https://discuss.huggingface.co/u/Rictus)\
**Post date:** [October 31, 2022, 4:52pm UTC](https://discuss.huggingface.co/t/private-model-usage-problem/20613/4 "2022-10-31T16:52:18Z")

</div>

You have to provide an authentication token. See [User access tokens](https://huggingface.co/docs/hub/security-tokens)

---

<div class="post-metadata">

**Author:** ![kouohhashi](https://avatars.discourse-cdn.com/v4/letter/k/45deac/32.png) [@kouohhashi](https://discuss.huggingface.co/u/kouohhashi)\
**Post date:** [November 30, 2022, 2:03pm UTC](https://discuss.huggingface.co/t/private-model-usage-problem/20613/5 "2022-11-30T14:03:00Z")

</div>

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.

```auto
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?

---

<div class="post-metadata">

**Author:** ![kouohhashi](https://avatars.discourse-cdn.com/v4/letter/k/45deac/32.png) [@kouohhashi](https://discuss.huggingface.co/u/kouohhashi)\
**Post date:** [November 30, 2022, 11:51pm UTC](https://discuss.huggingface.co/t/private-model-usage-problem/20613/6 "2022-11-30T23:51:51Z")

</div>

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