Views
No views yet
Qwen/Qwen3-4B-Instruct-2507leaf0788/structeval-loraadapter_model.safetensors : LoRA weightsadapter_config.json : LoRA config (PEFT)tokenizer.json, tokenizer_config.json, vocab.json, merges.txt : tokenizer fileschat_template.jinja : chat template (if used)Note: This repository contains LoRA adapter weights only. You must download the base model (Qwen/Qwen3-4B-Instruct-2507) separately.
transformers (Qwen3対応の版)pefttorch1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3from peft import PeftModel
4
5BASE_MODEL = "Qwen/Qwen3-4B-Instruct-2507"
6ADAPTER_REPO = "leaf0788/structeval-lora"
7
8tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, trust_remote_code=True)
9
10
11base = AutoModelForCausalLM.from_pretrained(
12 BASE_MODEL,
13 torch_dtype=torch.float16,
14 device_map="auto",
15 trust_remote_code=True,
16)
17
18model = PeftModel.from_pretrained(base, ADAPTER_REPO).eval()
19
20# quick test
21prompt = 'Please output JSON code.\n\nTask: Return a JSON with a single key "hello" and value "world".'
22inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
23
24with torch.no_grad():
25 out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
26
27print(tokenizer.decode(out[0], skip_special_tokens=True))
28
29
30
31
32
33## Model Details
34
35### Model Description
36
37<!-- Provide a longer summary of what this model is. -->
38
39This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
40
41- **Developed by:** [More Information Needed]
42- **Funded by [optional]:** [More Information Needed]
43- **Shared by [optional]:** [More Information Needed]
44- **Model type:** [More Information Needed]
45- **Language(s) (NLP):** [More Information Needed]
46- **License:** [More Information Needed]
47- **Finetuned from model [optional]:** [More Information Needed]
48
49### Model Sources [optional]
50
51<!-- Provide the basic links for the model. -->
52
53- **Repository:** [More Information Needed]
54- **Paper [optional]:** [More Information Needed]
55- **Demo [optional]:** [More Information Needed]
56
57## Uses
58
59<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
60
61### Direct Use
62
63<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
64
65[More Information Needed]
66
67### Downstream Use [optional]
68
69<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
70
71[More Information Needed]
72
73### Out-of-Scope Use
74
75<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
76
77[More Information Needed]
78
79## Bias, Risks, and Limitations
80
81<!-- This section is meant to convey both technical and sociotechnical limitations. -->
82
83[More Information Needed]
84
85### Recommendations
86
87<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
88
89Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
90
91## How to Get Started with the Model
92
93Use the code below to get started with the model.
94
95[More Information Needed]
96
97## Training Details
98
99### Training Data
100
101<!-- 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. -->
102
103[More Information Needed]
104
105### Training Procedure
106
107<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
108
109#### Preprocessing [optional]
110
111[More Information Needed]
112
113
114#### Training Hyperparameters
115
116- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
117
118#### Speeds, Sizes, Times [optional]
119
120<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
121
122[More Information Needed]
123
124## Evaluation
125
126<!-- This section describes the evaluation protocols and provides the results. -->
127
128### Testing Data, Factors & Metrics
129
130#### Testing Data
131
132<!-- This should link to a Dataset Card if possible. -->
133
134[More Information Needed]
135
136#### Factors
137
138<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
139
140[More Information Needed]
141
142#### Metrics
143
144<!-- These are the evaluation metrics being used, ideally with a description of why. -->
145
146[More Information Needed]
147
148### Results
149
150[More Information Needed]
151
152#### Summary
153
154
155
156## Model Examination [optional]
157
158<!-- Relevant interpretability work for the model goes here -->
159
160[More Information Needed]
161
162## Environmental Impact
163
164<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
165
166Carbon 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).
167
168- **Hardware Type:** [More Information Needed]
169- **Hours used:** [More Information Needed]
170- **Cloud Provider:** [More Information Needed]
171- **Compute Region:** [More Information Needed]
172- **Carbon Emitted:** [More Information Needed]
173
174## Technical Specifications [optional]
175
176### Model Architecture and Objective
177
178[More Information Needed]
179
180### Compute Infrastructure
181
182[More Information Needed]
183
184#### Hardware
185
186[More Information Needed]
187
188#### Software
189
190[More Information Needed]
191
192## Citation [optional]
193
194<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
195
196**BibTeX:**
197
198[More Information Needed]
199
200**APA:**
201
202[More Information Needed]
203
204## Glossary [optional]
205
206<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
207
208[More Information Needed]
209
210## More Information [optional]
211
212[More Information Needed]
213
214## Model Card Authors [optional]
215
216[More Information Needed]
217
218## Model Card Contact
219
220[More Information Needed]
221
222## Quick test generation
223```python
224## Quick test generation
225```python
226import torch
227from transformers import AutoTokenizer, AutoModelForCausalLM
228from peft import PeftModel
229
230BASE_MODEL = "Qwen/Qwen3-4B-Instruct-2507"
231ADAPTER_REPO = "leaf0788/structeval-lora"
232
233tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, trust_remote_code=True)
234base = AutoModelForCausalLM.from_pretrained(
235 BASE_MODEL,
236 torch_dtype=torch.float16,
237 device_map="auto",
238 trust_remote_code=True,
239)
240model = PeftModel.from_pretrained(base, ADAPTER_REPO).eval()
241
242prompt = 'Please output JSON code.\n\nTask: Return a JSON with a single key "hello" and value "world".'
243inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
244
245with torch.no_grad():
246 out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
247
248gen = tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
249print(gen)
250