Views
No views yet
1from unsloth import FastLanguageModel
2
3model, tokenizer = FastLanguageModel.from_pretrained(
4 model_name = "bnpatel01/llama-wikiqa-finetuned",
5 max_seq_length = 2048,
6 dtype = None,
7 load_in_4bit = True,
8)
9FastLanguageModel.for_inference(model)1alpaca_prompt = """### Instruction:
2{}
3
4### Input:
5{}
6
7### Response:
8{}"""
9
10question = "What is the capital of France?"
11
12inputs = tokenizer(
13 [alpaca_prompt.format(question, "", "")],
14 return_tensors="pt"
15).to("cuda")
16
17outputs = model.generate(**inputs, max_new_tokens=128, use_cache=True)
18answer = tokenizer.batch_decode(outputs)[0].split("### Response:")[1].strip()
19print(answer)| Property | Value |
|---|---|
| Base Model | unsloth/Llama-3.2-3B-bnb-4bit |
| Fine-tune Method | LoRA (Low-Rank Adaptation) |
| LoRA Rank | 16 |
| LoRA Alpha | 16 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Quantization | 4-bit (load_in_4bit=True) |
| Max Seq Length | 2048 tokens |
| Adapter Size | ~92.8 MB |
| Framework | Unsloth + HuggingFace PEFT |
| Language | English |
| Task | Open-Domain Question Answering |
| Split | Samples (after label=1 filter) |
|---|---|
| Train | 6,165 |
| Validation | 2,733 |
| Test | 20,360 |
label == 1 (correct answer–question pairs) were used for training.1TrainingArguments(
2 per_device_train_batch_size = 2,
3 gradient_accumulation_steps = 4,
4 warmup_steps = 5,
5 num_train_epochs = 3,
6 learning_rate = 2e-4,
7 optim = "adamw_8bit",
8)### Instruction:
<your question here>
### Input:
<optional context, leave empty for QA>
### Response:
<model answer>1pip install unsloth
2pip install torch transformers peft