|
Download README.md from lhemerly/cellgemma-e4b-q4-webgpu: direct link, hf CLI and curl.
- Browser
- Download file 4.94 kB
-
https://huggingface.co/lhemerly/cellgemma-e4b-q4-webgpu/resolve/main/README.md
- Command line
-
hf download hf://lhemerly/cellgemma-e4b-q4-webgpu/README.md
-
curl -L -o README.md https://huggingface.co/lhemerly/cellgemma-e4b-q4-webgpu/resolve/main/README.md
4.94 kB
| license: apache-2.0 | |
| license_link: https://ai.google.dev/gemma/apache_2 | |
| base_model: | |
| - google/cellgemma-e4b | |
| pipeline_tag: text-generation | |
| tags: | |
| - cellgemma | |
| - gemma4 | |
| - single-cell | |
| - perturbation | |
| - webgpu | |
| - wasm | |
| - q4_0 | |
| - quantized | |
| # CellGemma E4B — Q4_0 WebGPU / 8GB VRAM Quantized Weights (`cellgemma-q4-v1`) | |
| Pre-quantized **Q4_0** (block size 32, 18 bytes/block) weights for [`google/cellgemma-e4b`](https://huggingface.co/google/cellgemma-e4b), sharded into **36 binary files (`<= 128 MiB` each)** so every tensor fits within standard WebGPU `maxStorageBufferBindingSize` limits and runs comfortably on **8 GB GPUs** (including in-browser WebGPU via Wasm and native Vulkan via `wgpu`). | |
| - **Engine & Interactive SMILES Perturbation Lab**: [https://github.com/lhemerly/cellgemma-wasm-wgpu](https://github.com/lhemerly/cellgemma-wasm-wgpu) | |
| - **Base Model**: [`google/cellgemma-e4b`](https://huggingface.co/google/cellgemma-e4b) (`Gemma4ForCausalLM`, `gemma4_text`, 42 layers, 4.5B effective / 7.73B total params, 282,240 vocab) | |
| - **License**: Apache 2.0 | |
| ## Shard & VRAM Summary | |
| | Metric | Value | | |
| | --- | --- | | |
| | Format | `cellgemma-q4-v1` (Q4_0 block-32, 256-byte aligned, LE) | | |
| | Shards | `36` files (`shard-000.bin` .. `shard-035.bin`) | | |
| | Max Shard Size | `133,594,624` bytes (`127.41 MiB`, `<= 128 MiB`) | | |
| | Total Weight Size | `4,350,358,804` bytes (`4.052 GiB`) | | |
| | `embed_tokens` (4 row-shards) | `406,425,600` bytes (`387.60 MiB`) | | |
| | PLE (`42` per-layer tables) | `1,706,987,520` bytes (`1.590 GiB`) | | |
| | Transformer + Norms + PLE Proj | `2,236,945,684` bytes (`2.083 GiB`) | | |
| | Total GPU VRAM (GPU PLE mode) | `~4.33 GiB` (`4,429.63 MB` measured on RX 6600 XT 8GB) | | |
| | Total GPU VRAM (CPU PLE mode) | `~2.74 GiB` (`2,801.72 MB` measured on RX 6600 XT 8GB) | | |
| ## Included Assets | |
| - `manifest.json` — shard & tensor index (`709` tensors) | |
| - `shard-000.bin` .. `shard-035.bin` — Q4_0 weights + F32 norms/scalars | |
| - `config.json` — original Gemma 4 text config | |
| - `tokenizer.json` — extended 282,240-token vocabulary (with ~20K HGNC gene symbols) | |
| - `controls_sample.json` — baseline control cell expression profiles | |
| - `kg_sentences.json` — knowledge-graph gene descriptions for CRISPR/cytokine prompts | |
| - `decoders/<dataset>/` — all 13 Stage 2 `ExpressionDecoder` MLPs (`dong`, `emeraldbay`, `hepg2`, `jurkat`, `k562`, `l1000`, `norman`, `parse`, `rpe1`, `sciplex`, `tahoe`, `tisch`, `vcc`) | |
| ## How to Use with `cellgemma-wasm-wgpu` | |
| This repository hosts the **4.052 GiB Q4_0 weights, tokenizer, baseline controls, gene knowledge graph, and 13 Stage 2 `ExpressionDecoder`s**. Pair it with the Rust/Wasm + WebGPU FlashAttention-style engine and interactive Perturbation Lab UI at [**`lhemerly/cellgemma-wasm-wgpu`**](https://github.com/lhemerly/cellgemma-wasm-wgpu): | |
| ### Option 1: In-Browser WebGPU Lab (Stream Directly from HuggingFace) | |
| ```bash | |
| git clone https://github.com/lhemerly/cellgemma-wasm-wgpu | |
| cd cellgemma-wasm-wgpu | |
| python3 scripts/serve.py --port 8080 | |
| ``` | |
| Open `http://localhost:8080` in a WebGPU-enabled browser, then paste this URL into the **Model Loader -> Custom URL** field: | |
| ```text | |
| https://huggingface.co/lhemerly/cellgemma-e4b-q4-webgpu/resolve/main | |
| ``` | |
| From the browser UI you can: | |
| - Toggle **GPU PLE (~4.33 GiB VRAM)** vs **CPU PLE offload (~2.74 GiB VRAM)** to fit 8 GB GPUs with headroom. | |
| - Select or draw **SMILES** small molecules (with live 2D structure preview & Lipinski/descriptor checks), stack **CRISPR**, **Cytokine**, and **Clinical** perturbations, and run dose-response sweeps. | |
| - Switch across all **13 Stage 2 `ExpressionDecoder`s**, adjust Temperature / Top-P / Top-K / Seed, stream `+GENE`/`-GENE` DEGs live, and compare runs side-by-side. | |
| ### Option 2: In-Browser WebGPU Lab with Local Weights (Auto-Detected / Offline) | |
| Download these quantized weights into `models/cellgemma-e4b-q4/` inside the cloned repo: | |
| ```bash | |
| git clone https://github.com/lhemerly/cellgemma-wasm-wgpu | |
| cd cellgemma-wasm-wgpu | |
| # Using HuggingFace CLI: | |
| hf download lhemerly/cellgemma-e4b-q4-webgpu --local-dir models/cellgemma-e4b-q4 | |
| # Or using Git LFS: | |
| # git lfs install | |
| # git clone https://huggingface.co/lhemerly/cellgemma-e4b-q4-webgpu models/cellgemma-e4b-q4 | |
| python3 scripts/serve.py --port 8080 | |
| ``` | |
| The WebGPU Lab automatically detects `/models/cellgemma-e4b-q4/manifest.json` on startup (or you can pick any local model folder via the **Folder** picker). | |
| ### Option 3: Native 8 GB GPU CLI (`wgpu` Vulkan / Metal / DX12) | |
| Once the weights are in `models/cellgemma-e4b-q4/`, run native GPU inference directly from Rust: | |
| ```bash | |
| # GPU PLE mode (~4.33 GiB VRAM) | |
| cargo run --release -p cellgemma-cli -- \ | |
| --model-dir models/cellgemma-e4b-q4 \ | |
| --dataset tahoe \ | |
| --max-new-tokens 128 | |
| # CPU PLE offload mode (~2.74 GiB VRAM) | |
| cargo run --release -p cellgemma-cli -- \ | |
| --model-dir models/cellgemma-e4b-q4 \ | |
| --dataset tahoe \ | |
| --ple-cpu \ | |
| --max-new-tokens 128 | |
| ``` | |