Xenova HF Staff commited on
Commit
2c6b851
·
verified ·
1 Parent(s): 7bc43f0

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +379 -0
README.md ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ language:
4
+ - en
5
+ base_model:
6
+ - nvidia/OpenReasoning-Nemotron-1.5B
7
+ pipeline_tag: text-generation
8
+ library_name: transformers.js
9
+ tags:
10
+ - nvidia
11
+ - code
12
+ ---
13
+
14
+ # OpenReasoning-Nemotron-1.5B Overview
15
+
16
+ ## Usage (Transformers.js)
17
+
18
+ If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@huggingface/transformers) using:
19
+ ```bash
20
+ npm i @huggingface/transformers
21
+ ```
22
+
23
+ You can then generate text as follows:
24
+ ```js
25
+ import { pipeline, TextStreamer } from "@huggingface/transformers";
26
+
27
+ // Create a text generation pipeline
28
+ const generator = await pipeline(
29
+ "text-generation",
30
+ "onnx-community/OpenReasoning-Nemotron-1.5B-ONNX",
31
+ { dtype: "q4", device: "webgpu" },
32
+ );
33
+
34
+ // Define the list of messages
35
+ const prompt = "x^2 + 2x - 8 = 0";
36
+ const messages = [
37
+ { role: "user", content: `Solve the following math problem. Make sure to put the answer (and only answer) inside \\boxed{}.\n\n${prompt}` },
38
+ ];
39
+
40
+ // Generate a response
41
+ const output = await generator(messages, {
42
+ max_new_tokens: 4096,
43
+ streamer: new TextStreamer(generator.tokenizer, { skip_prompt: true, skip_special_tokens: true}),
44
+ });
45
+ console.log(output[0].generated_text.at(-1).content);
46
+ ```
47
+
48
+ <details>
49
+
50
+ <summary>See example output</summary>
51
+
52
+ ```
53
+ <think>
54
+ I have this equation: \( x^2 + 2x - 8 = 0 \). It's a quadratic equation, and I need to solve for x. The general form is \( ax^2 + bx + c = 0 \), so here a = 1, b = 2, c = -8.
55
+
56
+ I can use the quadratic formula: \( x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \).
57
+
58
+ Plugging in the values: b = 2, so -b = -2; c = -8, so -4ac = -4(1)(-8) = 32.
59
+
60
+ The discriminant D = b^2 - 4ac = (2)^2 - 4(1)(-8) = 4 + 32 = 36.
61
+
62
+ Since D is positive, there are two real solutions.
63
+
64
+ x = [-b ± sqrt(D)] / (2a) = [-2 ± sqrt(36)] / 2 = [-2 ± 6]/2.
65
+
66
+ Now, two cases:
67
+
68
+ First, with +: (-2 + 6)/2 = 4/2 = 2.
69
+
70
+ Second, with -: (-2 - 6)/2 = (-8)/2 = -4.
71
+
72
+ So, x = 2 or x = -4.
73
+
74
+ I could also factor this. Since it's (x^2 + 2x - 8) = 0.
75
+
76
+ I need two numbers that multiply to -8 and add to 2. 4 and -2: 4 * -2 = -8, 4 + (-2) = 2. Yes, so (x + 4)(x - 2) = 0? Let me check.
77
+
78
+ (x + 4)(x - 2) = x^2 - 2x + 4x - 8 = x^2 + 2x - 8. Yes, perfect.
79
+
80
+ So, (x + 4)(x - 2) = 0, so x = -4 or x = 2.
81
+
82
+ Same as before.
83
+
84
+ The problem says "solve the following math problem" and gives the equation, but it has an equal sign, so it's an equation to solve.
85
+
86
+ But in the text, it says "x^2 + 2x - 8 = 0", so it's clear.
87
+
88
+ Now, it says "make sure to put the answer (and only answer) inside \boxed{}."
89
+
90
+ So, I need to present the answer. Since there are two solutions, I should box both.
91
+
92
+ But typically, we might write x = 2 or x = -4.
93
+
94
+ Since it's an equation, the solution set is {-4, 2}.
95
+
96
+ But I think for the box, I should write the values.
97
+
98
+ Looking back at the problem, it says "x^2 + 2x - 8 = 0", and it's written with the equal sign, so it's an equation.
99
+
100
+ But in the instruction, it says "solve", so I need to find x.
101
+
102
+ Perhaps I should write the solutions.
103
+
104
+ Maybe they want the answer as a pair or something.
105
+
106
+ Another thought: sometimes in multiple choice, but here it's not multiple choice.
107
+
108
+ The problem is given as is, so I think I need to provide the solutions.
109
+
110
+ Perhaps I can write x = 2 or x = -4.
111
+
112
+ But for the box, I need to put only the answer.
113
+
114
+ Maybe list the values.
115
+
116
+ I recall that in some contexts, they might expect the answer in a specific format.
117
+
118
+ Since it's a quadratic, and I solved it, I think it's fine.
119
+
120
+ But let me see the equation again: "x^2 + 2x - 8 = 0"
121
+
122
+ And it has the equal sign, so it's clear.
123
+
124
+ Perhaps I should write the answer as x = -4 or x = 2.
125
+
126
+ But for the box, I need to put it neatly.
127
+
128
+ Since it's "only answer", perhaps I should write the values.
129
+
130
+ Another idea: sometimes they write the solution set.
131
+
132
+ But I think for this, it's straightforward.
133
+
134
+ I can write the answer as 2 and -4.
135
+
136
+ But let me confirm if I did it right.
137
+
138
+ x^2 + 2x - 8 = 0
139
+
140
+ At x=2: 4 + 4 - 8 = 0, yes.
141
+
142
+ x=-4: 16 - 8 - 8 = 16 - 16 = 0, yes.
143
+
144
+ So correct.
145
+
146
+ Now, for the box, I think I should write the solutions.
147
+
148
+ Perhaps they want the answer in a box, so I'll write x = -4 \text{ or } x = 2.
149
+
150
+ But the instruction says "only answer", so maybe just the values.
151
+
152
+ I think it's fine.
153
+
154
+ Since it's a math problem, and I need to box the final answer.
155
+
156
+ I recall that in some platforms, they might expect the answer as a set or something.
157
+
158
+ But I think for simplicity, I'll write the solutions.
159
+
160
+ Perhaps I can write "x = -4 or x = 2".
161
+
162
+ But let me see the format.
163
+
164
+ Another thought: the equation is written with the equal sign, so it's an equation, and I solved it.
165
+
166
+ But in the answer, I need to present x.
167
+
168
+ I think I'm overcomplicating.
169
+
170
+ I'll box the values.
171
+
172
+ So, the solutions are x = -4 and x = 2.
173
+
174
+ So, for the box, I'll put -4 and 2.
175
+
176
+ But to be clear, I can write "x = -4 \text{ or } x = 2".
177
+
178
+ But since it says "only answer", perhaps just the numbers.
179
+
180
+ I think it's acceptable.
181
+
182
+ I can write the solution set: \{-4, 2\}.
183
+
184
+ But that might be too formal.
185
+
186
+ In many contexts, they just list the values.
187
+
188
+ Since it's a quadratic, and I found the roots.
189
+
190
+ I think I'll go with x = -4 or x = 2.
191
+
192
+ But for the box, I need to put it inside.
193
+
194
+ Perhaps the problem expects me to write the answer as per the equation.
195
+
196
+ Another idea: maybe they want the answer in a specific order, like ascending order.
197
+
198
+ So, -4 and 2.
199
+
200
+ So, I'll write -4 and 2.
201
+
202
+ But to be precise, I'll include the variable.
203
+
204
+ I think for the box, I'll put the values.
205
+
206
+ Let me see similar problems.
207
+
208
+ I recall that in some cases, they write "x = \text{value}".
209
+
210
+ But here, since there are two, I need to specify.
211
+
212
+ Perhaps I can write "x = -4 \text{ or } x = 2".
213
+
214
+ But for the box, I'll put that.
215
+
216
+ The instruction says "put the answer (and only answer) inside \boxed{}", so I think I should put the solution.
217
+
218
+ Perhaps they expect the answer as a number, but there are two.
219
+
220
+ Unless I made a mistake.
221
+
222
+ The equation is x^2 + 2x - 8 = 0, which is correct.
223
+
224
+ Maybe it's part of a larger problem, but no, it's given as is.
225
+
226
+ Perhaps I need to solve for x, and the answer is the values.
227
+
228
+ I think I'm fine.
229
+
230
+ So, I'll box the solutions.
231
+
232
+ So, the answer is x = -4 or x = 2.
233
+
234
+ For the box, I'll write \boxed{-4} and \boxed{2}, but that might be for separate boxes, but it's one answer.
235
+
236
+ I think it's better to write it as a pair or something.
237
+
238
+ I can write "x = -4 \text{ and } x = 2" but "and" might imply both, but it's or.
239
+
240
+ In math, it's clear.
241
+
242
+ To avoid confusion, I'll write the solution set.
243
+
244
+ So, \boxed{\{-4, 2\}}.
245
+
246
+ That might be acceptable.
247
+
248
+ Since it's an equation, the solution is the set of x that satisfy it.
249
+
250
+ I think that's fine.
251
+
252
+ Some people write "x = -4 or x = 2".
253
+
254
+ But for the box, I'll put the set.
255
+
256
+ I recall that in some textbooks, they list the values.
257
+
258
+ I think I'll do \boxed{-4} and \boxed{2}, but that's two boxes, but the instruction says "inside \boxed{}", singular, so one box.
259
+
260
+ So, I need one box.
261
+
262
+ So, \boxed{\text{ } -4 \text{ and } 2 \text{ }} or something.
263
+
264
+ To be neat, I'll write \boxed{-4, 2}.
265
+
266
+ But it might not be clear.
267
+
268
+ I can write "x = -4 \text{ or } x = 2" inside the box.
269
+
270
+ But that might be messy.
271
+
272
+ Another idea: since it's a quadratic, and I solved it, I can just state the roots.
273
+
274
+ I think for this context, it's okay.
275
+
276
+ Perhaps the problem is to find x, and I have it.
277
+
278
+ I'll go with \boxed{-4} and \boxed{2}, but since it's one answer, I'll put both in one box.
279
+
280
+ So, \boxed{-4 \text{ and } 2}.
281
+
282
+ To make it look better, \boxed{2,\ -4}.
283
+
284
+ But I think it's fine.
285
+
286
+ I recall that in the quadratic formula, I got x = [-2 ± 6]/2, which is 4/2=2 and -8/2=-4, so the values are 2 and -4.
287
+
288
+ So, I'll box 2 and -4.
289
+
290
+ But to specify, I'll write the solutions.
291
+
292
+ I think I'm ready.
293
+
294
+ So, the answer is x = -4 or x = 2.
295
+
296
+ For the box, I'll put \boxed{-4} and \boxed{2}, but that's two boxes.
297
+
298
+ The instruction says "inside \boxed{}", so one box.
299
+
300
+ So, I'll write \boxed{\text{ } -4 \text{ and } 2 \text{ }}.
301
+
302
+ To save space, \boxed{-4, 2}.
303
+
304
+ I think that's acceptable.
305
+
306
+ Some platforms use that.
307
+
308
+ So, I'll do that.
309
+
310
+ But let me confirm the equation once more.
311
+
312
+ x^2 + 2x - 8 = 0.
313
+
314
+ Multiply both sides by 4 to make it easier, but no need.
315
+
316
+ Or, complete the square.
317
+
318
+ x^2 + 2x = 8, then (x+1)^2 -1 =8, so (x+1)^2 =9, so x+1 = ±3, so x=2 or x=-4. Same thing.
319
+
320
+ So, no issue.
321
+
322
+ Therefore, the solutions are x = -4 and x = 2.
323
+
324
+ So, for the box, I'll put \boxed{-4} and \boxed{2}, but since it's one answer, I'll put both in one box.
325
+
326
+ Perhaps \boxed{2,\ -4}.
327
+
328
+ I think it's fine.
329
+
330
+ I'll write the answer as -4 and 2.
331
+
332
+ So, \boxed{-4 \text{ and } 2}
333
+
334
+ But to be precise, I'll use the set notation.
335
+
336
+ I think for this level, it's okay.
337
+
338
+ Another thought: the problem says "solve", and in some contexts, they might expect the answer as a number, but here there are two, so I need to include both.
339
+
340
+ Perhaps they want the product or sum, but no, it says solve the equation.
341
+
342
+ So, I think I'm good.
343
+
344
+ I'll go with \boxed{-4} and \boxed{2}, but since it's one box, I'll write \boxed{2,\ -4}.
345
+
346
+ Yes.
347
+
348
+ So, the final answer is 2 and -4.
349
+
350
+ To match the format, I'll put it as such.
351
+ </think>
352
+ The equation to solve is \(x^2 + 2x - 8 = 0\).
353
+
354
+ This is a quadratic equation in the form \(ax^2 + bx + c = 0\), where \(a = 1\), \(b = 2\), and \(c = -8\).
355
+
356
+ The solutions are found using the quadratic formula:
357
+ \[
358
+ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
359
+ \]
360
+
361
+ Substitute the values:
362
+ \[
363
+ x = \frac{-2 \pm \sqrt{2^2 - 4(1)(-8)}}{2(1)} = \frac{-2 \pm \sqrt{4 + 32}}{2} = \frac{-2 \pm \sqrt{36}}{2} = \frac{-2 \pm 6}{2}
364
+ \]
365
+
366
+ This gives two solutions:
367
+ - \(x = \frac{-2 + 6}{2} = \frac{4}{2} = 2\)
368
+ - \(x = \frac{-2 - 6}{2} = \frac{-8}{2} = -4\)
369
+
370
+ Thus, the solutions are \(x = -4\) and \(x = 2\).
371
+
372
+ The answer is presented as the values of \(x\) that satisfy the equation.
373
+
374
+ \boxed{-4,\ 2}
375
+
376
+ ```
377
+
378
+ </details>
379
+