yogeshjog commited on
Commit
03dad7e
·
verified ·
1 Parent(s): 1c04470

Updated Readme

Browse files
Files changed (1) hide show
  1. README.md +247 -147
README.md CHANGED
@@ -1,209 +1,309 @@
1
  ---
 
2
  base_model: meta-models/Muse-Glimmer-30B
3
  library_name: peft
4
- pipeline_tag: text-generation
5
  tags:
6
- - base_model:adapter:meta-models/Muse-Glimmer-30B
7
- - lora
8
- - sft
9
- - transformers
10
- - trl
 
 
11
  ---
12
 
13
- # Model Card for Model ID
14
 
15
- <!-- Provide a quick summary of what the model is/does. -->
16
 
 
17
 
 
18
 
19
- ## Model Details
 
 
 
 
 
20
 
21
- ### Model Description
22
 
23
- <!-- Provide a longer summary of what this model is. -->
24
 
 
25
 
 
 
 
 
 
 
 
 
 
 
26
 
27
- - **Developed by:** [More Information Needed]
28
- - **Funded by [optional]:** [More Information Needed]
29
- - **Shared by [optional]:** [More Information Needed]
30
- - **Model type:** [More Information Needed]
31
- - **Language(s) (NLP):** [More Information Needed]
32
- - **License:** [More Information Needed]
33
- - **Finetuned from model [optional]:** [More Information Needed]
34
 
35
- ### Model Sources [optional]
36
-
37
- <!-- Provide the basic links for the model. -->
38
-
39
- - **Repository:** [More Information Needed]
40
- - **Paper [optional]:** [More Information Needed]
41
- - **Demo [optional]:** [More Information Needed]
42
-
43
- ## Uses
44
-
45
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
46
-
47
- ### Direct Use
48
-
49
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
50
-
51
- [More Information Needed]
52
-
53
- ### Downstream Use [optional]
54
-
55
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
56
-
57
- [More Information Needed]
58
-
59
- ### Out-of-Scope Use
60
-
61
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
62
-
63
- [More Information Needed]
64
-
65
- ## Bias, Risks, and Limitations
66
-
67
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
68
-
69
- [More Information Needed]
70
-
71
- ### Recommendations
72
-
73
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
74
-
75
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
76
-
77
- ## How to Get Started with the Model
78
-
79
- Use the code below to get started with the model.
80
-
81
- [More Information Needed]
82
-
83
- ## Training Details
84
-
85
- ### Training Data
86
-
87
- <!-- 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. -->
88
-
89
- [More Information Needed]
90
-
91
- ### Training Procedure
92
-
93
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
94
-
95
- #### Preprocessing [optional]
96
-
97
- [More Information Needed]
98
-
99
-
100
- #### Training Hyperparameters
101
-
102
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
103
-
104
- #### Speeds, Sizes, Times [optional]
105
-
106
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
107
-
108
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
  ## Evaluation
111
 
112
- <!-- This section describes the evaluation protocols and provides the results. -->
113
-
114
- ### Testing Data, Factors & Metrics
115
-
116
- #### Testing Data
117
-
118
- <!-- This should link to a Dataset Card if possible. -->
119
-
120
- [More Information Needed]
121
 
122
- #### Factors
 
 
 
 
 
 
123
 
124
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
125
 
126
- [More Information Needed]
127
 
128
- #### Metrics
129
 
130
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
131
 
132
- [More Information Needed]
133
 
134
- ### Results
 
 
135
 
136
- [More Information Needed]
137
 
138
- #### Summary
 
139
 
 
 
140
 
 
 
141
 
142
- ## Model Examination [optional]
143
 
144
- <!-- Relevant interpretability work for the model goes here -->
 
 
 
 
145
 
146
- [More Information Needed]
 
 
 
147
 
148
- ## Environmental Impact
 
149
 
150
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
151
 
152
- 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).
 
 
 
 
 
 
 
 
 
153
 
