MCPcopy Create free account
hub / github.com/QWTforGithub/T2LDM / print_load_report

Function print_load_report

utils/common.py:1565–1584  ·  view source on GitHub ↗
(load_info, model_name, weight_num, print_info=True)

Source from the content-addressed store, hash-verified

1563 return new_state_dict
1564
1565def print_load_report(load_info, model_name, weight_num, print_info=True):
1566 missing = load_info.missing_keys
1567 unexpected = load_info.unexpected_keys
1568 print(f"📦 [{model_name}] 权重加载报告:")
1569 print(f" ✔️ 成功加载参数数量: {len(list(load_info.keys_loaded)) if hasattr(load_info, 'keys_loaded') else 'N/A'}")
1570 print(f" ✔️ 成功加载参数数: {weight_num}")
1571 print(f" ⚠️ 缺失参数数: {len(missing)}")
1572 # print(f" ⚠️ 未预期参数数: {len(unexpected)}")
1573
1574 if(print_info):
1575 if missing:
1576 print("\n 🔴 缺失参数 (在模型中有, 但 checkpoint 中没有):")
1577 for k in missing:
1578 print(f" • {k}")
1579
1580 if unexpected:
1581 print("\n 🟠 未预期参数 (在 checkpoint 中有, 但模型中无对应):")
1582 for k in unexpected:
1583 print(f" • {k}")
1584 print()
1585
1586def weights_num(weights):
1587 total_params = sum(v.numel() for v in weights.values())

Callers 1

load_checkpointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected