Views
No views yet
u-10bei/structured_data_with_cot_dataset_512_v2u-10bei/dpo-dataset-qwen-cot1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3import torch
4
5# 1. Load Base Model
6base_model_id = "unsloth/Qwen3-4B-Instruct-2507"
7model = AutoModelForCausalLM.from_pretrained(
8 base_model_id,
9 torch_dtype=torch.float16,
10 device_map="auto"
11)
12tokenizer = AutoTokenizer.from_pretrained(base_model_id)
13
14# 2. Load this Adapter
15# Replace "your_id/your-repo-name" with your actual HF repo ID
16adapter_id = "EriUmezawa/qwen3-4b-structeval-tsto_v2"
17model = PeftModel.from_pretrained(model, adapter_id)
18
19# 3. Inference
20prompt = "Your question here"
21inputs = tokenizer.apply_chat_template([{"role": "user", "content": prompt}], tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
22
23# Generate
24outputs = model.generate(**inputs, max_new_tokens=512)
25print(tokenizer.decode(outputs[0], skip_special_tokens=True))
26
27## Sources & License (IMPORTANT)
28
29* **Training Data**: u-10bei/structured_data_with_cot_dataset_512_v2, u-10bei/dpo-dataset-qwen-cot
30* **License**: MIT License. (As per dataset terms).
31* **Compliance**: Users must comply with the MIT license (including copyright notice) and the base model's original terms of use.