Edit model card

Neuronx model for meta-llama/Llama-2-7b-chat-hf

This repository contains are AWS Inferentia2 and neuronx compatible checkpoint for meta-llama/Llama-2-7b-chat-hf. You can find detailed information about the base model on its Model Card.

Usage on Amazon SageMaker

coming soon

Usage with optimum-neuron


from optimum.neuron import pipeline

# Load pipeline from Hugging Face repository
pipe = pipeline("text-generation", "aws-neuron/Llama-2-7b-chat-hf-seqlen-2048-bs-4")

# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
messages = [
    {"role": "user", "content": "What is 2+2?"},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# Run generation
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(outputs[0]["generated_text"])

Compilation Arguments

compilation arguments

{
  "num_cores": 2,
  "auto_cast_type": "fp16"
}

input_shapes

{
  "sequence_length": 2048,
  "batch_size": 4
}
Downloads last month
5
Inference Examples
Inference API (serverless) has been turned off for this model.