Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
library_name: "transformers.js"
|
4 |
+
base_model: Felladrin/TinyMistral-248M-SFT-v4
|
5 |
+
---
|
6 |
+
|
7 |
+
INT8 ONNX version of [Felladrin/TinyMistral-248M-SFT-v4](https://huggingface.co/Felladrin/TinyMistral-248M-SFT-v4) to use with [Transformers.js](https://huggingface.co/docs/transformers.js).
|
8 |
+
|
9 |
+
## Usage
|
10 |
+
|
11 |
+
```js
|
12 |
+
import { pipeline } from '@xenova/transformers';
|
13 |
+
|
14 |
+
const prompt = `<|im_start|>user
|
15 |
+
Question: What is a dog?<|im_end|>
|
16 |
+
<|im_start|>assistant
|
17 |
+
A dog is a four-legged, domesticated animal that is a member of the class Mammalia, which includes all mammals. Dogs are known for their loyalty, playfulness, and ability to be trained for various tasks. They are also used for hunting, herding, and as service animals.<|im_end|>
|
18 |
+
<|im_start|>user
|
19 |
+
Question: What is the capital of France?<|im_end|>
|
20 |
+
<|im_start|>assistant
|
21 |
+
The capital of France is Paris. Paris is located in the north-central region of France and is known for its famous landmarks, such as the Eiffel Tower, the Louvre Museum, and Notre-Dame Cathedral.<|im_end|>
|
22 |
+
<|im_start|>user
|
23 |
+
Question: What is the color of an apple?<|im_end|>
|
24 |
+
<|im_start|>assistant`;
|
25 |
+
const generator = await pipeline('text-generation', 'Felladrin/onnx-TinyMistral-248M-SFT-v4', { quantized: false });
|
26 |
+
const output = await generator(prompt, { max_new_tokens: 100, penalty_alpha: 0.5, top_k: 5 });
|
27 |
+
console.log(output[0].generated_text); // "The color of a apple is reddish-brown, with a creamy, floral texture that combines the bright and vibrant colors of the apples and oranges. It is a popular dessert in many countries, and is often associated with festive gatherings and celebrations.<|im_end|>"
|
28 |
+
```
|