Views
No views yet
category, priority, and summary fields.SFTTrainer with LoRA
(r=16, alpha=32, targeting the attention projection layers). Built with Llama.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5base_model = "meta-llama/Llama-3.2-3B-Instruct"
6adapter = "Kranthi1290/llama-3.2-3b-support-ticket-json"
7
8tok = AutoTokenizer.from_pretrained(base_model)
9model = AutoModelForCausalLM.from_pretrained(base_model, torch_dtype=torch.bfloat16, device_map="auto")
10model = PeftModel.from_pretrained(model, adapter)
11
12messages = [
13 {"role": "system", "content": "You extract structured info from customer support messages. Respond with ONLY a JSON object with keys: category, priority, summary. No other text."},
14 {"role": "user", "content": "My login keeps failing after the update, this is urgent, please help asap"},
15]
16prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
17inputs = tok(prompt, return_tensors="pt").to(model.device)
18out = model.generate(**inputs, max_new_tokens=100, do_sample=False)
19print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))