Vibeleaderboard
← All Intel
Intel / video

How Transformers.js Works: AI Models in JavaScript, Explained

Source
youtube.com
Author
Hugging Face
Date

Context

Transformers.js is a JavaScript library that runs machine learning models in a web browser or another JavaScript runtime. In a Hugging Face video, presenter Nico explains that it does not do the heavy math itself. Models are packaged in ONNX, a format that stores a computation graph plus trained weights and leaves a separate runtime to decide how to execute it on the available hardware, such as WebGPU or WebAssembly in a browser.

What Transformers.js adds is the work around that runtime. The video says it finds the files a model needs, downloads and caches them, converts raw input such as text, images or audio into the numeric arrays the model expects, and turns outputs back into labels, text or depth maps. A developer picks a task, optionally a model and a device, and calls the resulting pipeline like an ordinary asynchronous .

One setting, dtype, selects , meaning model weights stored at lower numerical precision. The video says this gives smaller files and lower memory use, often with faster , at some cost in accuracy. It shows no benchmarks.

Terms in this piece · Glossary
  • Function — A named block of instructions that takes inputs, called arguments, and hands back a result, called its return value.
  • quantization — Shrinking a model by storing its numbers less precisely — like rounding — so it runs faster and fits on smaller hardware, at a small quality cost.
  • Inference — Using a trained model to produce an output from a supplied input.
  • API — Application programming interface: the agreed set of operations, inputs and outputs through which one piece of software uses another.
Read the source www.youtube.com
More from Hugging Face
Recommended reads
Comments

Checking sign-in…

Loading comments…