julienp79/occitan-gemma-4-12b-it-lora
Occitan Gemma-4-12B-IT (LoRA Merged)
This repository contains a fine-tuned version of Google's Gemma-4-12B-IT specifically optimized for the Occitan language.
The model was trained using LoRA (Low-Rank Adaptation) on a balanced corpus of Occitan texts. This is the largest Occitan Gemma model to date, offering significant improvements in reasoning and linguistic nuance.
π οΈ Training Engineering
Training a 12B model on an RTX 3060 (12GB VRAM) required surgical optimizations:
- Memory Management: Utilized
paged_adamw_8bitto allow optimizer states to spill into system RAM. Vision and audio embedders were stripped to reclaim VRAM. - Context Window: Block size set to 384 tokens to reduce activation memory overhead.
- Quantization: Loaded in 4-bit NormalFloat (NF4) with Double Quantization enabled.
- Gradient Checkpointing: Enabled with
use_reentrant=True. - Effective Batch Size: 8 (batch 1 Γ 8 gradient accumulation steps).
Training Details
Dataset
Balanced Occitan corpus across four categories:
- Literary β prose and poetry
- Journalistic β news and articles
- Grammar β grammatical examples and exercises
- Encyclopedic β factual and reference texts
Training was performed as raw causal language modeling (no chat wrapping).
π Repository Structure
- Root Directory: Full merged Safetensors weights (compatible with
transformers,accelerate, etc.). - `/gguf` Folder: Quantized versions for local inference via LM Studio, Ollama, or llama.cpp.
- `/adapter` Folder: The raw LoRA adapter files for researchers who wish to inspect the weights or perform their own merges.
π How to Use
Using Transformers (Python)
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "julienp79/occitan-gemma-4-12b-it-lora"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype="bfloat16",
)
messages = [
{"role": "user", "content": "Pòdes m'ajudar a escriure un pichon tèxt en occitan?"},
]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))GGUF Quantisation
π€ About Gemma 4
Gemma 4 is Google's latest family of lightweight open models, built from the same research and technology used to create the Gemini models. This 12B version offers strong reasoning capabilities while remaining suitable for local deployment.
