CellTypist Model Management
Use this sub-skill when a task is about locating, downloading, loading, writing, inspecting, converting, subsetting, or smoke-testing CellTypist models.
Route Quickly
- Read model reference for cache paths, remote downloads,
Model.load, Model.write, prediction labels/probabilities, and marker extraction.
- Read conversion and subsetting before changing species, gene identifiers, or retained cell types; these methods mutate the loaded model in place.
- Use troubleshooting for cache/network surprises, invalid pickle files, missing map files, conversion column mistakes, invalid collapse modes, and subset constraints.
- Run model_cache_check.py to inspect the active
CELLTYPIST_FOLDER model cache or verify a local model pickle without downloading anything.
- Run tiny_model_factory.py to create a tiny offline-compatible CellTypist model pickle for smoke tests and examples.
Stay In Scope
- Stay here for
celltypist.models, built-in model inventory/download/cache behavior, Model object persistence and metadata, marker extraction, Model.convert, and Model.subset.
- Route annotation with a selected model to annotation-workflows.
- Route training a new real reference model to training-and-custom-models.
- Route result tables, AnnData insertion, UMAPs, dotplots, or interpretation of finished predictions to visualization-and-results.
Offline-First Pattern
For offline work, avoid implicit default-model resolution and pass an explicit local model path containing a forward slash, such as ./local_model.pkl or Path("local_model.pkl").resolve().as_posix().
from pathlib import Path
from celltypist import models
model_path = Path("local_model.pkl").resolve().as_posix()
model = models.Model.load(model_path)
print(model.cell_types)
print(model.features[:5])
If a task may run without network access, inspect cache state first:
python scripts/model_cache_check.py --verify-model ./local_model.pkl
1---2name: model-management-23description: "Manage CellTypist built-in model discovery, local cache behavior,4 model pickle inspection, conversion, subsetting, markers, and offline test5 fixtures."6disable-model-invocation: true7metadata:8 source: https://skillmd.com/skills/vectorspacelab/model-management-29 disco-role: operating10license: MIT11---1213# CellTypist Model Management1415Use this sub-skill when a task is about locating, downloading, loading, writing, inspecting, converting, subsetting, or smoke-testing CellTypist models.1617## Route Quickly1819- Read [model reference](references/model-reference.md) for cache paths, remote downloads, `Model.load`, `Model.write`, prediction labels/probabilities, and marker extraction.20- Read [conversion and subsetting](references/conversion-and-subsetting.md) before changing species, gene identifiers, or retained cell types; these methods mutate the loaded model in place.21- Use [troubleshooting](references/troubleshooting.md) for cache/network surprises, invalid pickle files, missing map files, conversion column mistakes, invalid collapse modes, and subset constraints.22- Run [model_cache_check.py](scripts/model_cache_check.py) to inspect the active `CELLTYPIST_FOLDER` model cache or verify a local model pickle without downloading anything.23- Run [tiny_model_factory.py](scripts/tiny_model_factory.py) to create a tiny offline-compatible CellTypist model pickle for smoke tests and examples.2425## Stay In Scope2627- Stay here for `celltypist.models`, built-in model inventory/download/cache behavior, `Model` object persistence and metadata, marker extraction, `Model.convert`, and `Model.subset`.28- Route annotation with a selected model to [annotation-workflows](../annotation-workflows/SKILL.md).29- Route training a new real reference model to [training-and-custom-models](../training-and-custom-models/SKILL.md).30- Route result tables, AnnData insertion, UMAPs, dotplots, or interpretation of finished predictions to [visualization-and-results](../visualization-and-results/SKILL.md).3132## Offline-First Pattern3334For offline work, avoid implicit default-model resolution and pass an explicit local model path containing a forward slash, such as `./local_model.pkl` or `Path("local_model.pkl").resolve().as_posix()`.3536```python37from pathlib import Path38from celltypist import models3940model_path = Path("local_model.pkl").resolve().as_posix()41model = models.Model.load(model_path)42print(model.cell_types)43print(model.features[:5])44```4546If a task may run without network access, inspect cache state first:4748```bash49python scripts/model_cache_check.py --verify-model ./local_model.pkl50```