Views
No views yet
| Parameter | Value |
|---|---|
| Max Sequence Length | 512 |
| Epochs | 2 |
| Learning Rate | 1e-05 |
| LoRA r | 32 |
| LoRA alpha | 64 |
| Quantization | 4-bit |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3import torch
4
5base_model = "Qwen/Qwen3-4B-Instruct-2507"
6adapter_model = "hirosan6595/lora_structeval_t_qwen3_4b-55"
7
8tokenizer = AutoTokenizer.from_pretrained(base_model)
9
10model = AutoModelForCausalLM.from_pretrained(
11 base_model,
12 torch_dtype=torch.float16,
13 device_map="auto",
14)
15
16model = PeftModel.from_pretrained(model, adapter_model)
17
18# --- Generate Example ---
19prompt = "Convert the following to JSON: name is Alice, age is 30, city is Tokyo."
20
21messages = [{"role": "user", "content": prompt}]
22text = tokenizer.apply_chat_template(
23 messages, tokenize=False, add_generation_prompt=True
24)
25inputs = tokenizer(text, return_tensors="pt").to(model.device)
26
27output = model.generate(**inputs, max_new_tokens=256)
28print(tokenizer.decode(output[0], skip_special_tokens=True))Tip: For best results, give a clear instruction specifying the desired output format (e.g. "Output valid JSON only.").
1@misc{lora_structeval_t_qwen3_4b-55,
2 author = {hirosan6595},
3 title = {lora_structeval_t_qwen3_4b-55},
4 year = 2026,
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/hirosan6595/lora_structeval_t_qwen3_4b-55},
7}