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.

Link the model card to dataset-specific normalization depths

#20
by rpinho1 - opened

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

Sign up or log in to comment