Instructions to use a7m1st/medigent-one-gemma4-crc-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use a7m1st/medigent-one-gemma4-crc-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-4-E4B-it") model = PeftModel.from_pretrained(base_model, "a7m1st/medigent-one-gemma4-crc-lora") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- Unsloth Studio new
How to use a7m1st/medigent-one-gemma4-crc-lora with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for a7m1st/medigent-one-gemma4-crc-lora to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for a7m1st/medigent-one-gemma4-crc-lora to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for a7m1st/medigent-one-gemma4-crc-lora to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="a7m1st/medigent-one-gemma4-crc-lora", max_seq_length=2048, )
Medigent One — Gemma 4 E4B CRC Tissue Classifier
LoRA adapter for unsloth/gemma-4-E4B-it, fine-tuned for 9-class colorectal cancer tissue classification from H&E-stained histology patches.
This adapter is the fine-tuning proof point referenced in our Medigent One Gemma 4 Good Hackathon submission. The full Medigent One stack (a six-agent medical reasoning panel built on Gemma 4 31B) ships separately at https://github.com/a7m-1st/medigent-one. The adapter itself is not deployed in the production Medigent One stack — it is published here as a reproducible demonstration that Gemma 4 E4B can be specialized for medical vision when needed.
Task
9-class tissue classification from H&E-stained colorectal cancer patches:
ADI | BACK | DEB | LYM | MUC | MUS | NORM | STR | TUM
Training
| Base model | unsloth/gemma-4-E4B-it |
| Method | LoRA via Unsloth (r=16, alpha=16, target_modules=all-linear) |
| Trainable params | 41,222,144 (0.51% of 8.04B) |
| Dataset | NCT-CRC-HE-100K (9,000 training samples, seed=42) |
| Steps | 300 (~0.27 epochs, effective batch 8) |
| Optimizer | adamw_torch_fused, LR 2e-4, cosine schedule, warmup 0.03 |
| Hardware | NVIDIA RTX PRO 6000 Blackwell (94 GB) |
| Precision | bfloat16 |
Results
Evaluated on 500 samples from each dataset, seed=42:
| Dataset | Pretrained acc | Fine-tuned acc | F1 (weighted) | Δ |
|---|---|---|---|---|
| Dataset A — NCT-CRC-HE-100K (in-distribution) | 29.0% | 90.6% | 0.91 | +61.6 pp |
| Dataset B — CRC-VAL-HE-7K (held-out) | 22.4% | 76.0% | 0.72 | +53.6 pp |
Zero malformed outputs across 1000 evaluations. Random chance on this 9-class task is 11.1%.
The sweet spot is narrow: longer training (3 epochs) collapses the model into a single dominant class. The 300-step recipe at effective batch 8 with LR 2e-4 lands inside that window.
Usage
from unsloth import FastModel
model, processor = FastModel.from_pretrained(
"a7m1st/medigent-one-gemma4-crc-lora",
load_in_4bit=False,
max_seq_length=2048,
full_finetuning=False,
)
The full prompt used at both training and evaluation:
What type of tissue is shown in this histological image?
Choose from: ADI, BACK, DEB, LYM, MUC, MUS, NORM, STR, TUM.
Citation
@misc{medigent_one_2026,
title = {Medigent One},
author = {Ahmed Awelkair and zl.fang and Nerissa Ibrahim and Bimo Kuncoro},
year = {2026},
url = {https://www.kaggle.com/competitions/gemma-4-good-hackathon/writeups/medigent-one-one-model-one-panel-of-specialists}
}
Acknowledgments
- Google Gemma 4 team for the open-weights model
- Unsloth team for the LoRA fine-tuning framework
1aurent/NCT-CRC-HEdataset (originally from Kather et al.)
Gemma is a trademark of Google LLC.
- Downloads last month
- 42