transformers-js
Skill16k starsChanged 3 months agoApache-2.0View on GitHub
Run state-of-the-art machine learning models directly in JavaScript. `@huggingface/transformers` supports text, vision, audio, and multimodal tasks in browsers and Node.js / Bun / Deno, with WebGPU or WASM execution.
- Installs packages
4 other projects use a version of this.
Trending
More talk lately.about the whole repository
Most recently taken up by
- huggingface/skillstheir own version, first seen Oct 1, 2026
- PracticalSwan/agent-skillstheir own version, first seen Sep 14, 2026
- waybarrios/opencode-power-packtheir own version, first seen Aug 17, 2026
- hyf020908/modelscope-skillstheir own version, first seen Mar 23, 2026
Who's talking about huggingface/transformers.js
- A Hacker News story“Transformers.js 3.0 Released with WebGPU Support”Hacker News · Oct 22, 2024 · 33 points
- huggingface/transformers“Export to ExecuTorch”GitHub · Jul 26, 2024 · 5 reactions
- remotion-dev/remotion“Upgrade to Transforers.js 4.4 when it comes out and use session-scoped Transformers.js environment overrides”GitHub · Sep 8, 2026 · 2 reactions
- A Hacker News story“Release 4.0.0 · HuggingFace/Transformers.js”Hacker News · Jun 20, 2026 · 2 points
- A Hacker News story“HuggingFace has just released Transformer.js v4 with WebGPU support”Hacker News · Mar 30, 2026 · 2 points
The biggest 5 of 61 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 61
Talked about on GitHub, Bluesky and Hacker News (61 times).
On GitHub · 50
- Jul 26, 2024Export to ExecuTorch — huggingface/transformers5 reactions · 17 comments
- Sep 8, 2026Upgrade to Transforers.js 4.4 when it comes out and use session-scoped Transformers.js environment overrides — remotion-dev/remotion2 reactions
- Dec 19, 2024adopt modern bert please! — OpenNMT/CTranslate22 reactions · 1 comment
- Oct 28, 2024feat: onnx runtime shared sessions — supabase/edge-runtime2 reactions · 2 comments
- Oct 19, 2026deps(deps): bump the bun-minor-and-patch group across 1 directory with 7 updates — di-framework/ai1 reaction · 3 comments
45 more on GitHub
- Oct 15, 2026chore(deps): Bump the plugin-dependencies group across 1 directory with 8 updates — edwardlthompson/vault-organizer1 reaction · 1 comment
- Oct 14, 2026build(deps): bump the dependencies group with 8 updates — steipete/summarize1 reaction · 4 comments
- Oct 13, 2026deps(deps): bump the bun-minor-and-patch group with 5 updates — di-framework/ai1 reaction · 4 comments
- Oct 9, 2026Bump the npm-minor-and-patch group with 23 updates — chrisatom1998/document-graph-explorer1 reaction · 3 comments
- Sep 21, 2026chore(deps): bump @huggingface/transformers from 4.2.0 to 4.3.0 — code-life-cafe/tools-codelife-cafe1 reaction · 3 comments
- Aug 13, 2026chore(deps): Bump the plugin-dependencies group across 1 directory with 7 updates — edwardlthompson/vault-organizer1 reaction · 2 comments
- Jun 24, 2026Extend the Message format to support tool calling, extended thinking, and multimodality — webmachinelearning/prompt-api1 reaction · 17 comments
- Apr 4, 2026chore(deps-dev): bump @huggingface/transformers from 3.8.1 to 4.0.1 — optave/ops-codegraph-tool1 reaction · 2 comments
- Apr 1, 2026chore(deps): update dependency @huggingface/transformers to v4 — promptfoo/promptfoo1 reaction · 4 comments
- Dec 15, 2025model caching — huberp/text-similarity-transformerjs1 reaction
- Dec 8, 2025chore(deps)(deps): bump @huggingface/transformers from 3.8.0 to 3.8.1 — the-hairtologist/hA.I.r1 reaction · 1 comment
- Apr 18, 2025Support for React Native in huggingface/transformers.js — daviddaytw/react-native-transformers1 reaction · 3 comments
- Jan 28, 2025[Expression of support]: Transformers.js, library for running Hugging Face transformers in the browser — WICG/cross-origin-storage1 reaction · 1 comment
- Jan 18, 2025Migrate examples from main repo — huggingface/transformers.js-examples1 reaction
- Dec 3, 2024[WebGPU] `Kernel "[GroupQueryAttention] /model/layers.0/attn/GroupQueryAttention" failed. Error: Input "key" is expected to have 3, 4, or 5 dimensions".` — microsoft/onnxruntime1 reaction · 29 comments
- Oct 24, 2024LLama 3.2 vision - unable to convert — huggingface/optimum1 reaction
- Nov 3, 2026build(deps): Bump @huggingface/transformers from 4.3.1 to 4.3.2 — rishixgamer/AliveInternet0 reactions
- Nov 3, 2026chore(deps): bump @huggingface/transformers from 4.3.1 to 4.3.2 — Seby2005/Verifact0 reactions · 1 comment
- Nov 3, 2026Bump @huggingface/transformers from 4.3.0 to 4.3.2 in /ai-dev-mcp-server — stonebridgeway/ai-dev-system0 reactions
- Nov 3, 2026fix: bump @huggingface/transformers from 4.3.0 to 4.3.2 — code-life-cafe/tools-codelife-cafe0 reactions · 1 comment
- Nov 3, 2026Bump @huggingface/transformers from 3.8.1 to 4.3.2 in /solutions/shared/subtitles — mguhlin/drawsplat0 reactions · 2 comments
- Nov 3, 2026chore(deps): Bump @huggingface/transformers from 4.3.1 to 4.3.2 in /site — mithudso/llms-explorer0 reactions · 1 comment
- Nov 3, 2026Bump @huggingface/transformers from 3.8.1 to 4.3.2 — diamondrubinny/NexaHeart0 reactions · 1 comment
- Nov 3, 2026Bump @huggingface/transformers from 4.3.1 to 4.3.2 — real-kijmoshi/quanta0 reactions
- Nov 3, 2026Bump @huggingface/transformers from 4.3.1 to 4.3.2 — Marc-Dvci/Silah0 reactions
- Nov 2, 2026chore(deps): bump @huggingface/transformers from 4.3.1 to 4.3.2 — Abillify/atf0 reactions
- Nov 2, 2026chore(deps): bump @huggingface/transformers from 4.3.0 to 4.3.2 — NoahMenezes/Mnemyx0 reactions · 1 comment
- Nov 2, 2026chore(deps-dev): bump @huggingface/transformers from 4.3.1 to 4.3.2 — AnxovatomicaES/githippo0 reactions
- Nov 2, 2026Bump @huggingface/transformers from 3.8.1 to 4.3.2 — EgerDev/cutout0 reactions
- Nov 2, 2026deps: bump @huggingface/transformers from 3.8.1 to 4.3.2 in /mcp-server — Agripp87/memoria_mcp0 reactions
- Nov 2, 2026chore(deps): bump @huggingface/transformers from 4.2.0 to 4.3.2 — LucasDitchun/export-bookmarks-x-twitter0 reactions
- Nov 2, 2026Bump @huggingface/transformers from 3.8.1 to 4.3.2 in /tools/semantic — Ricoo05/ruthless0 reactions
- Nov 2, 2026Onderzoek: vier kosteloze uitbreidingskandidaten voor VIA (november 2026) — OuwePiet/Lumen0 reactions
- Nov 2, 2026chore(deps): bump @huggingface/transformers from 4.2.0 to 4.3.2 — smavgs/super-ii0 reactions
- Nov 2, 2026chore(deps): bump the runtime group across 1 directory with 2 updates — JordanNewell/curtis0 reactions · 4 comments
- Nov 2, 2026chore(deps-dev): bump @huggingface/transformers from 4.3.1 to 4.3.2 — skygoldlee-cyber/passok0 reactions
- Nov 2, 2026fix(deps): bump @huggingface/transformers from 3.8.0 to 4.3.2 — cosmocoder/CodeCritique0 reactions
- Nov 2, 2026chore(deps): bump @huggingface/transformers from 4.3.1 to 4.3.2 in /mcp-server — djmahe4/awesome-free-llm-apis0 reactions
- Nov 1, 2026chore(deps)(deps): bump @huggingface/transformers from 3.8.1 to 4.3.2 — AkshatRaj00/PrXray0 reactions · 4 comments
- Nov 1, 2026chore(deps): bump @huggingface/transformers from 4.3.1 to 4.3.2 — BaiGanio/aperio0 reactions · 1 comment
- Nov 1, 2026build(deps): bump @huggingface/transformers from 4.3.0 to 4.3.2 — techtocore/Grammar-check-SLM0 reactions
- Oct 30, 2026chore(deps): bump @huggingface/transformers from 4.3.0 to 4.3.2 — Seydina-s/bic-gouv-sn0 reactions
- Oct 28, 2026Release watch: 1 new reranker release — sheephess9527/reranker.uk0 reactions · 2 comments
- Oct 8, 2026[Extreme Q4] Android-native inference and Flash-browser execution: runtime comparison — pH34r-pH/long-haul0 reactions
- Oct 4, 2026[Candidate] huggingface/transformers.js/.ai/skills/transformers-js - transformers-js — ProSkillsMD/proskills0 reactions · 1 comment
On Bluesky · 8
- Feb 11, 2025TaDAh! Transformer.js Run #ML models in the browser or Node.js: github.com/huggingface/... Dear #React, #nodejs, #Nextjs people, if you… — @alecrimi.bsky.social2 likes and reposts
- Oct 28, 2024📦 huggingface / transformers.js ⭐ 11,693 (+61) 🗒 JavaScript State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly… — @github-trending-js.bsky.social2 likes and reposts
- Oct 23, 2024📦 huggingface / transformers.js ⭐ 11,473 (+67) 🗒 JavaScript State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly… — @github-trending-js.bsky.social2 likes and reposts
- Mar 31, 2026📦 huggingface / transformers.js ⭐ 15,678 (+35) 🗒 JavaScript State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly… — @github-trending-js.bsky.social1 likes and repost
- Mar 18, 2026https://github.com/huggingface/transformers.js — @tom-doerr.bsky.social1 likes and repost
3 more on Bluesky
- Jul 15, 2025📦 huggingface / transformers.js ⭐ 14,100 (+41) 🗒 JavaScript State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly… — @github-trending-js.bsky.social1 likes and repost
- Nov 13, 2024📦 huggingface / transformers.js ⭐ 12,014 (+49) 🗒 JavaScript State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly… — @github-trending-js.bsky.social1 likes and repost
- Apr 1, 2026Brings Hugging Face-hosted transformer models into JavaScript, so you can run NLP, vision, and audio models in-browser. v4 switches to a… — @aymkdn.bsky.social0 likes and reposts · 1 reply
On Hacker News · 3
- Oct 22, 2024Transformers.js 3.0 Released with WebGPU Support33 points · 1 comment
- Jun 20, 2026Release 4.0.0 · HuggingFace/Transformers.js2 points
- Mar 30, 2026HuggingFace has just released Transformer.js v4 with WebGPU support2 points · 1 comment
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- huggingface/skills★ 11ksame name
- waybarrios/opencode-power-pack★ 531same name
- PracticalSwan/agent-skills★ 18same name
- hyf020908/modelscope-skills★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository3 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .ai/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 2 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 106
Don't suggest a model without verifying this.
- Very specific: line 132
Default is CPU/WASM. Pass device: "webgpu" to run on the GPU when available:
- Very specific: line 172
Every pipeline accepts a progress_callback for download progress plus options controlling device, dtype, and caching.
- Very specific: line 183
Don't reuse a disposed pipeline: Create a new one with pipeline(...) after dispose().
- Distinctive: line 184
Don't recreate pipelines inside hot loops: Create once, call many times.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
transformers.js
ML inference for JavaScript, without a Python server. Supports text, vision, audio,
and multimodal tasks through a single pipeline() entry point.
Install
npm install @huggingface/transformersQuick start
import { pipeline } from "@huggingface/transformers";
const classifier = await pipeline("sentiment-analysis");
const output = await classifier("I love transformers!");
// [{ label: "POSITIVE", score: 0.9998 }]pipeline(task, model?, options?) is the one function you need 90% of the time.
Passing no model uses the default for that task.
Supported tasks
<!-- @generated:start id=task-list -->text-classification(alias:sentiment-analysis) — default model:Xenova/distilbert-base-uncased-finetuned-sst-2-englishtoken-classification(alias:ner) — default model:Xenova/bert-base-multilingual-cased-ner-hrlquestion-answering— default model:Xenova/distilbert-base-cased-distilled-squadfill-mask— default model:onnx-community/ettin-encoder-32m-ONNXsummarization— default model:Xenova/distilbart-cnn-6-6translation— default model:Xenova/t5-smalltext2text-generation— default model:Xenova/flan-t5-smalltext-generation— default model:onnx-community/Qwen3-0.6B-ONNXzero-shot-classification— default model:Xenova/distilbert-base-uncased-mnliaudio-classification— default model:Xenova/wav2vec2-base-superb-kszero-shot-audio-classification— default model:Xenova/clap-htsat-unfusedautomatic-speech-recognition(alias:asr) — default model:Xenova/whisper-tiny.entext-to-audio(alias:text-to-speech) — default model:onnx-community/Supertonic-TTS-ONNXimage-to-text— default model:Xenova/vit-gpt2-image-captioningimage-classification— default model:Xenova/vit-base-patch16-224image-segmentation— default model:Xenova/detr-resnet-50-panopticbackground-removal— default model:Xenova/modnetzero-shot-image-classification— default model:Xenova/clip-vit-base-patch32object-detection— default model:Xenova/detr-resnet-50zero-shot-object-detection— default model:Xenova/owlvit-base-patch32document-question-answering— default model:Xenova/donut-base-finetuned-docvqaimage-to-image— default model:Xenova/swin2SR-classical-sr-x2-64depth-estimation— default model:onnx-community/depth-anything-v2-smallfeature-extraction(alias:embeddings) — default model:onnx-community/all-MiniLM-L6-v2-ONNXimage-feature-extraction— default model:onnx-community/dinov3-vits16-pretrain-lvd1689m-ONNX
<!-- @generated:end id=task-list -->For full recipes — every task, grouped by modality, with runnable code —
see references/TASKS.md.
Choosing a model
Browse models compatible with transformers.js on the Hub: https://huggingface.co/models?library=transformers.js
Filter by task with the pipeline_tag parameter, e.g.
https://huggingface.co/models?library=transformers.js&pipeline_tag=text-generation.
Before recommending a model, confirm it actually has ONNX weights — the library cannot load a model without them. Two ways to check:
- Open the model page on the Hub and look for an
onnx/directory in the "Files and versions" tab. - Programmatically, with
ModelRegistry.get_available_dtypes(modelId)— returns the list of dtypes shipped. An empty array means the model exists but ships no ONNX files. It throws aModelFileNotFoundErrorif the model does not exist or is not accessible (private/gated — the Hub cannot tell these apart), and a regular error on network failures, so an unreachable model is never mistaken for one without ONNX files.
import { ModelRegistry, ModelFileNotFoundError } from "@huggingface/transformers";
// "Xenova/some-model" is a placeholder — substitute the ID you want to check.
try {
const dtypes = await ModelRegistry.get_available_dtypes("Xenova/some-model");
if (dtypes.length === 0) {
// Model exists but has no ONNX files — not usable with transformers.js.
}
} catch (e) {
if (e instanceof ModelFileNotFoundError) {
// Model does not exist, or is private/gated without a token.
} else {
throw e; // network failure — retry rather than blacklisting the model
}
}Don't suggest a model without verifying this; the failure mode at runtime is a
download error that's harder to diagnose than a pre-flight check. For a fuller
pre-flight pattern (cache checks, dtype fallback), see
references/CONFIGURATION.md.
Quantization
Most pipelines accept a dtype option. Smaller dtypes download and run faster
at the cost of some accuracy:
dtype | Size | Use when |
fp32 | Largest | Maximum accuracy, Node.js with lots of RAM |
fp16 | ~50% of fp32 | GPU / WebGPU inference |
q8 | ~25% of fp32 | Good default for browsers |
q4 | ~12% of fp32 | Tight memory budgets, large language models |
q4f16 | ~12% of fp32 | Like q4 but with fp16 activations — pairs well with WebGPU LLMs |
const pipe = await pipeline("text-generation", "onnx-community/Qwen3-0.6B-ONNX", {
dtype: "q4",
});Device
Default is CPU/WASM. Pass device: "webgpu" to run on the GPU when available:
const pipe = await pipeline("sentiment-analysis", null, { device: "webgpu" });Memory management
Pipelines hold onto model weights and backend sessions. Always call
pipe.dispose() when you're done with one — especially in long-running
servers, before loading a replacement, or on component unmount.
const pipe = await pipeline("sentiment-analysis");
try {
const result = await pipe("Great!");
} finally {
await pipe.dispose();
}Configuration
The env export lets
you control model sources, caching, logging, and the fetch function.
import { env, LogLevel } from "@huggingface/transformers";
env.allowRemoteModels = true;
env.useFSCache = true; // Node.js: cache downloaded models on disk
env.useBrowserCache = true; // Browser: cache via the Cache API
env.logLevel = LogLevel.WARNING;See references/CONFIGURATION.md for the full
set of environment options, cache management, and private / gated models.
Pipeline options
Every pipeline accepts a progress_callback for download progress plus options
controlling device, dtype, and caching. The per-task recipes in
references/TASKS.md show common call options (e.g.
top_k, max_new_tokens) in use; shared loading options, generation
parameters, streaming, and KV-cache reuse are documented in
references/PIPELINE_OPTIONS.md. For the
exhaustive per-task option types, see the
API reference.
Things to never do
- Don't reuse a disposed pipeline. Create a new one with
pipeline(...)afterdispose(). - Don't recreate pipelines inside hot loops. Create once, call many times.
- Don't block startup on model downloads. Show progress via
progress_callback. - Don't fabricate model IDs. Confirm a model exists on the Hub and has ONNX files
(look for an
onnx/directory in the repo) before suggesting it to a user.
Reference documentation
- Official site: https://huggingface.co/docs/transformers.js
- API reference: https://huggingface.co/docs/transformers.js/api/pipelines
- Examples repo: https://github.com/huggingface/transformers.js-examples
This skill's local references:
TASKS.md— recipes for every task, grouped by modality (generated)CONFIGURATION.md—envoptions, caching, model inspectionPIPELINE_OPTIONS.md— common pipeline options, dtype, device, generation parameters
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

