Downloads · 30 days
258
2% of all-time downloads
Xenova/Phi-3-mini-4k-instruct_fp16
Phi-3-mini-4k-instruct_fp16 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
258
2% of all-time downloads
All-time downloads
14.4K
Public
Repo size
9 GB
Likes
5
Public
Click a slice to open those files.
.onnx_data1.5 GB · 63%
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_fp16",
);
// 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);