Xenova HF staff commited on
Commit
2d0bffc
·
verified ·
1 Parent(s): 0a33e69

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -0
README.md CHANGED
@@ -13,4 +13,33 @@ language:
13
 
14
  https://huggingface.co/kyutai/helium-1-preview-2b with ONNX weights to be compatible with Transformers.js.
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).
 
13
 
14
  https://huggingface.co/kyutai/helium-1-preview-2b with ONNX weights to be compatible with Transformers.js.
15
 
16
+
17
+ ## Usage (Transformers.js)
18
+
19
+ 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:
20
+ ```bash
21
+ npm i @huggingface/transformers
22
+ ```
23
+
24
+ **Example:** Text-generation w/ `onnx-community/helium-1-preview-2b-ONNX`
25
+ ```js
26
+ import { pipeline } from "@huggingface/transformers";
27
+
28
+ // Create a text generation pipeline
29
+ const generator = await pipeline(
30
+ "text-generation",
31
+ "onnx-community/helium-1-preview-2b-ONNX",
32
+ { dtype: "q4" },
33
+ );
34
+
35
+ // Define the prompt
36
+ const text = "Hello, today is a great day to";
37
+
38
+ // Generate a response
39
+ const output = await generator(text, { max_new_tokens: 128 });
40
+ console.log(output[0].generated_text);
41
+ ```
42
+
43
+ ---
44
+
45
  Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).