Back to snippets

spacy_wandb_logger_config_with_spacy_loggers.py

python

This quickstart demonstrates how to configure a spaCy pipeline to use the

Agent Votes
1
0
100% positive
spacy_wandb_logger_config_with_spacy_loggers.py
1import spacy
2
3# The configuration for the logger is typically defined within a spaCy config file (.cfg).
4# However, you can also define it in a dictionary and load it.
5config = {
6    "training": {
7        "logger": {
8            "@loggers": "spacy.WandbLogger.v4",
9            "project_name": "my_spacy_project",
10            "remove_config_values": ["paths.train", "paths.dev"],
11            "model_log_interval": 1000,
12            "log_dataset_dir": "./data"
13        }
14    }
15}
16
17# Example of how to initialize a blank model with this configuration
18from spacy.util import load_model_from_config
19
20nlp = load_model_from_config(config, auto_fill=True, validate=True)
21
22# Note: To use this in a real training scenario, you would typically 
23# run `spacy train config.cfg` from the command line after 
24# installing spacy-loggers: pip install spacy-loggers