spacy-loggers
Training-run loggers for spaCy: Weights & Biases, MLflow, ClearML, PyTorch, CuPy
Repository Health
Technical Analysis
spacy-loggers provides the alternate training loggers that spaCy split out of its core package starting with v3.2, so integrations with experiment-tracking tools can be added, updated, and released independently of spaCy itself. It ships ready-made loggers for Weights & Biases, MLflow, and ClearML that stream training metrics, losses, and the full interpolated config to each tool’s dashboard, plus PyTorch and CuPy loggers for lower-level framework instrumentation.
Each logger is registered as a spaCy config component (e.g. spacy.WandbLogger.v5) and is selected declaratively in the [training.logger] section of a spaCy training config rather than wired up in Python code. A ChainLogger utility lets multiple loggers run side by side — for example sending output to both the console and an experiment tracker in the same training run — and each logger exposes a remove_config_values option to strip sensitive path or credential fields from the config before it’s uploaded to a third-party dashboard.
What You Get
spacy.WandbLogger.vN- streams training metrics, system stats, and the full config to a Weights & Biases dashboard, with optional model-checkpoint and dataset artifact loggingspacy.MLflowLogger.vN- logs config as MLflow run parameters and per-step scores/losses as MLflow metrics, uploading the best model artifact when the score improvesspacy.ClearMLLogger.vN- sends config, git commit info, console output, and scalar plots to a ClearML server (hosted or self-hosted)- PyTorch and CuPy loggers for framework-level training instrumentation
ChainLoggerutility to run multiple loggers together in a single training run (e.g. console + Weights & Biases simultaneously)remove_config_valuesoption on each logger to exclude sensitive fields (file paths, credentials) from what gets uploaded to third-party dashboards
Common Use Cases
- Tracking spaCy NLP model training runs on a Weights & Biases dashboard for experiment comparison and hyperparameter tuning
- Logging spaCy training metrics and model artifacts to a team’s self-hosted MLflow tracking server
- Sending spaCy training runs to ClearML for full reproducibility (config, code state, console output, and scalars) alongside other ML experiments
- Combining console output with a remote experiment tracker in the same training run via ChainLogger
Under The Hood
Architecture - each integration lives in its own module (wandb.py, mlflow.py, clearml.py, pytorch.py, cupy.py) implementing spaCy’s logger protocol (a callable returning a (log_step, finalize) pair), registered under versioned names like spacy.WandbLogger.v5 via spaCy/Thinc’s function registry so training configs select a logger purely by name; chain.py composes several logger callables into one that fans out each logging call. Tech Stack - pure Python with each third-party integration (wandb, mlflow, clearml, torch) treated as an optional dependency the user installs separately rather than a hard requirement of spacy-loggers itself. Code Quality - a spacy_loggers/tests/ directory covers the registered loggers; the package has been feature-stable with no commits since late 2023, consistent with its role as a narrow, infrequently-changing integration layer split out specifically so it wouldn’t need to track spaCy’s own release cadence. API Design - loggers are configured declaratively in .cfg/.ini training config files (@loggers = "spacy.WandbLogger.v5" plus keyword parameters), not instantiated directly in Python, keeping the integration surface config-driven and consistent with the rest of spaCy’s config-first architecture.