# Token not working for llama2

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftoken-not-working-for-llama2%2F69414%3E%5C
**Category:** 🤗Hub\
**Created:** [January 16, 2024, 7:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftoken-not-working-for-llama2%2F69414 "2024-01-16T19:37:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmiller3](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@rmiller3](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Frmiller3)%5C
**Post date:** [January 16, 2024, 7:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftoken-not-working-for-llama2%2F69414%2F1 "2024-01-16T19:37:37Z")

</div>

I got approved to test llama2 and generated an access token. Technically the email approval was for “meta-llama/llama-2-13b-chat”, however I really want “meta-llama/llama-2-7b-hf”. Both model cards say “Gated Model: You have been granted access to this model” though.

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/6/4/642ffd96e094818643aec188ae14933b7717439d.png)

When I try to download the llama-2-7b-hf model, I get a 401 access denied. When I try to download llama-2-13b-chat I get an error that config.json is missing…but otherwise seems to work.

To me this means, my token was only approved for the single llama2 model and not the others.  
How do I get access to llama-2-7b-hf? There’s no button to request access as the website thinks I’m already approved?

I’m adding the token to the model aquisition line as follows:

````auto
model = transformers.AutoModelForCausalLM.from_pretrained("meta-llama/llama-2-7b-hf", torch_dtype="auto", trust_remote_code=True, token="hf_xxx")```

````

I’ve also tried putting these lines above the model acquision line and pasting the token at the prompt:

```auto
from huggingface_hub import login
        login()

```

However, I still get an error.

---

<div class="post-metadata">

**Author:** ![jiajun060405](https://avatars.discourse-cdn.com/v4/letter/j/dfb087/32.png) [@jiajun060405](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjiajun060405)%5C
**Post date:** [January 25, 2024, 9:15am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftoken-not-working-for-llama2%2F69414%2F2 "2024-01-25T09:15:55Z")

</div>

The same problem happened to me

---

<div class="post-metadata">

**Author:** ![paperwhite786](https://avatars.discourse-cdn.com/v4/letter/p/c4cdca/32.png) [@paperwhite786](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpaperwhite786)%5C
**Post date:** [February 7, 2024, 11:04pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftoken-not-working-for-llama2%2F69414%2F3 "2024-02-07T23:04:43Z")

</div>

Did anyone find a solution to this?

---

<div class="post-metadata">

**Author:** ![rmiller3](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@rmiller3](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Frmiller3)%5C
**Post date:** [March 4, 2024, 7:10pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftoken-not-working-for-llama2%2F69414%2F4 "2024-03-04T19:10:39Z")

</div>

I figured this out – it was case sensitive. meta-llama/Llama-2-7b-hf.

I reported to huggingface support and maybe they can add a check for case sensitivity before returning 401s.
