Instructions to use Kauhiro/qwen3-4b-instruct-2507-structured-output-lora-ver18 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Kauhiro/qwen3-4b-instruct-2507-structured-output-lora-ver18 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen3-4b-instruct-2507-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "Kauhiro/qwen3-4b-instruct-2507-structured-output-lora-ver18") - Notebooks
- Google Colab
- Kaggle
qwen3-4b-instruct-2507-structured-output-lora
This repository provides a LoRA adapter fine-tuned from Qwen/Qwen3-4B-Instruct-2507 using QLoRA (4-bit, Unsloth).
This repository contains LoRA adapter weights only. The base model must be loaded separately.
Training Objective
This adapter is trained to improve structured output accuracy (JSON / YAML / XML / TOML / CSV).
Loss is applied only to the final assistant output, while intermediate reasoning (Chain-of-Thought) is masked.
Training Configuration
- Base model: Qwen/Qwen3-4B-Instruct-2507
- Method: QLoRA (4-bit)
- Max sequence length: 1024
- Epochs: 2
- Learning rate: 1e-6
- Grad Accum: 8
- LoRA: r=64, alpha=128
- Dropout: 0.1
- Upsampling: 1
- Upsampling rules json: "xml_to_yaml": 2.0, "json_to_xml": 1.8, "text_to_yaml": 1.6
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base = "Qwen/Qwen3-4B-Instruct-2507"
adapter = "Kauhiro/qwen3-4b-instruct-2507-structured-output-lora-ver18"
tokenizer = AutoTokenizer.from_pretrained(base)
model = AutoModelForCausalLM.from_pretrained(
base,
torch_dtype=torch.float16,
device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter)
Sources & Terms (IMPORTANT)
Training data: Kauhiro/structured_data_with_cot_dataset_512_collected_from_v2v4v5.
This data was gathered from version 2, 4, and 5 of u-10bei/structured_data_with_cot_dataset_512,
the type of which was conversion only. Total records: 5530
Original datasets:
https://huggingface.co/datasets/u-10bei/structured_data_with_cot_dataset_512_v2
https://huggingface.co/datasets/u-10bei/structured_data_with_cot_dataset_512_v4
https://huggingface.co/datasets/u-10bei/structured_data_with_cot_dataset_512_v5
Dataset License: The dataset used inherits the license of these original datasets.
Compliance: Users must comply with the MIT license (including copyright notice) and the base model's original terms of use.
Base model license: Apache-2.0 https://www.apache.org/licenses/LICENSE-2.0
- Downloads last month
- 2
Model tree for Kauhiro/qwen3-4b-instruct-2507-structured-output-lora-ver18
Base model
Qwen/Qwen3-4B-Instruct-2507
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen3-4b-instruct-2507-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "Kauhiro/qwen3-4b-instruct-2507-structured-output-lora-ver18")