游雁
2024-07-01 92b14aaa2a98e2872f1c8b62551ecaf82bc5688a
funasr/train_utils/load_pretrained_model.py
@@ -56,11 +56,15 @@
    logging.info(f"excludes: {excludes}")
    for k in dst_state.keys():
        excludes_flag = False
        if excludes is not None:
            for k_ex in excludes:
                if k.startswith(k_ex):
                    logging.info(f"key: {{k}} matching: {k_ex}, excluded")
                    continue
                    logging.info(f"key: {k} matching: {k_ex}, excluded")
                    excludes_flag = True
                    break
        if excludes_flag:
            continue
        k_src = k
@@ -92,7 +96,7 @@
                dst_state[k] = src_state[k_src]
        else:
            logging.info(f"Warning, miss key in ckpt: {k}, mapped: {k_src}")
            print(f"Warning, miss key in ckpt: {k}, {path}")
    flag = obj.load_state_dict(dst_state, strict=True)
    logging.info(f"Loading ckpt: {path}, status: {flag}")