# Can't access private model in private space?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-access-private-model-in-private-space%2F48669%3E%5C
**Category:** Spaces\
**Created:** [July 30, 2023, 2:37am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-access-private-model-in-private-space%2F48669 "2023-07-30T02:37:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Remmet](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@Remmet](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FRemmet)%5C
**Post date:** [July 30, 2023, 2:37am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-access-private-model-in-private-space%2F48669%2F1 "2023-07-30T02:37:50Z")

</div>

I’m trying to test a private model of mine in a private space I’ve set up for /learning/testing. I have an authorization token set up as a secret and am fetching with os.environ.get() (I know the token works because i can use it in Colab and i know this bit of code fetches the token correctly because i tested it by displaying in a text box temporarily.)

But i just can’t figure out a way of loading my model without getting the “is not a local folder and is not a valid model identifier listed on ‘[Models - Hugging Face](https://huggingface.co/models)’  
If this is a private repository, make sure to pass a token having permission to this repo with `use_auth_token` or log in with `huggingface-cli login` and pass `use_auth_token=True`” error. I assume this is something that should work, but i can’t figure out a way of doing it. Can anyone share tips on how to do this?

(I’m not sure if it matters but im using a gradio type space).

---

<div class="post-metadata">

**Author:** ![Remmet](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@Remmet](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FRemmet)%5C
**Post date:** [August 4, 2023, 7:19am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-access-private-model-in-private-space%2F48669%2F2 "2023-08-04T07:19:59Z")

</div>

Figured it out, in case anyone else was wondering.

If you set the secret’s name to HUGGING\_FACE\_HUB\_TOKEN, you can just open private/gated models. I didn’t even need to pass set\_auth\_token or anything.
