Pyodide LLM

experiment

ブラウザ上の WebAssembly 版 Python(Pyodide)で言語モデルを動かす実験です。読み込み・トークナイザ・サンプリング・生成のループは素の Python で、1 トークンぶんの計算は WASM SIMD カーネルが、使える端末では複数のコアで行います。実験なのでモデルは小さく、出力はそれなりです。 既定のモデルは問いに答えられる Shisa V2.1c LFM2 350M で、初回は Hugging Face から 379 MB を取得してこのブラウザの中で変換します。 取得を減らすなら もあります。 いちばん軽いモデルは です。 一覧の最後のグループも同じように Hugging Face から取得して変換します。 この端末の CPU・GPU・保存・回線は ベンチマーク でまとめて測れます。 くわしくは Pyodide LLM の概要 へ。

An experiment in running language models on Python on WebAssembly (Pyodide) in the browser: loading, the tokenizer, the sampling and the generation loop are plain Python, and the computation of each token runs in WASM SIMD kernels, on several cores where the device allows. The default model, Shisa V2.1c LFM2 350M, answers questions: the first visit fetches its 379 MB from Hugging Face and converts it right here. fetches less. is the lightest model. The last group of the list is fetched and converted the same way. The benchmark measures this device's CPU, GPU, storage and line in one run.

このプロジェクトについて / About, models and licenses

The models and their licenses. The models of the last group are fetched from Hugging Face when you choose one, and converted to int8 in this browser.