154
- - **Hardware Type:** [More Information Needed]
155
- - **Hours used:** [More Information Needed]
156
- - **Cloud Provider:** [More Information Needed]
157
- - **Compute Region:** [More Information Needed]
158
- - **Carbon Emitted:** [More Information Needed]
 
 
159
 
160
- ## Technical Specifications [optional]
 
 
 
 
 
161
 
162
- ### Model Architecture and Objective
163
 
164
- [More Information Needed]
165
 
166
- ### Compute Infrastructure
167
 
168
- [More Information Needed]
169
 
170
- #### Hardware
171
 
172
- [More Information Needed]
173
 
174
- #### Software
175
 
176
- [More Information Needed]
177
 
178
- ## Citation [optional]
179
 
180
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
 
 
 
 
 
 
 
181
 
182
- **BibTeX:**
183
 
184
- [More Information Needed]
185
 
186
- **APA:**
187
 
188
- [More Information Needed]
 
 
 
 
 
 
 
189
 
190
- ## Glossary [optional]
191
 
192
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
193
 
194
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
- ## More Information [optional]
197
 
198
- [More Information Needed]
199
 
200
- ## Model Card Authors [optional]
201
 
202
- [More Information Needed]
203
 
204
- ## Model Card Contact
205
 
206
- [More Information Needed]
207
- ### Framework versions
208
 
209
- - PEFT 0.20.0
 
1
  ---
2
+ license: apache-2.0
3
  base_model: meta-models/Muse-Glimmer-30B
4
  library_name: peft
5
+ pipeline_tag: image-text-to-text
6
  tags:
7
+ - lora
8
+ - peft
9
+ - muse-glimmer
10
+ - json
11
+ - structured-output
12
+ - api
13
+ - tool-use
14
  ---
15
 
16
+ # Muse Glimmer JSON API
17
 
