| | |
| | | if excludes is not None: |
| | | if isinstance(excludes, str): |
| | | excludes = excludes.split(",") |
| | | |
| | | logging.info(f"excludes: {excludes}") |
| | | |
| | | for k in dst_state.keys(): |
| | | |
| | | for k_ex in excludes: |
| | | if k.startswith(k_ex): |
| | | logging.info(f"key: {{k}} matching: {k_ex}, excluded") |
| | | continue |
| | | 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") |
| | | excludes_flag = True |
| | | break |
| | | if excludes_flag: |
| | | continue |
| | | |
| | | k_src = k |
| | | |
| | |
| | | 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}") |