Run this model with HF Jobs
Run google/cellgemma-e4b on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/google/cellgemma-e4b. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/google/cellgemma-e4b on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/google/cellgemma-e4b. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/google/cellgemma-e4b. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use google/cellgemma-e4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/cellgemma-e4b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="google/cellgemma-e4b")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("google/cellgemma-e4b") model = AutoModelForCausalLM.from_pretrained("google/cellgemma-e4b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use google/cellgemma-e4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "google/cellgemma-e4b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/cellgemma-e4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/google/cellgemma-e4b
- SGLang
How to use google/cellgemma-e4b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "google/cellgemma-e4b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/cellgemma-e4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "google/cellgemma-e4b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/cellgemma-e4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use google/cellgemma-e4b with Docker Model Runner:
docker model run hf.co/google/cellgemma-e4b
Link the model card to dataset-specific normalization depths
The model card's Input Expression Preprocessing section asks users to match training normalization. Could it link directly to Table M.4 for the dataset-specific depths and pseudobulk sizes?
I inverted log1p and summed the values in all 200 bundled profiles. Each of the 100 Tahoe controls summed to within 0.002 of 1,543, and each of the 100 K562 controls to within 0.004 of 12,142. Both match the table. Rescaling the same profiles to 10,000 with the shipped mean shifts kept the top-1,000 Source: gene sets identical and replaced up to 26 Tahoe and 7 K562 genes in the top-1,000 Mean Global prediction: lists.
This reproduces the depths and changed mean-shift entries with the pinned release files. It only needs NumPy and the JSON controls and mean shifts.
from pathlib import Path
import json
import numpy as np
root = Path("cellgemma-e4b")
controls = json.loads((root / "controls_sample.json").read_text())
def top(values):
return set(np.argsort(values)[::-1][:1000])
for name in ("tahoe", "k562"):
sample = controls[name]
expression = np.array([cell["expression"] for cell in sample["cells"]])
counts = np.expm1(expression)
depth = counts.sum(axis=1)
scaled = np.log1p(counts * (10000 / depth[:, None]))
shifts = json.loads((root / "decoders" / name / "mean_delta_global.json").read_text())
prior = np.array([shifts[g.upper()] for g in sample["genes"]], dtype=np.float32)
original, rescaled = (np.maximum(0, values.astype(np.float32) + prior)
for values in (expression, scaled))
replaced = [len(top(a) - top(b)) for a, b in zip(original, rescaled)]
print(name, len(depth), round(min(depth), 3), round(max(depth), 3),
min(replaced), max(replaced), sum(n > 0 for n in replaced))
🤖 Generated with Claude Code