How to convert custom models to -web.task format for browser deployment?

#7
by sasha-denisov - opened

Hi! I'm Sasha Denisov, developing flutter_gemma plugin and trying to understand how to create -web.task files for browser deployment.

I analyzed the file headers and found they are completely different formats:

  • gemma3-270m-it-q8.task (mobile) → PK header (ZIP archive with TFLite + tokenizer + metadata)
  • gemma3-270m-it-q8.litertlm (desktop) → LITERTLM header
  • gemma3-270m-it-q8-web.task (browser) → TFL3 header (raw TFLite)

Current situation:

  • ai-edge-torch → creates .litertlm (works on desktop via LiteRT-LM)
  • MediaPipe bundler → creates .task (works on mobile)
  • ??? → creates -web.task (works in browser via MediaPipe WASM)

Questions:

  1. What tool/process is used to create the -web.task files?
  2. Is there a public way to convert custom fine-tuned models (like FunctionGemma) to web format?
  3. Are there plans to open-source the web conversion pipeline?

I've tried using our .litertlm on web but got "No model format matched" error - MediaPipe WASM can't load it.

Thanks!

LiteRT Community (FKA TFLite) org

"-web.task" files were made using the original MediaPipe Converter, and are actually ".bin" rather than ".task" files, according to this chart.

Some basic instructions for running are available here: https://ai.google.dev/edge/mediapipe/solutions/genai/llm_inference/web_js#lora-model-conversion, but the best source of information is probably the source code here: https://cs.opensource.google/mediapipe/mediapipe/+/master:mediapipe/tasks/python/genai/converter/llm_converter.py.

Support for this converter was maintained through Gemma 3, so it should allow you to fine-tune Gemma 3 variants using external tools and then convert them (from .safetensors format, like you'd find on one of the original Gemma 3 HuggingFace repos). However, the MediaPipe Converter project has been officially deprecated, and currently there are no plans to update the converter for newer model variants.

Что за херня ??

Sign up or log in to comment