fine-tuned-model-indonesian is an Indonesian Language Model based on Llama-3.1-8B fine-tuned using Unsloth and Hugging Face's TRL library. This model is optimized for general Indonesian conversational tasks, document analysis, and Legal AI Retrieval-Augmented Generation (RAG) pipelines.
| Attribute | Details |
|---|---|
| Developed by | hendrimardani |
| Base Model | unsloth/Llama-3.1-8B-unsloth-bnb-4bit |
| Fine-Tuning Method | SFT (Supervised Fine-Tuning) + PEFT/LoRA |
| Language | Indonesian (Bahasa Indonesia) |
| License | Apache 2.0 |
| Task Category | text-generation / Conversational |
| Max Sequence Length | 2048 tokens |
To maintain optimal response quality and prevent repetitive loops, use the following generation configuration:
| Parameter | Recommended Value | Description |
|---|---|---|
do_sample |
True |
Enables probabilistic sampling |
temperature |
0.3 – 0.5 |
Keeps output deterministic and accurate for factual tasks |
repetition_penalty |
1.15 |
Prevents loop generation without distorting vocabulary |
max_new_tokens |
1024 |
Allocates sufficient generation space for long answers |
transformersimport torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "hendrimardani/fine-tuned-model-indonesian"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.bfloat16,
load_in_4bit=True
)
messages = [
{
"role": "system",
"content": "Anda adalah asisten AI berpengalaman yang menjawab pertanyaan dalam Bahasa Indonesia secara ringkas, jelas, dan faktual."
},
{
"role": "user",
"content": "Jelaskan tentang aturan waktu kerja dan lembur berdasarkan ketentuan hukum yang berlaku di Indonesia."
}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=True,
temperature=0.3,
repetition_penalty=1.15,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id if tokenizer.pad_token_id is not None else tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True)
print(response)
model-00002-of-00004.safetensors 5.0 GBmodel-00001-of-00004.safetensors 5.0 GBmodel-00003-of-00004.safetensors 4.9 GBmodel-00004-of-00004.safetensors 1.2 GBadapter_model.safetensors 168 MBlast-checkpoint/adapter_model.safetensors 168 MBlast-checkpoint/optimizer.pt 87 MBlast-checkpoint/rng_state.pth 14.6 kBlast-checkpoint/training_args.bin 6.4 kBtraining_args.bin 6.4 kBlast-checkpoint/scheduler.pt 1.5 kBlast-checkpoint/scaler.pt 1.4 kB