Instructions to use artindnr/gpt-oss-20b-multilingual-unsloth with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use artindnr/gpt-oss-20b-multilingual-unsloth with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gpt-oss-20b-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "artindnr/gpt-oss-20b-multilingual-unsloth") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Studio
How to use artindnr/gpt-oss-20b-multilingual-unsloth with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for artindnr/gpt-oss-20b-multilingual-unsloth to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for artindnr/gpt-oss-20b-multilingual-unsloth to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for artindnr/gpt-oss-20b-multilingual-unsloth to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="artindnr/gpt-oss-20b-multilingual-unsloth", max_seq_length=2048, )
gpt-oss-20b-multilingual-unsloth
LoRA adapter for openai/gpt-oss-20b (loaded via unsloth/gpt-oss-20b), fine-tuned with Unsloth + TRL on the HuggingFaceH4/Multilingual-Thinking dataset.
The goal of this fine-tune is to steer the model's chain-of-thought reasoning (OpenAI's Harmony format) toward following the reasoning language field in the system prompt, so it can reason in English, French, German, Spanish, or Italian instead of only English.
- Developed by: Artin Daneshvar
- Base model:
unsloth/gpt-oss-20b(4-bit, MXFP4) - Adapter type: LoRA (PEFT)
- Language(s): en, fr, de, es, it
- License: apache-2.0 (inherited from
gpt-oss-20b) - Trained with: Unsloth 2x faster finetuning, TRL
SFTTrainer - Hardware: 1x NVIDIA T4 (Google Colab, free tier)
Model Details
This is a LoRA adapter only β it is not a merged/standalone model. You need the base gpt-oss-20b weights plus this adapter to run it. The repo contains:
adapter_config.jsonadapter_model.safetensors
Training Data
HuggingFaceH4/Multilingual-Thinking β reasoning chain-of-thought examples originally in English, translated into French, German, Spanish, and Italian. This is the same dataset used in OpenAI's gpt-oss fine-tuning cookbook.
Training Procedure
- Loaded
unsloth/gpt-oss-20bin 4-bit withFastLanguageModel,max_seq_length = 1024 - LoRA applied to
q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj(including MoE expert projections) - Trained only on assistant responses via Unsloth's
train_on_responses_only(loss masked on user turns)
| Hyperparameter | Value |
|---|---|
| LoRA rank (r) | 8 |
| LoRA alpha | 16 |
| LoRA dropout | 0 |
| Gradient checkpointing | unsloth |
| Batch size (per device) | 1 |
| Gradient accumulation | 4 |
| Learning rate | 2e-4 |
| LR scheduler | linear |
| Warmup steps | 5 |
| Max steps | 30 |
| Optimizer | adamw_8bit |
| Weight decay | 0.001 |
| Seed | 3407 |
Note: This run used
max_steps = 30as a short demonstration run, not a full epoch over the dataset. Treat this checkpoint as a proof-of-concept rather than a fully converged fine-tune β expect anum_train_epochs = 1(or more) run to give noticeably stronger results.
How to Get Started with the Model
Option 1: Unsloth (recommended, fastest)
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "artindnr/gpt-oss-20b-multilingual-unsloth",
max_seq_length = 1024,
dtype = None,
load_in_4bit = True,
)
FastLanguageModel.for_inference(model)
messages = [
{"role": "system", "content": "reasoning language: French\n\nYou are a helpful assistant that can solve mathematical problems."},
{"role": "user", "content": "Solve x^5 + 3x^4 - 10 = 3."},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt = True,
return_tensors = "pt",
return_dict = True,
reasoning_effort = "medium",
).to("cuda")
from transformers import TextStreamer
_ = model.generate(**inputs, max_new_tokens = 256, streamer = TextStreamer(tokenizer))
Option 2: π€ Transformers + PEFT
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base_model_id = "unsloth/gpt-oss-20b"
adapter_id = "artindnr/gpt-oss-20b-multilingual-unsloth"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
device_map = "auto",
torch_dtype = torch.bfloat16,
load_in_4bit = True,
)
model = PeftModel.from_pretrained(base_model, adapter_id)
messages = [
{"role": "system", "content": "reasoning language: German\n\nYou are a helpful assistant."},
{"role": "user", "content": "Explain how photosynthesis works."},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt = True,
return_tensors = "pt",
return_dict = True,
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens = 256)
print(tokenizer.decode(outputs[0], skip_special_tokens = True))
Set the reasoning language line in the system prompt to English, French, German, Spanish, or Italian to steer which language the model's internal reasoning is produced in.
Limitations
- This adapter was trained for a small number of steps (30) as a demo run β reasoning-language adherence and output quality may be inconsistent. Consider training for more steps/epochs for production use.
- Inherits all limitations and biases of the base
gpt-oss-20bmodel. - Only tested with Unsloth's loading path at time of writing; GGUF/vLLM export for gpt-oss LoRA adapters was not yet supported by Unsloth when this was trained.
Framework versions
unslothtrl == 0.22.2transformers == 4.56.2peft
Trained with Unsloth and Hugging Face's TRL library.
- Downloads last month
- 31
