# Hugging Face Llama-2 (7b) taking too much time while inferencing

**URL:** <https://discuss.huggingface.co/t/hugging-face-llama-2-7b-taking-too-much-time-while-inferencing/62050>\
**Category:** Models\
**Created:** [November 13, 2023, 10:14am UTC](https://discuss.huggingface.co/t/hugging-face-llama-2-7b-taking-too-much-time-while-inferencing/62050 "2023-11-13T10:14:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![atinesh](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@atinesh](https://discuss.huggingface.co/u/atinesh)\
**Post date:** [November 13, 2023, 10:14am UTC](https://discuss.huggingface.co/t/hugging-face-llama-2-7b-taking-too-much-time-while-inferencing/62050/1 "2023-11-13T10:14:27Z")

</div>

Hello everyone, I am trying to use Llama-2 (7b) from Hugging face. With below code I was able to load the model successfully but when I am trying to generate the output its taking forever.

**Code**

```auto
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("Llama-2-7b-hf")
model = AutoModelForCausalLM.from_pretrained("Llama-2-7b-hf")

input_ids = tokenizer.encode("What is LLM?", return_tensors="pt")

output = model.generate(
        input_ids,
        temperature=0,
        max_new_tokens=100
    )

generated_text = tokenizer.decode(output[0])
print(generated_text)

```

Model files downloaded from [Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf)

Hardware: Macbook Pro (M2 Pro) 16 GB RAM

---

<div class="post-metadata">

**Author:** ![ahoo1260](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ahoo1260/32/28443_2.png) [@ahoo1260](https://discuss.huggingface.co/u/ahoo1260)\
**Post date:** [June 23, 2024, 10:25am UTC](https://discuss.huggingface.co/t/hugging-face-llama-2-7b-taking-too-much-time-while-inferencing/62050/2 "2024-06-23T10:25:43Z")

</div>

Hi, did you find a solution?
