xenova / transformers.js

State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly in your browser, with no need for a server!
https://huggingface.co/docs/transformers.js
Apache License 2.0
9.81k stars 578 forks source link

Add support for FastViT #749

Closed xenova closed 1 month ago

xenova commented 1 month ago

Example usage:

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

// Create an image classification pipeline
const classifier = await pipeline('image-classification', 'Xenova/fastvit_t12.apple_in1k', {
  quantized: false
});

// Classify an image
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
const output = await classifier(url, { topk: 5 });
console.log(output);
// [
//   { label: 'tiger, Panthera tigris', score: 0.6649345755577087 },
//   { label: 'tiger cat', score: 0.12454754114151001 },
//   { label: 'lynx, catamount', score: 0.0010689536575227976 },
//   { label: 'dhole, Cuon alpinus', score: 0.0010422508930787444 },
//   { label: 'silky terrier, Sydney silky', score: 0.0009548701345920563 }
// ]

List of supported models: https://huggingface.co/models?pipeline_tag=image-classification&library=transformers.js&other=fastvit&sort=trending

HuggingFaceDocBuilderDev commented 1 month ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.