From 75933bfaee0c20efb54c0c91bed6d33d31abff8e Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Mon, 25 May 2026 23:58:45 +0100 Subject: [PATCH] feat(native_transformer): log per-phase progress to reduce load silence The native loader was emitting one line at dispatch, a single line after prefix detection, and the total time at the end. For an 18 GB transformer that meant ~60s of silence with no indication anything was happening. Add DEBUG lines before each long phase: read_state_dict, optional converter, load_state_dict into the model, and dtype cast. Total-time log at the end is unchanged. --- pipelines/native_transformer.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pipelines/native_transformer.py b/pipelines/native_transformer.py index df682d051..9fb6ef2c1 100644 --- a/pipelines/native_transformer.py +++ b/pipelines/native_transformer.py @@ -214,6 +214,7 @@ def load( ) quant_type = model_quant.get_quant_type(quant_args) + log.debug(f'Load model: native_transformer reading state_dict cls={spec.cls.__name__} file="{os.path.basename(local_file)}"') state_dict = sd_models.read_state_dict(local_file, what="transformer") state_dict = strip_prefix(state_dict, spec.prefixes, spec.cls.__name__) check_forbidden_markers(state_dict, spec.forbidden_markers, spec.cls.__name__, local_file) @@ -393,13 +394,20 @@ def build_component( (ignored for siblings). """ try: - sd = converter(state_dict) if converter is not None else state_dict + if converter is not None: + log.debug(f'Load model: native_transformer {component_name} converter={converter.__name__} keys={len(state_dict)}') + sd = converter(state_dict) + else: + sd = state_dict + log.debug(f'Load model: native_transformer {component_name} loading keys={len(sd)} cls={cls.__name__}') component = cls.from_config(config) missing, unexpected = component.load_state_dict(sd, strict=False) validate_state_dict_load(component_name, missing, unexpected, acceptable_missing) del sd devices.torch_gc() - component = component.to(dtype=dtype if dtype is not None else devices.dtype) + target_dtype = dtype if dtype is not None else devices.dtype + log.debug(f'Load model: native_transformer {component_name} cast dtype={target_dtype}') + component = component.to(dtype=target_dtype) except Exception as e: log.error(f"Load model: native_transformer {component_name} load failed: {e}") errors.display(e, "Load")