https://huggingface.co./declare-lab/flan-alpaca-base with ONNX weights to be compatible with Transformers.js.

Usage (Transformers.js)

If you haven't already, you can install the Transformers.js JavaScript library from NPM using:

npm i @xenova/transformers

You can then use the model to generate text like this:

import { pipeline } from "@xenova/transformers";

// Create a text2text-generation pipeline
const generator = await pipeline('text2text-generation', 'Xenova/flan-alpaca-base');

// Generate text
const output = await generator('What is Python?', { max_length: 128, do_sample: true, top_k: 10, });
console.log(output);
// [{ generated_text: 'Python is a programming language used in many applications, such as machine learning, database management, and graphical application development. It is a multi-functional language which works across various data sets and platforms.' }]

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).

Downloads last month
29
Inference Examples
Inference API (serverless) does not yet support transformers.js models for this pipeline type.

Model tree for Xenova/flan-alpaca-base

Quantized
(2)
this model