transformers.ts
v1.0.2
Published
Typescript wrapper for @xenova/transformers
Downloads
17
Maintainers
Readme
transformers.ts
Typescript wrapper for @xenova/transformers.
Works in both commonjs and ESM module projects.
Supported Tasks
For all task, the model name can be optionally specified in the input object.
More tasks and models will be typed over time.
text-classification (alias: sentiment-analysis)
Input Type: { text: string }
Output Type: Array<{ label: TextClassificationLabel, score: number }>
type TextClassificationLabel =
// Xenova/distilbert-base-uncased-finetuned-sst-2-english
| 'POSITIVE'
| 'NEGATIVE'
// Xenova/bert-base-multilingual-uncased-sentiment
| '5 stars'
| '4 stars'
| '3 stars'
| '2 stars'
| '1 star'
// Xenova/toxic-bert
| 'toxic'
| 'insult'
| 'obscene'
| 'identity_hate'
| 'threat'
| 'severe_toxic'
zero-shot-classification
Input Type: { text: string, labels: string[] }
Output Type: Array<{ label: string, score: number }>
License
This project is licensed with BSD-2-Clause
This is free, libre, and open-source software. It comes down to four essential freedoms [ref]:
- The freedom to run the program as you wish, for any purpose
- The freedom to study how the program works, and change it so it does your computing as you wish
- The freedom to redistribute copies so you can help others
- The freedom to distribute copies of your modified versions to others