Hugging Face / Transformers.jsinformation

Your JavaScript.
A local ML pipeline.

Give your coding assistant the original Hugging Face guide for choosing, loading, using and releasing Transformers.js models.

Observed local inference

“I love this library. It works beautifully.”

POSITIVE0.999882
0CLASS SCORE1

One q8 English sentiment result from the executed Node CPU fixture. A class score is not measured accuracy.

JavaScriptApplication integration
Local CPUActual tested backend
Apache-2.0Original source retained

Build the path from input to prediction.

For application developers

Start with a task and an ONNX-compatible model. Produce JavaScript that preprocesses input, runs inference and returns structured results.

For reproducible prototypes

Make model revision, precision, cache placement, progress and cleanup deliberate parts of the integration.

Text→Tokenizer→ONNX model→Labels + scores

What you bring. What you get.

Your inputs

A target runtime, the intended task, representative data, hardware constraints and a model whose license permits your use.

Your deliverable

An assistant-built integration, model and dtype choices, loading/cache behavior, structured output handling and disposal.

Inside the Skill

Original instructions and seven reference guides covering pipeline options, configuration, caching, model registry, architectures, examples and generation.

The package contains guidance. The npm library, ONNX runtime, model weights and validation app are separate dependencies.

A focused proof of local execution.

Codex executed one pinned English sentiment model with Transformers.js 4.3.2 and ONNX Runtime Node 1.30.0 on macOS arm64. All 23 checks passed, then passed again after extracting the final ZIP and installing fresh dependencies.

Verified: normal and boundary inputs, batch order, normalized scores, bounded long text, pipeline reuse, exact q8 weight checksum, cache reload with fetch/sockets denied and disposal. This is behavioral validation, not a model-quality or speed benchmark.

Choose the right scope.

Good fit

Adding local text-model inference to a JavaScript application, planning model downloads or making resource cleanup explicit.

Outside this proof

Browser/WASM/WebGPU, Bun/Deno, React/Express templates, embeddings, generation, image and audio tasks are described upstream but were not exercised.

Binary sentiment can assign strong labels to neutral or empty input. Validate application inputs and evaluate the chosen model on your own data.

Dependencies and rights, clearly stated.

Use an Agent Skills compatible coding assistant and install the Skill as transformers-js. The tested setup needs Node.js, npm and Transformers.js 4.3.2; initial model acquisition needs network access. Public reads used no Hugging Face API key. Assistant model access and optional services may carry separate costs.

The test model has 68,293,700 bytes of unique model/tokenizer/config artifacts; the exercised cache stored 68,294,435 bytes across five files, including a duplicate config entry. Models are not included in the Skill ZIP. Cached inference was tested with network calls denied.

The ONNX conversion card links to the Apache-2.0 DistilBERT SST-2 base model but does not separately declare a license. Model use and redistribution require checking that licensing chain independently of the Skill license. No weights are redistributed here.