Text Generation
Transformers
PyTorch
Safetensors
English
llama
facebook
meta
llama-2
text-generation-inference
Instructions to use NousResearch/Llama-2-7b-hf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NousResearch/Llama-2-7b-hf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NousResearch/Llama-2-7b-hf")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("NousResearch/Llama-2-7b-hf") model = AutoModelForMultimodalLM.from_pretrained("NousResearch/Llama-2-7b-hf") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use NousResearch/Llama-2-7b-hf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NousResearch/Llama-2-7b-hf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NousResearch/Llama-2-7b-hf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/NousResearch/Llama-2-7b-hf
- SGLang
How to use NousResearch/Llama-2-7b-hf with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "NousResearch/Llama-2-7b-hf" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NousResearch/Llama-2-7b-hf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "NousResearch/Llama-2-7b-hf" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NousResearch/Llama-2-7b-hf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use NousResearch/Llama-2-7b-hf with Docker Model Runner:
docker model run hf.co/NousResearch/Llama-2-7b-hf
Extract evaluation results from README
#13
by davidsmts - opened
README.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
| 1 |
---
|
| 2 |
extra_gated_heading: Access Llama 2 on Hugging Face
|
| 3 |
-
extra_gated_description:
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
will be processed in 1-2 days.
|
| 8 |
extra_gated_button_content: Submit
|
| 9 |
extra_gated_fields:
|
| 10 |
-
I agree to share my name, email address and username with Meta and confirm that
|
|
|
|
|
|
|
| 11 |
language:
|
| 12 |
- en
|
| 13 |
pipeline_tag: text-generation
|
|
@@ -18,6 +19,42 @@ tags:
|
|
| 18 |
- pytorch
|
| 19 |
- llama
|
| 20 |
- llama-2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
---
|
| 22 |
# **Llama 2**
|
| 23 |
Llama 2 is a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters. This is the repository for the 7B pretrained model, converted for the Hugging Face Transformers format. Links to other models can be found in the index at the bottom.
|
|
|
|
| 1 |
---
|
| 2 |
extra_gated_heading: Access Llama 2 on Hugging Face
|
| 3 |
+
extra_gated_description: This is a form to enable access to Llama 2 on Hugging Face
|
| 4 |
+
after you have been granted access from Meta. Please visit the [Meta website](https://ai.meta.com/resources/models-and-libraries/llama-downloads)
|
| 5 |
+
and accept our license terms and acceptable use policy before submitting this form.
|
| 6 |
+
Requests will be processed in 1-2 days.
|
|
|
|
| 7 |
extra_gated_button_content: Submit
|
| 8 |
extra_gated_fields:
|
| 9 |
+
? I agree to share my name, email address and username with Meta and confirm that
|
| 10 |
+
I have already been granted download access on the Meta website
|
| 11 |
+
: checkbox
|
| 12 |
language:
|
| 13 |
- en
|
| 14 |
pipeline_tag: text-generation
|
|
|
|
| 19 |
- pytorch
|
| 20 |
- llama
|
| 21 |
- llama-2
|
| 22 |
+
model-index:
|
| 23 |
+
- name: Llama-2-7b-hf
|
| 24 |
+
results:
|
| 25 |
+
- task:
|
| 26 |
+
type: text-generation
|
| 27 |
+
dataset:
|
| 28 |
+
name: Benchmarks
|
| 29 |
+
type: benchmark
|
| 30 |
+
metrics:
|
| 31 |
+
- name: Code
|
| 32 |
+
type: code
|
| 33 |
+
value: 16.8
|
| 34 |
+
- name: Commonsense Reasoning
|
| 35 |
+
type: commonsense_reasoning
|
| 36 |
+
value: 63.9
|
| 37 |
+
- name: World Knowledge
|
| 38 |
+
type: world_knowledge
|
| 39 |
+
value: 48.9
|
| 40 |
+
- name: Reading Comprehension
|
| 41 |
+
type: reading_comprehension
|
| 42 |
+
value: 61.3
|
| 43 |
+
- name: Math
|
| 44 |
+
type: math
|
| 45 |
+
value: 14.6
|
| 46 |
+
- name: MMLU
|
| 47 |
+
type: mmlu
|
| 48 |
+
value: 45.3
|
| 49 |
+
- name: BBH
|
| 50 |
+
type: bbh
|
| 51 |
+
value: 32.6
|
| 52 |
+
- name: AGI Eval
|
| 53 |
+
type: agi_eval
|
| 54 |
+
value: 29.3
|
| 55 |
+
source:
|
| 56 |
+
name: Model README
|
| 57 |
+
url: https://huggingface.co/NousResearch/Llama-2-7b-hf
|
| 58 |
---
|
| 59 |
# **Llama 2**
|
| 60 |
Llama 2 is a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters. This is the repository for the 7B pretrained model, converted for the Hugging Face Transformers format. Links to other models can be found in the index at the bottom.
|