Downloads · 30 days
7
4% of all-time downloads
safouaneelg/Apertus-8B-Instruct-2509-GSM8k-SFT
Apertus-8B-Instruct-2509-GSM8k-SFT is a text generation model from safouaneelg. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Apertus has released two models: 70B and 8B parameter multi-language model. Check out the model info here: Swiss-AI/LLM
Downloads · 30 days
7
4% of all-time downloads
All-time downloads
194
Public
Parameters
8.1B
5.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors5.7 GB · 100%
How the weights are stored.
U87.2B · 87%
From the Hugging Face model README
Apertus has released two models: 70B and 8B parameter multi-language model. Check out the model info here: Swiss-AI/LLM
This repo contains the fine-tuned version of Apertus on GSM8K dataset.
The fine-tuning was performed using Unsloth on a single GPU RTX A6000 48GB Linux machine using the below parameters:
You can run this fine-tuned version using the below instructions:
Transformers 4.56.0 are required to run the model.pip install -U transformers
pip install git+https://github.com/rubber-duck-debug/xielu
If you struggle, check the xiELU installation below (for linux users only).
Transformers pipeline
Unsloth pipeline (This works better, if you have StaticLayer error, comment the arg prompt_lookup_num_tokens=None)
from unsloth import FastLanguageModel
import torch
# Load the model and tokenizer
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="safouaneelg/Apertus-8B-Instruct-2509-GSM8k-SFT",
max_seq_length=2048,
load_in_4bit=True,
)
# Move to device
device = "cuda" if torch.cuda.is_available() else "cpu"
# Example prompt from GSM8k
prompt = "Short answer please. Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?."
messages_think = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages_think,
tokenize=False,
add_generation_prompt=True,
)
model_inputs = tokenizer([text], return_tensors="pt", add_special_tokens=False).to(model.device)
outputs = model.generate(
**model_inputs,
max_new_tokens=256,
temperature=0.8,
top_p=0.9,
use_cache=True,
do_sample=True,
prompt_lookup_num_tokens=None #for some reasoning this sometimes solve the inferencing errors
)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
import os
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
model_name = "safouaneelg/Apertus-8B-Instruct-2509-GSM8k-SFT"
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
).to(device)
# prepare the model input
prompt = "Short answer please. Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?"
messages_think = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages_think,
tokenize=False,
add_generation_prompt=True,
)
streamer = TextStreamer(tokenizer)
model_inputs = tokenizer([text], return_tensors="pt", add_special_tokens=False).to(model.device)
# Generate the output
generated_ids = model.generate(**model_inputs, streamer=streamer, max_new_tokens=2024)
# Get and decode the output
output_ids = generated_ids[0][len(model_inputs.input_ids[0]) :]
print(tokenizer.decode(output_ids, skip_special_tokens=True))
Output example:

The pip install might result in a set of errors, below is how I managed to make it running:
xiELU need cmake 3.30 +. Therefore, you can reach out to cmake downloader Link and select the distribution. For my test I have used cmake-4.1.1-linux-x86_64.sh.
Copy to opt/ and make the script executable via below command lines:
sudo cp cmake-4.1.1-linux-x86_64.sh /opt/
sudo chmod +x cmake-4.1.1-linux-x86_64.sh
CUDA_HOME=/usr/local/cudaX.Xexport PATH="/opt/cmake-4.1.1-linux-x86_64/bin:$PATH"
export CUDA_HOME=/usr/local/cuda
export PATH=$CUDA_HOME/bin:$PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
source ~/.bashrc
# or
source ~/.zshrc
Verify the installation
Run nvcc --version to confirm that the CUDA compiler is now in your PATH. You should see the CUDA version number. And, run echo $CUDA_HOME to confirm that the environment variable is set correctly.
Reactivate you conda/venv environment and run the pip install git+https://github.com/rubber-duck-debug/xielu.
license: apache-2.0 base_model:
@misc{swissai2025apertus,
title={{Apertus: Democratizing Open and Compliant LLMs for Global Language Environments}},
author={Apertus Team},
year={2025},
howpublished={\url{https://huggingface.co/swiss-ai/Apertus-8B-Instruct-2509}}
}