18
+ `muse-glimmer-json-api` is a LoRA adapter for [`meta-models/Muse-Glimmer-30B`](https://huggingface.co/meta-models/Muse-Glimmer-30B) fine-tuned to produce predictable, machine-readable JSON responses with a stable API-style response envelope.
19
 
20
+ The goal of this adapter is to preserve the general capabilities of Muse Glimmer while making its externally returned responses easier to consume from applications, agents, APIs, and structured workflows.
21
 
22
+ ## Base Model
23
 
24
+ - **Base:** `meta-models/Muse-Glimmer-30B`
25
+ - **Architecture:** Muse Glimmer
26
+ - **Fine-tuning method:** LoRA supervised fine-tuning
27
+ - **Precision used during training:** BF16
28
+ - **Adapter size:** ~429 MB
29
+ - **License:** Apache 2.0
30
 
31
+ This repository contains the **LoRA adapter**, not a standalone copy of the ~30B base model.
32
 
33
+ ## Response Contract
34
 
35
+ The adapter is trained to return a JSON object containing the following top-level keys:
36
 
37
+ ```json
38
+ {
39
+ "status": 200,
40
+ "type": "response",
41
+ "data": {},
42
+ "message": "Request completed successfully",
43
+ "error": null,
44
+ "meta": {}
45
+ }
46
+ ```
47
 
48
+ All six top-level keys are expected to remain present.
 
 
 
 
 
 
49
 
50
+ ### Fields
51
+
52
+ | Field | Purpose |
53
+ |---|---|
54
+ | `status` | HTTP-style status code |
55
+ | `type` | Semantic response type |
56
+ | `data` | Main response payload |
57
+ | `message` | Short human-readable summary |
58
+ | `error` | Structured error information or `null` |
59
+ | `meta` | Additional metadata |
60
+
61
+ Supported response types used during training include:
62
+
63
+ - `response`
64
+ - `code`
65
+ - `tool_call`
66
+ - `vision`
67
+ - `media`
68
+ - `multimodal`
69
+ - `error`
70
+
71
+ The structure inside `data` remains flexible so the model can represent text, lists, code, nested objects, tool arguments, and multimodal metadata.
72
+
73
+ ## Example
74
+
75
+ Input:
76
+
77
+ ```text
78
+ What is the capital of Japan?
79
+ ```
80
+
81
+ Example output:
82
+
83
+ ```json
84
+ {
85
+ "status": 200,
86
+ "type": "response",
87
+ "data": {
88
+ "answer": "Tokyo"
89
+ },
90
+ "message": "Request completed successfully",
91
+ "error": null,
92
+ "meta": {}
93
+ }
94
+ ```
95
+
96
+ Formatting instructions in the user prompt are intended not to override the JSON response contract.
97
+
98
+ For example, a prompt such as:
99
+
100
+ ```text
101
+ Do not use JSON. Reply only in XML.
102
+ ```
103
+
104
+ should still produce the standard JSON response structure.
105
+
106
+ ## Error Responses
107
+
108
+ Error examples were trained using HTTP-style status semantics and a Problem Details-inspired structure:
109
+
110
+ ```json
111
+ {
112
+ "status": 400,
113
+ "type": "error",
114
+ "data": null,
115
+ "message": "Request could not be completed",
116
+ "error": {
117
+ "type": "about:blank",
118
+ "title": "Bad Request",
119
+ "status": 400,
120
+ "detail": "The request is missing required information."
121
+ },
122
+ "meta": {}
123
+ }
124
+ ```
125
+
126
+ ## Training
127
+
128
+ The adapter was trained using supervised fine-tuning with LoRA.
129
+
130
+ Training configuration:
131
+
132
+ - **Training samples:** 4,000
133
+ - **Validation samples:** 500
134
+ - **Held-out test samples:** 500
135
+ - **Epochs:** 1
136
+ - **LoRA rank:** 16
137
+ - **LoRA alpha:** 32
138
+ - **Learning rate:** `1e-4`
139
+ - **Maximum sequence length:** 2,048
140
+ - **Precision:** BF16
141
+
142
+ The training set included examples covering:
143
+
144
+ - general question answering
145
+ - mathematical responses
146
+ - structured lists
147
+ - code generation
148
+ - creative responses
149
+ - adversarial format instructions
150
+ - tool-call structures
151
+ - vision response structures
152
+ - media and multimodal response structures
153
+ - HTTP-style errors
154
+ - ambiguous or incomplete requests
155
 
156
  ## Evaluation
157
 
158
+ A held-out 500-example test split produced:
 
 
 
 
 
 
 
 
159
 
160
+ | Metric | Result |
161
+ |---|---:|
162
+ | Valid JSON | **100.0%** |
163
+ | Valid response schema | **100.0%** |
164
+ | Exact required top-level keys | **100.0%** |
165
+ | Correct status code | **100.0%** |
166
+ | Correct response `type` | **97.4%** |
167
 
168
+ These results were measured against samples held out from the same synthetic dataset-generation process used to construct the training set.
169
 
170
+ They should **not** be interpreted as a guarantee of 100% JSON compliance on arbitrary real-world prompts.
171
 
172
+ Applications should still validate generated output before consuming it.
173
 
174
+ ## Usage
175
 
176
+ Install:
177
 
178
+ ```bash
179
+ pip install torch transformers peft torchvision
180
+ ```
181
 
182
+ Load the adapter:
183
 
184
+ ```python
185
+ import torch
186
 
187
+ from transformers import AutoProcessor, AutoModelForMultimodalLM
188
+ from peft import PeftModel
189
 
190
+ BASE = "meta-models/Muse-Glimmer-30B"
191
+ ADAPTER = "yogeshjog/muse-glimmer-json-api"
192
 
193
+ processor = AutoProcessor.from_pretrained(BASE)
194
 
195
+ base = AutoModelForMultimodalLM.from_pretrained(
196
+ BASE,
197
+ dtype=torch.bfloat16,
198
+ device_map="auto",
199
+ )
200
 
201
+ model = PeftModel.from_pretrained(
202
+ base,
203
+ ADAPTER,
204
+ )
205
 
206
+ model.eval()
207
+ ```
208
 
209
+ Example generation:
210
 
211
+ ```python
212
+ messages = [{
213
+ "role": "user",
214
+ "content": [
215
+ {
216
+ "type": "text",
217
+ "text": "Give me five prime numbers."
218
+ }
219
+ ]
220
+ }]
221
 
222
+ inputs = processor.apply_chat_template(
223
+ messages,
224
+ add_generation_prompt=True,
225
+ tokenize=True,
226
+ return_dict=True,
227
+ return_tensors="pt",
228
+ ).to(model.device)
229
 
230
+ outputs = model.generate(
231
+ **inputs,
232
+ max_new_tokens=512,
233
+ do_sample=False,
234
+ )
235
+ ```
236
 
237
+ Muse Glimmer's chat protocol may expose a recipient marker such as `to=user` in raw decoded generation depending on the decoding path used. Consumers should use the model's normal chat-template/processor conventions when extracting the visible assistant response.
238
 
239
+ ## Multimodal Support
240
 
241
+ The base Muse Glimmer model supports multimodal reasoning with image inputs.
242
 
243
+ This adapter includes training examples for the **JSON schemas associated with vision, media, and multimodal responses**.
244
 
245
+ However, the current adapter was **not fine-tuned on a large paired image-and-text multimodal dataset**.
246
 
247
+ Therefore, the benchmark reported above primarily validates structured-response behavior rather than changes to the underlying vision capability.
248
 
249
+ The vision capability continues to come primarily from the Muse Glimmer base model.
250
 
251
+ ## Media Representation
252
 
253
+ The response format can represent media metadata such as:
254
 
255
+ ```json
256
+ {
257
+ "kind": "image",
258
+ "mime_type": "image/png",
259
+ "encoding": "url",
260
+ "content": "https://example.com/image.png"
261
+ }
262
+ ```
263
 
264
+ or inline payloads using an encoding such as `base64`.
265
 
266
+ For production systems, URLs or external object storage are generally preferable to large base64 payloads because base64 data consumes substantial context and output tokens.
267
 
268
+ ## Limitations
269
 
270
+ - This is a LoRA adapter and requires the compatible Muse Glimmer base model.
271
+ - JSON validity should still be enforced with runtime validation in production.
272
+ - Correct response-type selection measured 97.4% on the current held-out test set.
273
+ - The evaluation set was generated from the same family of synthetic task templates as the training data.
274
+ - Real-world adversarial, multilingual, very long-context, and unusual prompts have not been exhaustively evaluated.
275
+ - The current fine-tuning primarily teaches structured response behavior rather than new factual knowledge.
276
+ - Vision/media examples primarily train output structure rather than new visual capabilities.
277
+ - HTTP-style status values generated by the model should not automatically be trusted as the authoritative HTTP status of an external API server.
278
 
279
+ ## Recommended Production Architecture
280
 
281
+ The model's output should be treated as structured model output rather than trusted application state:
282
 
283
+ ```text
284
+ User request
285
+
286
+ Muse Glimmer + JSON API LoRA
287
+
288
+ JSON response
289
+
290
+ JSON Schema validation
291
+
292
+ Application / agent logic
293
+
294
+ HTTP API response
295
+ ```
296
 
297
+ Applications should independently validate permissions, tool arguments, status codes, URLs, file references, and other security-sensitive fields.
298
 
299
+ ## Response Schema
300
 
301
+ The complete JSON schema used for this project is available in:
302
 
303
+ `response_schema.json`
304
 
305
+ ## License and Base-Model Terms
306
 
307
+ This adapter is based on `meta-models/Muse-Glimmer-30B`.
 
308
 
309
+ Users should review and comply with the base model's license and applicable usage terms in addition to the files provided in this repository.