Update README.md
Browse files
README.md
CHANGED
@@ -1,8 +1,36 @@
|
|
1 |
---
|
2 |
library_name: transformers.js
|
3 |
base_model: tasksource/deberta-base-long-nli
|
|
|
4 |
---
|
5 |
|
6 |
https://huggingface.co/tasksource/deberta-base-long-nli with ONNX weights to be compatible with Transformers.js.
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
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`).
|
|
|
1 |
---
|
2 |
library_name: transformers.js
|
3 |
base_model: tasksource/deberta-base-long-nli
|
4 |
+
pipeline_tag: zero-shot-classification
|
5 |
---
|
6 |
|
7 |
https://huggingface.co/tasksource/deberta-base-long-nli with ONNX weights to be compatible with Transformers.js.
|
8 |
|
9 |
+
## Usage (Transformers.js)
|
10 |
+
|
11 |
+
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:
|
12 |
+
```bash
|
13 |
+
npm i @huggingface/transformers
|
14 |
+
```
|
15 |
+
|
16 |
+
You can then use the model for zero-shot classification as follows:
|
17 |
+
```js
|
18 |
+
import { pipeline } from '@huggingface/transformers';
|
19 |
+
|
20 |
+
// Create a zero-shot classification pipeline
|
21 |
+
const classifier = await pipeline('zero-shot-classification', 'onnx-community/deberta-base-long-nli');
|
22 |
+
|
23 |
+
// Classify input text
|
24 |
+
const text = 'one day I will see the world';
|
25 |
+
const candidate_labels = ['travel', 'cooking', 'dancing'];
|
26 |
+
const output = await classifier(text, candidate_labels);
|
27 |
+
console.log(output);
|
28 |
+
// {
|
29 |
+
// sequence: 'one day I will see the world',
|
30 |
+
// labels: [ 'travel', 'dancing', 'cooking' ],
|
31 |
+
// scores: [ 0.9572489961861119, 0.030494221087573718, 0.012256782726314351 ]
|
32 |
+
// }
|
33 |
+
```
|
34 |
+
---
|
35 |
+
|
36 |
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`).
|