Text Generation
PEFT
Safetensors
English
qlora
lora
structured-output
phase1
conversational
cinnamonrooo commited on
Commit
cb13f73
·
verified ·
1 Parent(s): 9f1d2fc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +93 -155
README.md CHANGED
@@ -1,208 +1,146 @@
1
  ---
2
- base_model: unsloth/qwen3-4b-instruct-2507-unsloth-bnb-4bit
 
 
 
 
 
 
 
3
  library_name: peft
4
  pipeline_tag: text-generation
5
  tags:
6
- - base_model:adapter:unsloth/qwen3-4b-instruct-2507-unsloth-bnb-4bit
7
  - lora
8
- - transformers
9
- - unsloth
10
  ---
11
 
12
- # Model Card for Model ID
13
 
14
- <!-- Provide a quick summary of what the model is/does. -->
 
15
 
 
16
 
 
 
 
 
 
17
 
18
- ## Model Details
19
-
20
- ### Model Description
21
-
22
- <!-- Provide a longer summary of what this model is. -->
23
-
24
-
25
-
26
- - **Developed by:** [More Information Needed]
27
- - **Funded by [optional]:** [More Information Needed]
28
- - **Shared by [optional]:** [More Information Needed]
29
- - **Model type:** [More Information Needed]
30
- - **Language(s) (NLP):** [More Information Needed]
31
- - **License:** [More Information Needed]
32
- - **Finetuned from model [optional]:** [More Information Needed]
33
-
34
- ### Model Sources [optional]
35
-
36
- <!-- Provide the basic links for the model. -->
37
-
38
- - **Repository:** [More Information Needed]
39
- - **Paper [optional]:** [More Information Needed]
40
- - **Demo [optional]:** [More Information Needed]
41
-
42
- ## Uses
43
-
44
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
45
-
46
- ### Direct Use
47
-
48
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
49
-
50
- [More Information Needed]
51
-
52
- ### Downstream Use [optional]
53
-
54
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
55
-
56
- [More Information Needed]
57
-
58
- ### Out-of-Scope Use
59
-
60
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
61
-
62
- [More Information Needed]
63
-
64
- ## Bias, Risks, and Limitations
65
-
66
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
67
-
68
- [More Information Needed]
69
 
70
- ### Recommendations
71
 
72
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
73
 
74
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
 
75
 
76
- ## How to Get Started with the Model
77
 
78
- Use the code below to get started with the model.
 
 
79
 
80
- [More Information Needed]
81
 
82
  ## Training Details
83
 
84
- ### Training Data
85
-
86
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
87
-
88
- [More Information Needed]
89
-
90
- ### Training Procedure
91
-
92
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
93
-
94
- #### Preprocessing [optional]
95
-
96
- [More Information Needed]
97
 
 
98
 
99
- #### Training Hyperparameters
 
 
100
 
101
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
102
 
103
- #### Speeds, Sizes, Times [optional]
104
-
105
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
106
-
107
- [More Information Needed]
108
-
109
- ## Evaluation
110
-
111
- <!-- This section describes the evaluation protocols and provides the results. -->
112
-
113
- ### Testing Data, Factors & Metrics
114
-
115
- #### Testing Data
116
-
117
- <!-- This should link to a Dataset Card if possible. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Factors
122
-
123
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
124
-
125
- [More Information Needed]
126
-
127
- #### Metrics
128
-
129
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
130
-
131
- [More Information Needed]
132
-
133
- ### Results
134
-
135
- [More Information Needed]
136
-
137
- #### Summary
138
-
139
-
140
-
141
- ## Model Examination [optional]
142
-
143
- <!-- Relevant interpretability work for the model goes here -->
144
-
145
- [More Information Needed]
146
 
147
- ## Environmental Impact
148
 
149
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
 
 
 
 
 
150
 
151
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
152
 
153
- - **Hardware Type:** [More Information Needed]
154
- - **Hours used:** [More Information Needed]
155
- - **Cloud Provider:** [More Information Needed]
156
- - **Compute Region:** [More Information Needed]
157
- - **Carbon Emitted:** [More Information Needed]
158
 
159
- ## Technical Specifications [optional]
 
 
 
 
 
160
 
161
- ### Model Architecture and Objective
162
 
163
- [More Information Needed]
164
 
165
- ### Compute Infrastructure
166
 
167
- [More Information Needed]
 
 
 
168
 
169
- #### Hardware
 
170
 
171
- [More Information Needed]
172
 
173
- #### Software
 
 
 
 
174
 
175
- [More Information Needed]
176
 
177
- ## Citation [optional]
178
 
179
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
 
180
 
181
- **BibTeX:**
 
182
 
183
- [More Information Needed]
184
 
185
- **APA:**
186
 
187
- [More Information Needed]
 
 
188
 
189
- ## Glossary [optional]
190
 
191
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
 
192
 
193
- [More Information Needed]
194
 
195
- ## More Information [optional]
196
 
