Skip to content

fix(entry): pass the required logger to log_module_trainable_status / log_param_statistics - #503

Open
Anai-Guo wants to merge 1 commit into
opendilab:mainfrom
Anai-Guo:fix-curriculum-logger-arg
Open

fix(entry): pass the required logger to log_module_trainable_status / log_param_statistics#503
Anai-Guo wants to merge 1 commit into
opendilab:mainfrom
Anai-Guo:fix-curriculum-logger-arg

Conversation

@Anai-Guo

@Anai-Guo Anai-Guo commented Sep 1, 2026

Copy link
Copy Markdown

Problem

CurriculumController.step() in lzero/entry/train_unizero_multitask_balance_segment_ddp.py
raises TypeError the first time a curriculum stage switch happens, so the balanced-segment
multitask UniZero DDP entry crashes exactly at the moment the curriculum is supposed to advance.

Both logging helpers it calls take a mandatory logger:

# lzero/entry/utils.py:850
def log_module_trainable_status(
    module: nn.Module,
    module_name: str,
    logger: logging.Logger
) -> None:

# lzero/entry/utils.py:890
def log_param_statistics(model: nn.Module, logger: logging.Logger) -> None:

but all four call sites omit it:

# train_unizero_multitask_balance_segment_ddp.py
120:                log_module_trainable_status(vit_encoder, "ViT Encoder")
123:                log_module_trainable_status(vit_encoder, "ViT Encoder (Curriculum Not Applied)")
131:            log_module_trainable_status(transformer_backbone, "Transformer Backbone")
142:            log_param_statistics(self.policy._learn_model.world_model)

The helpers use the argument immediately and unconditionally (logger.info(...)), so there is
no default to fall back on.

Fix

Pass logging.getLogger(), which is exactly what lzero/entry/utils.py's own reference calls
use for this function:

# lzero/entry/utils.py:1035/:1040/:1045
log_module_trainable_status(model, "DummyModel", logging.getLogger())

The file already does from ditk import logging (L18) and logs through the root logger
everywhere else in this method (logging.info(...) at L115/118/122/126/129/133/141), so
logging.getLogger() routes these lines to the same place as their surrounding messages —
no new logger, no config change. logging.getLogger() is the established idiom in this repo
(lzero/agent/*.py all use it).

Verification

Signature mismatch, so no training run is needed. I extracted both helper signatures from main
(9ccf29b) by AST and replayed the call shapes through inspect.Signature.bind:

   TypeError call site :120/:123/:131  log_module_trainable_status(m, name)     (module, module_name, logger)
              -> missing a required argument: 'logger'
   OK        sibling   :1035           log_module_trainable_status(m, n, lg)    (module, module_name, logger)
   TypeError call site :142            log_param_statistics(model)              (model, logger)
              -> missing a required argument: 'logger'

🤖 Generated with Claude Code

… log_param_statistics

CurriculumController.step() in train_unizero_multitask_balance_segment_ddp.py calls both
helpers without their mandatory `logger` argument, so every curriculum stage switch dies
with a TypeError instead of logging the freeze/trainable summary.

Use `logging.getLogger()`, matching the reference calls in lzero/entry/utils.py.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant