Text Generation
Transformers
Safetensors
llama
facebook
meta
llama-3
fp8
vllm
chat
neuralmagic
llmcompressor
conversational
8-bit precision
compressed-tensors
text-generation-inference
Instructions to use RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic") model = AutoModelForCausalLM.from_pretrained("RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic
- SGLang
How to use RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic 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 "RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic with Docker Model Runner:
docker model run hf.co/RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic
Update README.md
Browse files
README.md
CHANGED
|
@@ -25,7 +25,7 @@ language:
|
|
| 25 |
- **Model Developers:** Neural Magic
|
| 26 |
|
| 27 |
Quantized version of [Meta-Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct).
|
| 28 |
-
It achieves an average score of
|
| 29 |
|
| 30 |
### Model Optimizations
|
| 31 |
|
|
@@ -130,7 +130,7 @@ oneshot(
|
|
| 130 |
## Evaluation
|
| 131 |
|
| 132 |
The model was evaluated on the [OpenLLM](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) leaderboard tasks (version 1) with the [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) and the [vLLM](https://docs.vllm.ai/en/stable/) engine, using the following command.
|
| 133 |
-
A modified version of ARC-C was used for evaluations, in line with Llama 3.1's prompting.
|
| 134 |
```
|
| 135 |
lm_eval \
|
| 136 |
--model vllm \
|
|
@@ -174,13 +174,13 @@ lm_eval \
|
|
| 174 |
</td>
|
| 175 |
</tr>
|
| 176 |
<tr>
|
| 177 |
-
<td>GSM-8K (
|
| 178 |
</td>
|
| 179 |
-
<td>
|
| 180 |
</td>
|
| 181 |
-
<td>
|
| 182 |
</td>
|
| 183 |
-
<td>
|
| 184 |
</td>
|
| 185 |
</tr>
|
| 186 |
<tr>
|
|
@@ -216,11 +216,11 @@ lm_eval \
|
|
| 216 |
<tr>
|
| 217 |
<td><strong>Average</strong>
|
| 218 |
</td>
|
| 219 |
-
<td><strong>
|
| 220 |
</td>
|
| 221 |
-
<td><strong>
|
| 222 |
</td>
|
| 223 |
-
<td><strong>99.
|
| 224 |
</td>
|
| 225 |
</tr>
|
| 226 |
</table>
|
|
|
|
| 25 |
- **Model Developers:** Neural Magic
|
| 26 |
|
| 27 |
Quantized version of [Meta-Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct).
|
| 28 |
+
It achieves an average score of 73.81 on the [OpenLLM](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) benchmark (version 1), whereas the unquantized model achieves 74.17.
|
| 29 |
|
| 30 |
### Model Optimizations
|
| 31 |
|
|
|
|
| 130 |
## Evaluation
|
| 131 |
|
| 132 |
The model was evaluated on the [OpenLLM](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) leaderboard tasks (version 1) with the [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) and the [vLLM](https://docs.vllm.ai/en/stable/) engine, using the following command.
|
| 133 |
+
A modified version of ARC-C and GSM8k-cot was used for evaluations, in line with Llama 3.1's prompting. It can be accessed on the [Neural Magic fork of the lm-evaluation-harness](https://github.com/neuralmagic/lm-evaluation-harness/tree/llama_3.1_instruct).
|
| 134 |
```
|
| 135 |
lm_eval \
|
| 136 |
--model vllm \
|
|
|
|
| 174 |
</td>
|
| 175 |
</tr>
|
| 176 |
<tr>
|
| 177 |
+
<td>GSM-8K-cot (8-shot, strict-match)
|
| 178 |
</td>
|
| 179 |
+
<td>82.03
|
| 180 |
</td>
|
| 181 |
+
<td>82.34
|
| 182 |
</td>
|
| 183 |
+
<td>100.3%
|
| 184 |
</td>
|
| 185 |
</tr>
|
| 186 |
<tr>
|
|
|
|
| 216 |
<tr>
|
| 217 |
<td><strong>Average</strong>
|
| 218 |
</td>
|
| 219 |
+
<td><strong>74.17</strong>
|
| 220 |
</td>
|
| 221 |
+
<td><strong>73.81</strong>
|
| 222 |
</td>
|
| 223 |
+
<td><strong>99.48%</strong>
|
| 224 |
</td>
|
| 225 |
</tr>
|
| 226 |
</table>
|