{"library":"spacy-loggers","title":"spaCy Loggers","description":"spacy-loggers is a Python library that provides logging utilities for spaCy v3.2 and newer, allowing integration with various MLOps tools and machine learning frameworks. It currently supports Weights & Biases, MLflow, ClearML, PyTorch, and CuPy, offering a way to track training metrics and model artifacts independently from the core spaCy library. The current version is 1.0.5, with an active release cadence that regularly introduces new loggers and updates existing ones.","status":"active","version":"1.0.5","language":"en","source_language":"en","source_url":"https://github.com/explosion/spacy-loggers","tags":["spacy","logging","MLOps","Wandb","MLflow","ClearML","PyTorch","Cupy","training","experiment-tracking"],"install":[{"cmd":"pip install spacy-loggers","lang":"bash","label":"Install `spacy-loggers`"},{"cmd":"pip install spacy-loggers[wandb] spacy-loggers[mlflow] spacy-loggers[clearml] spacy-loggers[torch] spacy-loggers[cupy]","lang":"bash","label":"Install with all optional dependencies"}],"dependencies":[{"reason":"Core dependency for spaCy training and pipelines.","package":"spacy","optional":false},{"reason":"Required for using `spacy.WandbLogger`.","package":"wandb","optional":true},{"reason":"Required for using `spacy.MLflowLogger`.","package":"mlflow","optional":true},{"reason":"Required for using `spacy.ClearMLLogger`.","package":"clearml","optional":true},{"reason":"Required for using `spacy.PyTorchLogger`.","package":"torch","optional":true},{"reason":"Required for using `spacy.CupyLogger`.","package":"cupy","optional":true}],"imports":[{"symbol":"WandbLogger.v5","correct":"@loggers = \"spacy.WandbLogger.v5\""},{"symbol":"MLflowLogger.v2","correct":"@loggers = \"spacy.MLflowLogger.v2\""},{"symbol":"ClearMLLogger.v2","correct":"@loggers = \"spacy.ClearMLLogger.v2\""},{"symbol":"ChainLogger.v1","correct":"@loggers = \"spacy.ChainLogger.v1\""},{"symbol":"PyTorchLogger.v1","correct":"@loggers = \"spacy.PyTorchLogger.v1\""},{"symbol":"CupyLogger.v1","correct":"@loggers = \"spacy.CupyLogger.v1\""}],"quickstart":{"code":"# Example config.cfg snippet for Weights & Biases logging\n# This file is typically used with `python -m spacy train config.cfg`\n\n[training.logger]\n@loggers = \"spacy.WandbLogger.v5\"\nproject_name = \"my_spacy_project\"\nremove_config_values = [\"paths.train\", \"paths.dev\"]\n\n# To combine with console logging (required for v5+ if console output is desired)\n# [training.logger]\n# @loggers = \"spacy.ChainLogger.v1\"\n# loggers = [\n#   { \"@loggers\": \"spacy.ConsoleLogger.v2\" },\n#   { \"@loggers\": \"spacy.WandbLogger.v5\", \"project_name\": \"my_spacy_project\" }\n# ]\n","lang":"ini","description":"spaCy loggers are typically configured within the `config.cfg` file used for `spacy train`. The `@loggers` key under `[training.logger]` specifies which logger to use. Ensure the respective external logging library (e.g., `wandb`) is installed and configured (e.g., `wandb login`)."},"warnings":[{"fix":"Update your `config.cfg` to use `spacy.ChainLogger.v1` and explicitly include `spacy.ConsoleLogger.v2` in the `loggers` list, for example:\n```ini\n[training.logger]\n@loggers = \"spacy.ChainLogger.v1\"\nloggers = [\n  { \"@loggers\": \"spacy.ConsoleLogger.v2\" },\n  { \"@loggers\": \"spacy.WandbLogger.v5\", \"project_name\": \"my_project\" }\n]\n```","message":"Starting with `spacy.WandbLogger.v5`, `spacy.MLflowLogger.v2`, and `spacy.ClearMLLogger.v2`, these loggers no longer automatically call the default console logger. If you want console output alongside these, you must explicitly use `spacy.ChainLogger.v1` and include `spacy.ConsoleLogger.v2` in the chain.","severity":"breaking","affected_versions":">=1.0.5 (WandbLogger.v5), >=1.0.4 (ClearMLLogger.v2), >=1.0.3 (MLflowLogger.v2)"},{"fix":"Prefer `python -m spacy train config.cfg` for training pipelines when using `spacy-loggers` for experiment tracking. If using Prodigy, consider setting up a spaCy project file to orchestrate `prodigy data-to-spacy` followed by `spacy train`.","message":"The `prodigy train` command (from Prodigy, a related annotation tool) overrides logger settings in its configuration. Therefore, `spacy-loggers` integrations might not function as expected when training via `prodigy train`. It is recommended to use `python -m spacy train` with your `config.cfg` for full logger functionality.","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure all required external MLOps libraries are installed (`pip install spacy-loggers[<integration>]`) and configured according to their official documentation before running spaCy training with the respective logger.","message":"Each external logger (Weights & Biases, MLflow, ClearML) requires its respective library to be installed separately and may need initial configuration (e.g., `pip install wandb && wandb login`, `pip install mlflow`, `pip install clearml && clearml-init`). Without these, the loggers will not function correctly.","severity":"gotcha","affected_versions":"All"},{"fix":"Set required MLflow environment variables (e.g., `export MLFLOW_TRACKING_URI=http://your-mlflow-server:5000`) in your shell session or script before executing `python -m spacy train`.","message":"When using `spacy.MLflowLogger.v2` for remote MLflow tracking, environment variables such as `MLFLOW_TRACKING_URI` must be correctly set before launching `spacy train`. Forgetting to do so may result in silent failures or local logging instead of remote.","severity":"gotcha","affected_versions":"All"},{"fix":"Be aware that `log_custom_stats` with `MLflowLogger.v2` might log more data than strictly specified by the regexps. Review MLflow logs for unwanted metrics. For strict control, a custom logger might be needed.","message":"The `spacy.MLflowLogger.v2`'s `log_custom_stats` parameter is intended to filter logged metrics, but it currently logs all metrics internally before applying the regex filters. This can lead to more data being logged than intended if not aware of the behavior.","severity":"gotcha","affected_versions":">=1.0.3"}],"env_vars":null,"last_verified":"2026-04-06T00:00:00.000Z","next_check":"2026-07-05T00:00:00.000Z"}