Experimenting with local alt text generation in Firefox Nightly
Firefox 130 adds experimental on-device alt text generation for images in the built-in PDF editor, using a 182M-parameter ViT image encoder paired with DistilGPT-2, fine-tuned on COCO, quantized to under 200MB and running in a few seconds on a laptop CPU. The inference stack reuses the Firefox Translations architecture: the ONNX runtime compiled to WASM runs in a separate process, Transformers.js is vendored with Node pieces and eval() calls removed, and a custom cache serves models from Mozilla's servers into IndexedDB instead of Hugging Face. Small local models trade some accuracy against GPT-4o for privacy, lower resource use and quick retraining. The longer-term goal is to offer generated alt text during general browsing for screen reader users.
Related posts
- Experimenting with the proposed Cross-Origin Storage API in Transformers.js
Hugging Face mediumAdeptBrowser cache partitioning (in Chrome, keying by Network Isolation Key plus URL) forces every origin running Transformers.js to re-download identical model weights and the ONNX Runtime Wasm file. In the toy example that duplication costs 177 MB for Whisper alone. The proposed Cross-Origin Storage API (navigator.crossOriginStorage) fixes this by addressing files by SHA-256 hash instead of URL, with an OPFS-like getFileHandle interface. It also verifies hashes on write and lets developers scope visibility via an origins list that can be widened but never narrowed. Privacy is handled through availability gating for rarely seen resources, so apps must treat any error as a cache miss. Transformers.js already ships an experimental opt-in COS backend via env.experimental_useCrossOriginStorage, testable today with a polyfill extension.
- Diffusers welcomes FLUX-2
Hugging Face hardMasterFLUX.2 from Black Forest Labs is a new image generation and editing model, not a drop-in replacement for Flux.1. It uses a single Mistral Small 3.1 text encoder that stacks intermediate-layer outputs, bias-free DiT layers, shared AdaLayerNorm-Zero modulation, and fully parallel single-stream blocks with SwiGLU MLPs, shifting to 8 double-stream and 48 single-stream blocks in the 32B model. Running it unmodified needs over 80GB of VRAM. Diffusers code covers CPU offload (~62GB), Flash Attention 3, NF4 4-bit quantization (~20GB), a remote text encoder (18GB), group offloading (8GB VRAM), multi-image references, structured JSON prompting and LoRA fine-tuning.
- Making a web app generator with open ML models
Hugging Face mediumAdeptA Node.js/Express server can generate web apps from a text prompt by streaming tokens from a code LLM (WizardCoder-15B on Hugging Face Inference Endpoints) straight into the browser as HTML. Prompt tuning does most of the work: terse imperative instructions, pre-seeding the output with `<html><body class=...>`, and requiring TailwindCSS so styles arrive inline without a stylesheet that stalls rendering. Image URLs come from a Stable Diffusion `/image` endpoint that the model is told to call. Alpine.js provides a minimal UI, and DaisyUI's shorthand classes cut token usage compared with verbose Tailwind utility classes.
- Generate Images Locally with Docker Model Runner and Open WebUI
Docker mediumAdeptDocker Model Runner can now serve diffusion image models locally through an OpenAI-compatible /v1/images/generations endpoint. Paired with Open WebUI, that gives you private, offline image generation from a chat interface. Models are distributed as DDUF single-file artifacts via Docker Hub, `docker model launch openwebui` wires up the UI, and an admin setting points image generation at the diffusers endpoint. The walkthrough also covers calling the API directly with curl, including negative prompts, inference steps, guidance scale and seeds. Under the hood, the backend unpacks the DDUF into a Diffusers pipeline served by a version-pinned FastAPI server.
- State of open video generation models in Diffusers
Hugging Face mediumAdeptOpen video generation models such as HunyuanVideo, CogVideoX, LTX-Video, Mochi-1 and Allegro share a common architecture: T5-style text encoders, a DiT-based denoiser over 3D spatio-temporal tokens, a spatially and temporally compressing VAE, and a scheduler. Diffusers runs them in a few lines of code but they need a lot of memory, about 60 GB for HunyuanVideo at default settings. Benchmarks combining bitsandbytes/FP8 quantization, CPU and group offloading, VAE tiling and layerwise casting bring HunyuanVideo down to about 6.6 GB with little extra latency. Timestep and guidance distillation speed up generation, and the finetrainers repo supports LoRA fine-tuning.