The QAT (Quantization-Aware Training) base model was originally quantized to Q4_0 and then dequantized back to bf16, meaning the weights carry QAT-aware characteristics that may improve robustness to post-training quantization.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_id = "julienp79/occitan-gemma-4-12b-it-rslora-qat-sfttrainer"
4
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
7
8messages = [
9 {"role": "user", "content": "Escrivètz un cort paragraf en occitan sus la lenga occitana e son importància."},
10]
11
12inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
13outputs = model.generate(inputs, max_new_tokens=256)
14print(tokenizer.decode(outputs[0], skip_special_tokens=True))
1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4base_model = AutoModelForCausalLM.from_pretrained(
5 "google/gemma-4-12B-it-qat-q4_0-unquantized",
6 device_map="auto",
7 torch_dtype="auto",
8)
9tokenizer = AutoTokenizer.from_pretrained("google/gemma-4-12B-it-qat-q4_0-unquantized")
10
11model = PeftModel.from_pretrained(base_model, "julienp79/occitan-gemma-4-12b-it-rslora-qat-sfttrainer", subfolder="adapter")
12model.eval()
13
14prompt = tokenizer.apply_chat_template(
15 [{"role": "user", "content": "Escrivètz un cort paragraf en occitan."}],
16 tokenize=False,
17 add_generation_prompt=True,
18)
19inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
20outputs = model.generate(**inputs, max_new_tokens=128)
21print(tokenizer.decode(outputs[0], skip_special_tokens=True))
1llama-cli -hf julienp79/occitan-gemma-4-12b-it-rslora-qat-sfttrainer:Q4_K_M \
2 -p "<start_of_turn>user\nEscrivètz un cort paragraf en occitan.<end_of_turn>\n<start_of_turn>model\n" \
3 -n 256 -e --temp 0.7
1llama-cli -m gguf/occitan-gemma-4-12b-it-rslora-qat-sfttrainer-Q4_K_M.gguf \
2 -p "<start_of_turn>user\nEscrivètz un cort paragraf en occitan.<end_of_turn>\n<start_of_turn>model\n" \
3 -n 256 -e --temp 0.7
This model was trained with SFT (Supervised Fine-Tuning) using SFTTrainer on raw Occitan text. No chat templating was applied during training — the model learns language structure via causal language modeling on chunked text. The RS-LoRA variant helps stabilise training at higher ranks by scaling the LoRA update by alpha / sqrt(r) instead of alpha / r.
1@software{geyronneau2024trl,
2 title = {{TRL: Transformers Reinforcement Learning}},
3 author = {Geyronneau, Quentin and von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
4 license = {Apache-2.0},
5 url = {https://github.com/huggingface/trl},
6 year = {2024}
7}