eduardoworrel commited on
Commit
d1fe955
·
verified ·
1 Parent(s): 85fa4c6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -3
README.md CHANGED
@@ -1,3 +1,35 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - HuggingFaceTB/SmolLM2-360M-Instruct
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - transformers.js
8
+ ---
9
+
10
+ ## Usage (Transformers.js)
11
+
12
+ 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:
13
+ ```bash
14
+ npm i @huggingface/transformers
15
+ ```
16
+
17
+ You can then generate text as follows:
18
+ ```js
19
+ import { pipeline } from '@huggingface/transformers';
20
+
21
+ // Create a text generation pipeline
22
+ const generator = await pipeline('text-generation', 'eduardoworrel/SmolLM2-360M-Instruct', {
23
+ device: 'webgpu', // <- Run on WebGPU
24
+ });
25
+
26
+ // Define the list of messages
27
+ const messages = [
28
+ { role: "system", content: "You are a helpful assistant." },
29
+ { role: "user", content: "What is the capital of Brazil?" },
30
+ ];
31
+
32
+ // Generate a response
33
+ const output = await generator(messages, { max_new_tokens: 128 });
34
+ console.log(output[0].generated_text.at(-1).content);
35
+ ```