Instructions to use ssmits/Zamba2-1.2B-instruct-Dutch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ssmits/Zamba2-1.2B-instruct-Dutch with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ssmits/Zamba2-1.2B-instruct-Dutch") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ssmits/Zamba2-1.2B-instruct-Dutch") model = AutoModelForCausalLM.from_pretrained("ssmits/Zamba2-1.2B-instruct-Dutch") 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 ssmits/Zamba2-1.2B-instruct-Dutch with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ssmits/Zamba2-1.2B-instruct-Dutch" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ssmits/Zamba2-1.2B-instruct-Dutch", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ssmits/Zamba2-1.2B-instruct-Dutch
- SGLang
How to use ssmits/Zamba2-1.2B-instruct-Dutch 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 "ssmits/Zamba2-1.2B-instruct-Dutch" \ --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": "ssmits/Zamba2-1.2B-instruct-Dutch", "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 "ssmits/Zamba2-1.2B-instruct-Dutch" \ --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": "ssmits/Zamba2-1.2B-instruct-Dutch", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ssmits/Zamba2-1.2B-instruct-Dutch with Docker Model Runner:
docker model run hf.co/ssmits/Zamba2-1.2B-instruct-Dutch
Model Card for Zamba2-1.2B-instruct-Dutch
Zamba2-1.2B-instruct-Dutch is a basic Dutch language instruction-following model obtained through a two-stage fine-tuning process:
First stage (Base instruction model by Zyphra):
- Zyphra fine-tuned Zamba2-1.2B to create Zamba2-1.2B-instruct through:
- SFT training on ultrachat_200k and Infinity-Instruct
- DPO training on ultrafeedback_binarized, orca_dpo_pairs, and OpenHermesPreferences
- Zyphra fine-tuned Zamba2-1.2B to create Zamba2-1.2B-instruct through:
Second stage (Dutch language adaptation):
- Further fine-tuning of Zyphra's Zamba2-1.2B-instruct on the dolly-15k-dutch dataset, specifically using the training split. While this dataset is not state-of-the-art, it provides a solid foundation for demonstrating Dutch language capabilities and fits within the 1024 token context window. The relatively small dataset size allows for quick experimentation and validation of the model's Dutch language adaptation capabilities.
The model maintains the core hybrid architecture of Zamba2 while being optimized for Dutch language understanding and generation. By building upon Zyphra's instruction-tuned model, it inherits strong general instruction-following capabilities while adding Dutch language proficiency.
Quick start
Prerequisites
To download Zamba2-1.2B-instruct-Dutch, clone Zyphra's fork of transformers:
git clone https://github.com/Zyphra/transformers_zamba2.gitcd transformers_zamba2- Install the repository:
pip install -e . pip install accelerate
Inference
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Instantiate model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("Zyphra/Zamba2-1.2B-instruct-Dutch")
model = AutoModelForCausalLM.from_pretrained("Zyphra/Zamba2-1.2B-instruct-Dutch", device_map="cuda", torch_dtype=torch.bfloat16)
# Format the input as a chat template
prompt = "Wat zijn de belangrijkste oorzaken van de val van het Romeinse Rijk?"
sample = [{'role': 'user', 'content': prompt}]
chat_sample = tokenizer.apply_chat_template(sample, tokenize=False)
# Tokenize input and generate output
input_ids = tokenizer(chat_sample, return_tensors='pt', add_special_tokens=False).to("cuda")
outputs = model.generate(**input_ids, max_new_tokens=150, return_dict_in_generate=False, output_scores=False, use_cache=True, num_beams=1, do_sample=False)
print((tokenizer.decode(outputs[0])))
Training Details
The model was fine-tuned using the following approach:
- Started with the base Zamba2-1.2B-instruct model
- Fine-tuned on the dolly-15k-dutch dataset using optimized learning rates
- Implemented memory optimization through gradient checkpointing
- Utilized mixed precision training (bf16)
Fine-tuning Configuration
The model includes an advanced learning rate optimization system for fine-tuning, implemented through the LROptimizerCallback class:
from transformers import AutoTokenizer, Trainer
from lr_optimizer import setup_training, LROptimizerCallback
callback = LROptimizerCallback(
num_trials=10,
lr_range=(1e-6, 1e-4)
)
trainer = Trainer(
model=model,
args=training_args,
callbacks=[callback]
)
trainer.train()
Model Architecture
Zamba2-1.2B-instruct-Dutch maintains the hybrid SSM-attention architecture of the base model:
- Backbone of Mamba2 layers interleaved with shared attention layers
- LoRA projection matrices for shared transformer blocks
- Rotary position embeddings in the shared attention layer
- Concatenated original embeddings for improved information maintenance
Performance
The model maintains the efficient inference characteristics of the base Zamba2 architecture:
- Low latency inference
- Rapid generation
- Small memory footprint
Memory overhead:
Limitations
- The model is primarily focused on Dutch language understanding and generation
- Performance on other languages may be limited
- The training dataset size is relatively small compared to larger multilingual models
- No explicit content moderation mechanisms are included
License
This model is released under the Apache 2.0 license.
Note: This is a temporary HuggingFace implementation. A standalone PyTorch implementation may be found at Zamba2 GitHub repository.
- Downloads last month
- 43

