Instructions to use RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic") model = AutoModelForCausalLM.from_pretrained("RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic") 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RedHatAI/Apertus-70B-Instruct-2509-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/Apertus-70B-Instruct-2509-FP8-dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic
- SGLang
How to use RedHatAI/Apertus-70B-Instruct-2509-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/Apertus-70B-Instruct-2509-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/Apertus-70B-Instruct-2509-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/Apertus-70B-Instruct-2509-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/Apertus-70B-Instruct-2509-FP8-dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic with Docker Model Runner:
docker model run hf.co/RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic
Apertus-70B-Instruct-2509-FP8-dynamic
Model Overview
- Model Architecture: ApertusForCausalLM
- Input: Text
- Output: Text
- Model Optimizations:
- Weight quantization: FP8
- Activation quantization: FP8
- Release Date: 9/18/2025
- Version: 1.0
- Model Developers: Red Hat
Quantized version of swiss-ai/Apertus-70B-2509.
Model Optimizations
This model was obtained by quantizing the weights and activations of swiss-ai/Apertus-70B-2509 to FP8 data type. This optimization reduces the number of bits per parameter from 16 to 8, reducing the disk size and GPU memory requirements by approximately 50%. Only the weights and activations of the linear operators within transformers blocks are quantized.
Deployment
Use with vLLM
- Initialize vLLM server:
vllm serve RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic --tensor_parallel_size 2
- Send requests to the server:
from openai import OpenAI
# Modify OpenAI's API key and API base to use vLLM's API server.
openai_api_key = "EMPTY"
openai_api_base = "http://<your-server-host>:8000/v1"
client = OpenAI(
api_key=openai_api_key,
base_url=openai_api_base,
)
model = "RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic"
messages = [
{"role": "user", "content": "Give me a short introduction to large language model."},
]
outputs = client.chat.completions.create(
model=model,
messages=messages,
)
generated_text = outputs.choices[0].message.content
print(generated_text)
Creation
This model was created with llm-compressor by running the code snippet below.
Model Creation Code
from llmcompressor.modifiers.quantization import QuantizationModifier
from llmcompressor.transformers import oneshot
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load model
model_stub = "swiss-ai/Apertus-70B-Instruct-2509"
model_name = model_stub.split("/")[-1]
model = AutoModelForCausalLM.from_pretrained(model_stub, dtype="auto")
tokenizer = AutoTokenizer.from_pretrained(model_stub)
# Configure the quantization algorithm and scheme
recipe = QuantizationModifier(
ignore=["lm_head"],
targets="Linear",
scheme="FP8_dynamic",
)
# Apply quantization
oneshot(
model=model,
recipe=recipe,
)
# Save to disk in compressed-tensors format
save_path = model_name + "-FP8-dynamic"
model.save_pretrained(save_path)
tokenizer.save_pretrained(save_path)
print(f"Model and tokenizer saved to: {save_path}")
Evaluation
The model was evaluated on OpenLLM Leaderboard V1, using the following command:
Evaluation Commands
OpenLLM Leaderboard V1:
lm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic",dtype=auto,add_bos_token=True,max_model_len=4096,tensor_parallel_size=1,gpu_memory_utilization=0.6,enable_chunked_prefill=True \
--tasks openllm \
--write_out \
--batch_size auto \
--output_path output_dir \
--show_config
Accuracy
| Category | Metric | swiss-ai/Apertus-70B-Instruct-2509 | RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic | Recovery (%) |
|---|---|---|---|---|
| OpenLLM V1 | ARC-Challenge (Acc-Norm, 25-shot) | 70.82 | 70.56 | 99.6 |
| GSM8K (Strict-Match, 5-shot) | 73.69 | 73.09 | 99.2 | |
| HellaSwag (Acc-Norm, 10-shot) | 86.23 | 85.89 | 99.61 | |
| MMLU (Acc, 5-shot) | 69.21 | 68.25 | 98.6 | |
| TruthfulQA (MC2, 0-shot) | 60.31 | 60.05 | 99.6 | |
| Winogrande (Acc, 5-shot) | 80.74 | 80.74 | 100.0 | |
| Average Score | 73.50 | 73.10 | 99.5 |
- Downloads last month
- 379
Model tree for RedHatAI/Apertus-70B-Instruct-2509-FP8-dynamic
Base model
swiss-ai/Apertus-70B-2509