# Private model usage problem

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fprivate-model-usage-problem%2F20613%3E%5C
**Category:** 🤗Hub\
**Created:** [July 20, 2022, 9:12am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fprivate-model-usage-problem%2F20613 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmicktsai)%5C
**Post date:** [July 20, 2022, 9:12am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fprivate-model-usage-problem%2F20613%2F1 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FSancak)%5C
**Post date:** [October 1, 2022, 2:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fprivate-model-usage-problem%2F20613%2F2 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpierric)%5C
**Post date:** [October 4, 2022, 11:48pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fprivate-model-usage-problem%2F20613%2F3 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FRictus)%5C
**Post date:** [October 31, 2022, 4:52pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fprivate-model-usage-problem%2F20613%2F4 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fkouohhashi)%5C
**Post date:** [November 30, 2022, 2:03pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fprivate-model-usage-problem%2F20613%2F5 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fkouohhashi)%5C
**Post date:** [November 30, 2022, 11:51pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fprivate-model-usage-problem%2F20613%2F6 "2022-11-30T23:51:51Z")

</div>

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