Instructions to use slideflow-labs/mettle-1.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use slideflow-labs/mettle-1.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="slideflow-labs/mettle-1.5", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("slideflow-labs/mettle-1.5", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
METTLE 1.5
METTLE 1.5 is Slideflow Labs' robustness fine-tune of H-optimus-0 for histopathology feature extraction. It is designed to improve representation consistency across slide scanners and staining variation while retaining biologically useful morphology.
The earlier checkpoint is METTLE 1 (pre-release).
| Property | Value |
|---|---|
| Architecture | ViT-g/14 with four register tokens and a CLS refinement head |
| Input | 224 ร 224 RGB tile |
| Default output | 1,536-dimensional refined CLS embedding |
| Optional output | 3,072-dimensional refined CLS + mean spatial-patch embedding |
| Weights | model.safetensors; original tensor values and precision preserved |
The spatial-patch mean excludes the CLS and register tokens. The head dimensions
are specified in config.json. Source and packaged weight checksums are recorded
in weights_manifest.json.
Usage
Dependencies are listed in requirements.txt.
import torch
from PIL import Image
from transformers import AutoImageProcessor, AutoModel
model_id = "slideflow-labs/mettle-1.5"
device = "cuda" if torch.cuda.is_available() else "cpu"
processor = AutoImageProcessor.from_pretrained(model_id, use_fast=False)
model = AutoModel.from_pretrained(
model_id,
trust_remote_code=True,
).to(device).eval()
image = Image.open("tile.png").convert("RGB")
inputs = processor(images=image, return_tensors="pt").to(device)
with torch.inference_mode():
# Use "cls" for 1,536 features, or "cls_mean" for 3,072 features.
embeddings = model(**inputs, feature_view="cls_mean").pooler_output
The processor resizes directly to 224 ร 224 with bicubic interpolation, rescales
RGB intensities by 1/255, and normalizes with mean
[0.707223, 0.578729, 0.703617] and standard deviation
[0.211883, 0.230117, 0.177517].
Packaging verification
All 577 saved tensors match the source checkpoint byte for byte. The saved
package loads through AutoModel without missing or unexpected weights. On a
synthetic RGB tile, both feature views match a reference implementation using
the original checkpoint to a maximum absolute difference of 1.79e-7 in CPU
float32 inference. See verification.json for the artifact identities and test
results. The tested runtime used PyTorch 2.13.0, timm 1.0.29, and Transformers
4.57.1.
Compatibility
The Hugging Face loader uses backbone.* tensor names. Consumers that directly
load the original flat .pt checkpoint require their existing checkpoint format
or an explicitly compatible safetensors loader.
Scope
This is a tile feature extractor, not a standalone diagnostic system. This model card makes no benchmark or clinical-performance claims for this checkpoint.
- Downloads last month
- -
Model tree for slideflow-labs/mettle-1.5
Base model
bioptimus/H-optimus-0