Browser

How to install the WebAssembly build of llama.cpp for a browser.

yzma runs in a browser with the WebAssembly build of llama.cpp.

yzma install --lib /path/to/web --os wasm

This command downloads all three builds, one for WebGPU, one with more than one thread, and one with a single thread. The JavaScript glue selects the best build that the page can run.

Build What the browser must have
WebGPU WebGPU with f16 shaders, and JSPI. Chrome or Edge 137 and later, or Firefox 153 and later with two settings in about:config. Chrome on Linux needs three switches. In Firefox the loader uses the CPU, which is faster there.
More threads SharedArrayBuffer, so the page must send the COOP header and the COEP header.
One thread Nothing. It works in every browser.

A browser with no WebGPU still works. It runs on the CPU.

Every build includes the multimodal library, so a model with a projector works for images.

A browser program uses the smaller pkg/llamawasm API. The call names and order are the same as in pkg/llama, so you can move a program from one to the other by changing the import.

You also need TinyGo 0.42.0 or later to build the program.

Next steps

Try it in your browser runs a page like this now, with no install. See Run yzma in a browser for a complete lesson, and WebAssembly for how it works.