Views
No views yet
unsloth/Llama-3.2-1B-Instruct-bnb-4bit trained for customer support ticket classification and routing tasks.unsloth/Llama-3.2-1B-Instruct-bnb-4bit1import unsloth
2from unsloth import FastLanguageModel
3from peft import PeftModel
4import torch
5
6base_model = "unsloth/Llama-3.2-1B-Instruct-bnb-4bit"
7
8model, tokenizer = FastLanguageModel.from_pretrained(
9 model_name=base_model,
10 max_seq_length=2048,
11 dtype=None,
12 load_in_4bit=True,
13)
14
15model = PeftModel.from_pretrained(
16 model,
17 "/content/support_router_model"
18)
19
20prompt = f"""<|begin_of_text|><|start_header_id|>system<|end_header_id|>
21
22You are a customer support routing AI.
23Return ONLY valid JSON.
24
25<|eot_id|><|start_header_id|>user<|end_header_id|>
26
27Classify this support ticket:
28
29My payment failed twice and I need refund urgently
30
31<|eot_id|><|start_header_id|>assistant<|end_header_id|>
32"""
33
34inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
35
36outputs = model.generate(
37 **inputs,
38 max_new_tokens=80,
39 temperature=0.1,
40 do_sample=False,
41 pad_token_id=tokenizer.eos_token_id
42)
43
44response = tokenizer.decode(
45 outputs[0], skip_special_tokens=True
46)
47
48print(response)