transformers.js
State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly in your browser, with no need for a server!
Troubleshoot Transformers.js model loading errors. Use debug logging to trace the ONNX pipeline and pinpoint failures for effective diagnosis.
Supporting Different JavaScript Runtimes (Node.js, Deno, Bun) with the Same APILearn how huggingface/transformers.js unifies the JavaScript API for Node.js, Deno, and Bun, enabling consistent filesystem access, caching, and model loading across environments.
Preloading Models at Startup and Managing Persistent Cache Strategies in Transformers.jsLearn to preload Transformers.js models at startup and manage persistent cache with custom backends. Optimize your application's model loading performance efficiently.
Customizing ONNX Runtime with session_options in Transformers.js: A Complete GuideUnlock ONNX Runtime power in Transformers.js by customizing session_options. Control execution providers, logging, memory optimization, and hardware acceleration for advanced configuration.
How to Stream Generated Text Progressively in Transformers.js Text-Generation PipelinesLearn to stream generated text progressively in Transformers.js text-generation pipelines. This guide shows how to use TextStreamer for real-time incremental output.
Organizing Model Files in Subfolders within Hugging Face Repositories: The Complete Transformers.js GuideLearn 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.
How to Load Specific Model Revisions or Commits from Hugging Face Hub with transformers.jsEasily load specific model revisions or commits from Hugging Face Hub using transformers.js. Control versions precisely and manage isolated caches with the revision option.
Processing Multiple Inputs Through Batch Inference for Throughput in Transformers.jsBoost Transformer inference speed with Transformers.js batching. Process multiple inputs efficiently in a single forward pass for maximum throughput. Learn how.
Managing Multiple Pipeline Instances and Sharing Model Weights in Transformers.jsLearn to manage multiple pipeline instances and share model weights in Transformers.js. Load once, reuse `PreTrainedModel` for efficient ONNX sessions and reduced memory usage.
Handling Errors and Implementing Retry Logic During Model Loading in Transformers.jsLearn 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.
Running Transformers.js Inference in Web Workers to Avoid Blocking the Main ThreadLearn 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.
Comparing dtype Options and Their Impact on Model Accuracy and Performance in transformers.jsExplore 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.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →