What gatle-ignite init writes, minus its file docstring. It trains as it stands, so it is also the shortest correct answer to "what must a config say?". The tables below are the menu of what else it could say.
configs/my_project_v0.py
frompathlibimportPathfromconfigs.base_utilsimportckpt_dirfromgatle_igniteimportbase_configIN_DIM=64N_CLASSES=10defget_config():cfg=base_config()# pre-fills every optional field; override only what you needcfg.name=Path(__file__).stem# -> "my_project_v0". Names the run and its checkpoints.cfg.project_name="my_project"cfg.save_dir=ckpt_dir(cfg.name)cfg.main_runner="trainer.my_project_trainer"cfg.model_name="models.mlp"cfg.model_params={"in_dim":IN_DIM,"hidden":128,"n_classes":N_CLASSES}# Batch size lives in each split's params, not at the top level.common={"in_dim":IN_DIM,"n_classes":N_CLASSES,"bs":64,"num_workers":0}cfg.train_ds_name="dataloaders.synthetic_dataset"cfg.train_ds_params={**common,"n":2048,"seed":0,"shuffle":True,"drop_last":True}cfg.valid_ds_name="dataloaders.synthetic_dataset"cfg.valid_ds_params={**common,"n":512,"seed":0,"shuffle":False}# A weighted sum even with one term, so a second term is one more entry. src_name# selects from the model's output dict, tgt_name from prep_batch's dict.cfg.criterion_name="gatle_ignite.losses.composite"cfg.criterion_params={"dict_of_loss_params":{"ce":{"cls_name":"losses.loss_functions.cross_entropy","loss_params":{"src_name":"logits","tgt_name":("targets","labels")},"weight":1.0,}}}cfg.optimizer_name="gatle_ignite.optimizers.adamw"cfg.optimizer_params={"lr":1e-3,"weight_decay":0.01}cfg.lr_scheduler="gatle_ignite.schedulers.warmup_cosine"cfg.lr_scheduler_params={"warmup_epochs":1}cfg.max_epochs=15cfg.val_metrics={"acc":{"cls_name":"metrics.accuracy","params":{"src_name":"logits","tgt_name":("targets","labels")},}}# score_factor = -1 for a lower-is-better score: checkpointing keeps the max.cfg.score_name="valid/acc"cfg.score_factor=1cfg.logger_name=["text"]# "wandb" and "discord" are also built incfg.amp_dtype="fp32"# "bf16" once you are on a GPU that has itreturncfg
These are known to the framework but deliberately absent from base_config(), because their presence is what carries the meaning. A ConfigDict accepts new keys, so a config sets them directly.
Field
Meaning
valid_ds_name
Dotted path to the validation dataset module. Absent -> no evaluator engine.
valid_ds_params
Params passed to the validation get_ds.
test_ds_name
Dotted path to the test dataset module. Absent -> no tester engine.
test_ds_params
Params passed to the test get_ds.
run
Presence puts the trainer in inference mode: load a checkpoint and evaluate, never train.
load_from_ckpt
Which checkpoint inference mode loads: "best" (default) or "latest".
wandb_entity
W&B entity to log under. Absent -> your default entity.
discord_url
Discord webhook URL. Prefer the DISCORD_WEBHOOK_URL env var: a webhook is a credential.