(model, ckpt_path, strict=True, map_location="cpu")
| 30 | print(f"TORCH_VERSION={TORCH_VERSION} FP16_DTYPE={FP16_DTYPE}") |
| 31 | torch.set_default_tensor_type(torch.FloatTensor) |
| 32 | def load_state_dict(model, ckpt_path, strict=True, map_location="cpu"): |
| 33 | print(f"Loading model state dict from {ckpt_path} ...") |
| 34 | state_dict = load_from_pretrain(ckpt_path, map_location=map_location) |
| 35 | state_dict = state_dict.get('state_dict', state_dict) |
| 36 | model.load_state_dict(state_dict, strict=strict) |
| 37 | del state_dict |
| 38 | |
| 39 | def get_cond_control(args, batch_data, control_type, device, model=None,batch_size=None, train=True, seg_model=None): |
| 40 | # Single-control |
no test coverage detected