# transformers.js | Hugging Face | Knowledge Base | Instagit

State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly in your browser, with no need for a server!

GitHub Stars: 15.5k

Repository: https://github.com/huggingface/transformers.js

---

## Articles

### [Debugging Model Loading Failures in Transformers.js: A Complete Diagnostic Guide](/huggingface/transformers.js/debugging-model-loading-failures-and-diagnosing-common-issues)

Troubleshoot Transformers.js model loading errors. Use debug logging to trace the ONNX pipeline and pinpoint failures for effective diagnosis.

- Tags: how-to-guide
- Published: 2026-03-03

### [Supporting Different JavaScript Runtimes (Node.js, Deno, Bun) with the Same API](/huggingface/transformers.js/supporting-different-javascript-runtimes-nodejs-deno-bun-with-the-same-api)

Learn how huggingface/transformers.js unifies the JavaScript API for Node.js, Deno, and Bun, enabling consistent filesystem access, caching, and model loading across environments.

- Tags: internals
- Published: 2026-03-03

### [Preloading Models at Startup and Managing Persistent Cache Strategies in Transformers.js](/huggingface/transformers.js/preloading-models-at-startup-and-managing-persistent-cache-strategies)

Learn to preload Transformers.js models at startup and manage persistent cache with custom backends. Optimize your application's model loading performance efficiently.

- Tags: performance
- Published: 2026-03-03

### [Customizing ONNX Runtime with session_options in Transformers.js: A Complete Guide](/huggingface/transformers.js/customizing-onnx-runtime-with-session-options-for-advanced-configuration)

Unlock ONNX Runtime power in Transformers.js by customizing session_options. Control execution providers, logging, memory optimization, and hardware acceleration for advanced configuration.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Stream Generated Text Progressively in Transformers.js Text-Generation Pipelines](/huggingface/transformers.js/streaming-generated-text-progressively-in-text-generation-pipelines)

Learn to stream generated text progressively in Transformers.js text-generation pipelines. This guide shows how to use TextStreamer for real-time incremental output.

- Tags: how-to-guide
- Published: 2026-03-03

### [Organizing Model Files in Subfolders within Hugging Face Repositories: The Complete Transformers.js Guide](/huggingface/transformers.js/organizing-model-files-in-subfolders-within-hugging-face-repositories)

Learn to organize model files in subfolders within Hugging Face repositories using Transformers.js. Load ONNX models easily by specifying the subfolder option in AutoModel.from_pretrained.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Load Specific Model Revisions or Commits from Hugging Face Hub with transformers.js](/huggingface/transformers.js/loading-specific-model-revisions-or-commits-from-hugging-face-hub)

Easily load specific model revisions or commits from Hugging Face Hub using transformers.js. Control versions precisely and manage isolated caches with the revision option.

- Tags: how-to-guide
- Published: 2026-03-03

### [Processing Multiple Inputs Through Batch Inference for Throughput in Transformers.js](/huggingface/transformers.js/processing-multiple-inputs-through-batch-inference-for-throughput)

Boost Transformer inference speed with Transformers.js batching. Process multiple inputs efficiently in a single forward pass for maximum throughput. Learn how.

- Tags: performance
- Published: 2026-03-03

### [Managing Multiple Pipeline Instances and Sharing Model Weights in Transformers.js](/huggingface/transformers.js/managing-multiple-pipeline-instances-efficiently-and-sharing-model-weights)

Learn to manage multiple pipeline instances and share model weights in Transformers.js. Load once, reuse `PreTrainedModel` for efficient ONNX sessions and reduced memory usage.

- Tags: best-practices
- Published: 2026-03-03

### [Handling Errors and Implementing Retry Logic During Model Loading in Transformers.js](/huggingface/transformers.js/handling-errors-and-implementing-retry-logic-during-model-loading)

Learn to handle errors and implement retry logic for model loading in Transformers.js. Make model loading resilient to network failures with exponential back-off and status code inspection.

- Tags: how-to-guide
- Published: 2026-03-03

### [Running Transformers.js Inference in Web Workers to Avoid Blocking the Main Thread](/huggingface/transformers.js/running-inference-in-web-workers-to-avoid-blocking-the-main-thread)

Learn how to run Transformers.js inference in Web Workers to prevent blocking the main thread and maintain a responsive browser UI during heavy model operations.

- Tags: performance
- Published: 2026-03-03

### [Comparing dtype Options and Their Impact on Model Accuracy and Performance in transformers.js](/huggingface/transformers.js/comparing-dtype-options-and-their-impact-on-model-accuracy-and-performance)

Explore dtype options in transformers.js like fp32, fp16, and q4 to balance speed, accuracy, and memory for your AI models. Learn how selectDtype optimizes performance.

- Tags: performance
- Published: 2026-03-03

### [Selecting Compute Backends (CPU, WebGPU, WebNN) in Transformers.js: A Complete Guide](/huggingface/transformers.js/selecting-compute-backends-cpu-webgpu-webnn-for-different-browsers)

Learn how to select compute backends like CPU, WebGPU, and WebNN in Transformers.js for optimal performance. This guide explains automatic detection and manual selection for your pipelines.

- Tags: how-to-guide
- Published: 2026-03-03

### [Implementing Custom Cache Systems with the CacheInterface in Transformers.js](/huggingface/transformers.js/implementing-custom-cache-systems-with-the-cacheinterface)

Learn to implement custom cache systems in Transformers.js using the CacheInterface. Override default storage and enhance performance with a custom cache solution. Set useCustomCache to true and provide your match and put methods.

- Tags: how-to-guide
- Published: 2026-03-03

### [Tracking Model Loading Progress with the `progress_callback` Option in Transformers.js](/huggingface/transformers.js/tracking-model-loading-progress-with-progress-callback-option)

Track model loading progress in Transformers.js with progress_callback. Receive granular progress events for real-time download tracking and monitor overall completion percentage easily.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Block Remote Model Downloads and Use Local Files Only in Production with Transformers.js](/huggingface/transformers.js/blocking-remote-model-downloads-and-using-local-files-only-in-production)

Secure your production Transformers.js apps. Block remote model downloads and use local files only to prevent unauthorized access and improve performance. Learn how to configure.

- Tags: best-practices
- Published: 2026-03-03

### [How to Configure Custom Cache Directories for Models and Weights in Transformers.js](/huggingface/transformers.js/configuring-custom-cache-directories-for-models-and-weights)

Control Transformers.js model and weight storage by setting custom cache directories via env.cacheDir. Optimize your downloads and organization.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Load Models from the Local Filesystem Instead of the Hugging Face Hub in Transformers.js](/huggingface/transformers.js/loading-models-from-local-filesystem-instead-of-hugging-face-hub)

Learn how to load models locally in Transformers.js. Disable remote access and specify local model paths for faster, offline inference.

- Tags: how-to-guide
- Published: 2026-03-03

### [How to Configure WebGPU Device for Model Inference in Transformers.js](/huggingface/transformers.js/how-to-configure-webgpu-device-for-model-inference-in-transformers-js)

Learn how to configure the WebGPU device for accelerated model inference in Transformers.js by setting device to webgpu in your pipeline options for faster results.

- Tags: how-to-guide
- Published: 2026-03-03

