Instructions to use julienp79/occitan-gemma-3-4b-it-dora-sfttrainer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use julienp79/occitan-gemma-3-4b-it-dora-sfttrainer with PEFT:
Task type is invalid.
- Transformers
How to use julienp79/occitan-gemma-3-4b-it-dora-sfttrainer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="julienp79/occitan-gemma-3-4b-it-dora-sfttrainer") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("julienp79/occitan-gemma-3-4b-it-dora-sfttrainer") model = AutoModelForMultimodalLM.from_pretrained("julienp79/occitan-gemma-3-4b-it-dora-sfttrainer", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use julienp79/occitan-gemma-3-4b-it-dora-sfttrainer with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M # Run inference directly in the terminal: llama cli -hf julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M # Run inference directly in the terminal: llama cli -hf julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M
Use Docker
docker model run hf.co/julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use julienp79/occitan-gemma-3-4b-it-dora-sfttrainer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "julienp79/occitan-gemma-3-4b-it-dora-sfttrainer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "julienp79/occitan-gemma-3-4b-it-dora-sfttrainer", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M
- SGLang
How to use julienp79/occitan-gemma-3-4b-it-dora-sfttrainer 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 "julienp79/occitan-gemma-3-4b-it-dora-sfttrainer" \ --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": "julienp79/occitan-gemma-3-4b-it-dora-sfttrainer", "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 "julienp79/occitan-gemma-3-4b-it-dora-sfttrainer" \ --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": "julienp79/occitan-gemma-3-4b-it-dora-sfttrainer", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use julienp79/occitan-gemma-3-4b-it-dora-sfttrainer with Ollama:
ollama run hf.co/julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M
- Unsloth Studio
How to use julienp79/occitan-gemma-3-4b-it-dora-sfttrainer 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 julienp79/occitan-gemma-3-4b-it-dora-sfttrainer 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 julienp79/occitan-gemma-3-4b-it-dora-sfttrainer to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for julienp79/occitan-gemma-3-4b-it-dora-sfttrainer to start chatting
- Docker Model Runner
How to use julienp79/occitan-gemma-3-4b-it-dora-sfttrainer with Docker Model Runner:
docker model run hf.co/julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M
- Lemonade
How to use julienp79/occitan-gemma-3-4b-it-dora-sfttrainer with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M
Run and chat with the model
lemonade run user.occitan-gemma-3-4b-it-dora-sfttrainer-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Occitan Gemma 3 4B IT (DoRA, Merged)
This repository contains a fine-tuned version of Google's Gemma 3 4B Instruct optimized for the Occitan language using DoRA (Weight-Decomposed Low-Rank Adaptation).
Repository Structure
- Root Directory: Full merged Safetensors weights (bfloat16, compatible with
transformers) adapter/Folder: The raw DoRA adapter files (for use with PEFT)gguf/Folder: Quantized GGUF versions (f16, Q2_K, Q4_K_M, Q5_K_M, Q8_0) for local inference via llama.cpp, LM Studio, Ollama, etc.
Usage
Using the merged model (Transformers)
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "julienp79/occitan-gemma-3-4b-it-dora-sfttrainer"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
messages = [
{"role": "user", "content": "Escrivètz un cort paragraf en occitan sus la lenga occitana e son importà ncia."},
]
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))
Using the DoRA adapter with PEFT
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model = AutoModelForCausalLM.from_pretrained(
"unsloth/gemma-3-4b-it",
device_map="auto",
torch_dtype="auto"
)
tokenizer = AutoTokenizer.from_pretrained("unsloth/gemma-3-4b-it")
# Load adapter from the adapter/ subfolder
model = PeftModel.from_pretrained(base_model, "julienp79/occitan-gemma-3-4b-it-dora-sfttrainer", subfolder="adapter")
model.eval()
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": "Sètz un assistent utila que parla occitan."}],
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Using GGUF quantizations (llama.cpp)
llama-cli -hf julienp79/occitan-gemma-3-4b-it-dora-sfttrainer:Q4_K_M \
-p "<start_of_turn>user\nEscrivètz un cort paragraf en occitan.<end_of_turn>\n<start_of_turn>model\n" \
-n 256 -e --temp 0.7
Or via the GGUF file directly:
llama-cli -m gguf/occitan-gemma-3-4b-it-dora-sfttrainer-Q4_K_M.gguf \
-p "<start_of_turn>user\nEscrivètz un cort paragraf en occitan.<end_of_turn>\n<start_of_turn>model\n" \
-n 256 -e --temp 0.7
Adapter Details
- Adapter Type: DoRA (Weight-Decomposed Low-Rank Adaptation,
use_dora=True) - Base Model: unsloth/gemma-3-4b-it (Google Gemma 3 4B Instruct)
- LoRA Rank (r): 16
- LoRA Alpha: 32
- Target Modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Dropout: 0
- Training Method: SFT (Supervised Fine-Tuning) with SFTTrainer
Training Details
- Block Size: 768 tokens
- Learning Rate: 1e-4 (cosine schedule)
- Optimizer: Paged AdamW 8-bit
- Max Gradient Norm: 1.0
- Warmup Steps: 200
- Weight Decay: 0.01
- Epochs: 5
- Total Steps: ~950
- Hardware: RTX 3060 12GB (4-bit base model with Unsloth's gradient checkpointing)
Training procedure
This model was trained with SFT (Supervised Fine-Tuning) using SFTTrainer on raw Occitan text (literary, journalistic, grammar, and encyclopedic sources). No chat templating was applied during training — the model learns language structure via causal language modeling on chunked text.
Framework versions
- PEFT 0.19.1
- TRL: 1.4.0
- Transformers: 5.8.1
- Pytorch: 2.6.0+cu124
- Datasets: 4.8.5
- Tokenizers: 0.22.2
- Downloads last month
- 2