Downloads · 30 days
428
2% of all-time downloads
Xenova/Phi-3-mini-4k-instruct
Phi-3-mini-4k-instruct is a text generation model from Xenova. Use it when you need the model to write or continue text. It is set up for transformers.js. The card lists the license as mit.
This is the same models as the official phi3 onnx model with a few changes to make it work for onnxruntime-web:
Downloads · 30 days
428
2% of all-time downloads
All-time downloads
18.4K
Public
Repo size
9 GB
Likes
22
Public
Click a slice to open those files.
.onnx_data1.7 GB · 61%
From the Hugging Face model README
This is the same models as the official phi3 onnx model with a few changes to make it work for onnxruntime-web:
If you haven't already, you can install the Transformers.js JavaScript library from NPM using:
npm i @huggingface/transformers
You can then use the model to generate text like this:
import { pipeline, TextStreamer } from "@huggingface/transformers";
// Create a text generation pipeline
const generator = await pipeline(
"text-generation",
"Xenova/Phi-3-mini-4k-instruct",
);
// Define the list of messages
const messages = [
{ role: "user", content: "Solve the equation: x^2 - 3x + 2 = 0" },
];
// Create text streamer
const streamer = new TextStreamer(generator.tokenizer, {
skip_prompt: true,
// callback_function: (text) => { }, // Optional callback function
})
// Generate a response
const output = await generator(messages, { max_new_tokens: 512, do_sample: false, streamer });
console.log(output[0].generated_text.at(-1).content);