Views
No views yet
Qwen/Qwen2.5-0.5B-Instruct via LoRA supervised fine-tuning.| Property | Value |
|---|---|
| Base model | Qwen/Qwen2.5-0.5B-Instruct |
| Fine-tuning method | LoRA (PEFT) |
| Language | Portuguese (Brazilian) |
| Domain | Electricity consumer rights / ANEEL regulations |
| Task | Instruction-following / Question Answering |
| LoRA rank (r) | 8 |
| LoRA alpha | 16 |
| LoRA dropout | 0.1 |
| Target modules | k_proj, up_proj, q_proj, gate_proj, v_proj, down_proj, o_proj |
| Bias | none |
| Training epochs | 3 |
| Batch size (effective) | 16 |
| Learning rate | 0.0001 |
| LR scheduler | SchedulerType.COSINE |
| Optimizer | OptimizerNames.PAGED_ADAMW_8BIT |
| Precision | fp16 |
messages format with a consistent system prompt establishing the assistant's role as an ANEEL-aware consumer rights specialist.1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_id = "maikerdr/EnerGuia-0.5B"
4
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype="auto",
10 device_map="auto"
11)
12
13model.eval()
14
15messages = [
16 {
17 "role": "system",
18 "content": (
19 "Você é um assistente especialista em direitos do consumidor de energia elétrica "
20 "no Brasil, com base nas normas da ANEEL e na legislação vigente. "
21 "Responda de forma clara, objetiva e empática. "
22 "Quando a pergunta estiver fora do seu domínio de conhecimento, "
23 "responda taxativamente com 'Não posso responder essa pergunta!'"
24 ),
25 },
26 {"role": "user", "content": "Quanto tempo a distribuidora tem para me ligar a energia?"},
27]
28
29text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
30inputs = tokenizer(text, return_tensors="pt").to(model.device)
31
32output = model.generate(**inputs, max_new_tokens=256, do_sample=False)
33print(tokenizer.decode(output[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))