https://huggingface.co/sshleifer/distilbart-cnn-6-6 with ONNX weights to be compatible with Transformers.js.
If you haven't already, you can install the Transformers.js JavaScript library from NPM using:
npm i @huggingface/transformers
Example: Summarization.
import { pipeline } from '@huggingface/transformers';
const generator = await pipeline('summarization', 'Xenova/distilbart-cnn-6-6');
const text = 'The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, ' +
'and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. ' +
'During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest ' +
'man-made structure in the world, a title it held for 41 years until the Chrysler Building in New ' +
'York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to ' +
'the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the ' +
'Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second ' +
'tallest free-standing structure in France after the Millau Viaduct.';
const output = await generator(text, {
max_new_tokens: 100,
});
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 and structuring your repo like this one (with ONNX weights located in a subfolder named onnx).
onnx/decoder_model_merged.onnx 614 MBonnx/decoder_model.onnx 614 MBonnx/decoder_with_past_model.onnx 563 MBonnx/encoder_model.onnx 513 MBonnx/decoder_model_merged_fp16.onnx 307 MBonnx/decoder_model_fp16.onnx 307 MBonnx/decoder_with_past_model_fp16.onnx 282 MBonnx/decoder_model_merged_q4.onnx 274 MBonnx/decoder_model_q4.onnx 274 MBonnx/decoder_model_merged_bnb4.onnx 268 MBonnx/decoder_model_bnb4.onnx 267 MBonnx/decoder_with_past_model_q4.onnx 266 MBonnx/decoder_with_past_model_bnb4.onnx 260 MBonnx/encoder_model_q4.onnx 258 MBonnx/encoder_model_fp16.onnx 256 MBonnx/encoder_model_bnb4.onnx 253 MBonnx/decoder_model_merged_q4f16.onnx 163 MBonnx/decoder_model_q4f16.onnx 162 MBonnx/decoder_model_merged_quantized.onnx 155 MBonnx/decoder_with_past_model_q4f16.onnx 155 MBonnx/decoder_model_quantized.onnx 155 MBonnx/decoder_model_merged_uint8.onnx 155 MBonnx/decoder_model_merged_int8.onnx 155 MBonnx/decoder_model_uint8.onnx 154 MBonnx/decoder_model_int8.onnx 154 MBonnx/encoder_model_q4f16.onnx 148 MBonnx/decoder_with_past_model_quantized.onnx 142 MBonnx/decoder_with_past_model_uint8.onnx 141 MBonnx/decoder_with_past_model_int8.onnx 141 MBonnx/encoder_model_quantized.onnx 129 MBonnx/encoder_model_uint8.onnx 129 MBonnx/encoder_model_int8.onnx 129 MBsshleifer/distilbart-cnn-6-6