You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

javanese-qlora

A QLoRA adapter that fine-tunes Gemma 3 4B IT for Javanese (Basa Jawa) conversation and text generation.

Status: experimental and still in development. Output quality varies, especially for speech levels (ngoko, krama) and rare vocabulary.

Intended use

  • Chat and instruction following in Javanese
  • Experiments on low-resource language adaptation
  • Research and hobby projects

Out-of-scope use

  • Anything that needs factual reliability (medical, legal, financial advice)
  • Authoritative translation or official documents
  • Any use prohibited by the Gemma Prohibited Use Policy

How to use

The adapter was trained on the 4-bit base, but it can be applied to the bf16 base (unsloth/gemma-3-4b-it) and merged for inference. This is what the demo Space does.

Option 1: bf16 base + merge (needs ~10 GB VRAM)

import torch
from transformers import AutoTokenizer, Gemma3ForConditionalGeneration
from peft import PeftModel

BASE = "unsloth/gemma-3-4b-it"
LORA = "novanandriyono/javanese-qlora"

tok = AutoTokenizer.from_pretrained(LORA)
model = Gemma3ForConditionalGeneration.from_pretrained(
    BASE, torch_dtype=torch.bfloat16, device_map="auto"
)
model = PeftModel.from_pretrained(model, LORA)
model = model.merge_and_unload()
model.eval()

messages = [{"role": "user", "content": "Sugeng enjang! Critakna babagan Gunung Bromo."}]
inputs = tok.apply_chat_template(
    messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
).to(model.device)

with torch.no_grad():
    out = model.generate(**inputs, max_new_tokens=512, do_sample=True,
                         temperature=0.7, top_p=0.9)

print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))

Option 2: 4-bit base with bitsandbytes (lower VRAM)

import torch
from transformers import AutoTokenizer, Gemma3ForConditionalGeneration, BitsAndBytesConfig
from peft import PeftModel

BASE = "unsloth/gemma-3-4b-it-unsloth-bnb-4bit"
LORA = "novanandriyono/javanese-qlora"

bnb = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.bfloat16,
)

tok = AutoTokenizer.from_pretrained(LORA)
model = Gemma3ForConditionalGeneration.from_pretrained(
    BASE, quantization_config=bnb, device_map="auto"
)
model = PeftModel.from_pretrained(model, LORA)
model.eval()

If you get a key mismatch error when loading, try AutoModelForCausalLM instead of Gemma3ForConditionalGeneration.

Training details

Base model unsloth/gemma-3-4b-it-unsloth-bnb-4bit
Method QLoRA (PEFT 0.18.1, Unsloth)
Train as Language model (text only)
Training data TODO: describe the dataset (source, size, format)
LoRA rank / alpha TODO
Epochs / steps TODO
Learning rate TODO
Max sequence length TODO
Hardware TODO

Limitations and bias

  • The model can produce incorrect, inconsistent, or made-up content.
  • Javanese has several speech levels (ngoko, madya, krama), and the model may mix them or pick the wrong register.
  • Regional dialects and rare words may be poorly covered.
  • It inherits the limitations and biases of the base model (Gemma 3) and of the training data.
  • Vision input is not trained or evaluated in this adapter. Use text only.

Framework versions

  • PEFT 0.18.1
  • Transformers >= 4.50

Contact

Open a discussion on this repo's Community tab.

Downloads last month
21
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for novanandriyono/javanese-qlora

Adapter
(129)
this model

Space using novanandriyono/javanese-qlora 1