197
- [More Information Needed]
 
 
198
 
199
- ## Model Card Authors [optional]
200
 
201
- [More Information Needed]
202
 
203
- ## Model Card Contact
 
 
204
 
205
- [More Information Needed]
206
- ### Framework versions
207
 
208
- - PEFT 0.18.1
 
1
  ---
2
+ base_model: unsloth/Qwen3-4B-Instruct-2507
3
+ datasets:
4
+ - u-10bei/structured_data_with_cot_dataset_512_v2
5
+ - u-10bei/structured_data_with_cot_dataset_512_v4
6
+ - u-10bei/structured_data_with_cot_dataset_512_v5
7
+ language:
8
+ - en
9
+ license: apache-2.0
10
  library_name: peft
11
  pipeline_tag: text-generation
12
  tags:
13
+ - qlora
14
  - lora
15
+ - structured-output
16
+ - phase1
17
  ---
18
 
19
+ # Qwen3-4B Structured Output LoRA (Phase 1)
20
 
21
+ This repository provides a **LoRA adapter** fine-tuned from
22
+ **unsloth/Qwen3-4B-Instruct-2507** using **QLoRA with Unsloth**.
23
 
24
+ It is designed to improve the model’s ability to generate **structured outputs** such as:
25
 
26
+ - JSON
27
+ - YAML
28
+ - XML
29
+ - CSV
30
+ - other machine-readable formats
31
 
32
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
+ ## What This Repository Contains
35
 
36
+ **Important**
37
 
38
+ This repository contains **LoRA adapter weights only**.
39
+ It does **not** include the base model.
40
 
41
+ To use this adapter, you must load it on top of the original base model:
42
 
43
+ ```
44
+ unsloth/Qwen3-4B-Instruct-2507
45
+ ```
46
 
47
+ ---
48
 
49
  ## Training Details
50
 
51
+ ### Training Phase
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
+ This adapter was trained as **Phase 1** using the following datasets:
54
 
55
+ - `u-10bei/structured_data_with_cot_dataset_512_v2`
56
+ - `u-10bei/structured_data_with_cot_dataset_512_v4`
57
+ - `u-10bei/structured_data_with_cot_dataset_512_v5`
58
 
59
+ Further training (Phase 2) may be performed later using additional datasets.
60
 
61
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
+ ### Training Method
64
 
65
+ - Method: **QLoRA (4-bit)**
66
+ - Framework: **Unsloth + PEFT**
67
+ - Base model: `unsloth/Qwen3-4B-Instruct-2507`
68
+ - Maximum sequence length: 1024
69
+ - Loss applied only to final assistant output
70
+ - Intermediate Chain-of-Thought reasoning is masked
71
 
72
+ ---
73
 
74
+ ### Hyperparameters (Phase 1)
 
 
 
 
75
 
76
+ - LoRA rank (r): 64
77
+ - LoRA alpha: 128
78
+ - Learning rate: 1e-4
79
+ - Epochs: 1
80
+ - Batch size: 2
81
+ - Gradient accumulation: 8
82
 
83
+ ---
84
 
85
+ ## How to Use
86
 
87
+ Example Python code to load and use this adapter:
88
 
89
+ ```python
90
+ from transformers import AutoModelForCausalLM, AutoTokenizer
91
+ from peft import PeftModel
92
+ import torch
93
 
94
+ base_model = "unsloth/Qwen3-4B-Instruct-2507"
95
+ adapter = "cinnamonrooo/qwen3-structeval-phase1"
96
 
97
+ tokenizer = AutoTokenizer.from_pretrained(base_model)
98
 
99
+ model = AutoModelForCausalLM.from_pretrained(
100
+ base_model,
101
+ torch_dtype=torch.float16,
102
+ device_map="auto",
103
+ )
104
 
105
+ model = PeftModel.from_pretrained(model, adapter)
106
 
107
+ prompt = "Convert the following text into JSON format:\nName: John\nAge: 25"
108
 
109
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
110
+ outputs = model.generate(**inputs, max_new_tokens=200)
111
 
112
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
113
+ ```
114
 
115
+ ---
116
 
117
+ ## License and Terms
118
 
119
+ - Training datasets: MIT License
120
+ - Base model: subject to original model license
121
+ - This adapter follows **Apache 2.0 License**
122
 
123
+ Users must comply with both:
124
 
125
+ 1. The dataset license
126
+ 2. The original base model terms
127
 
128
+ ---
129
 
130
+ ## Notes
131
 
132
+ - This adapter is optimized for **structured generation tasks**
133
+ - It may not improve general conversational performance
134
+ - Designed primarily for format-following and machine-readable output accuracy
135
 
136
+ ---
137
 
138
+ ### Future Plans
139
 
140
+ - Additional training with more datasets (Phase 2)
141
+ - Evaluation on structured output benchmarks
142
+ - Possible quantized release versions
143
 
144
+ ---
 
145
 
146
+ If you have any questions or feedback, feel free to open an issue.