(self, sd)
| 471 | strict=load_module_strict) |
| 472 | |
| 473 | def _choose_module_key(self, sd): |
| 474 | assert not ('module' in sd |
| 475 | and 'model' in sd), "checkpoint has both 'model' and 'module' keys, not sure how to proceed" |
| 476 | assert 'module' in sd or 'model' in sd, "checkpoint contains neither 'model' or 'module' keys, not sure how to proceed" |
| 477 | if 'module' in sd: |
| 478 | return 'module' |
| 479 | elif 'model' in sd: |
| 480 | return 'model' |
| 481 | |
| 482 | def _convert_to_dtype(self, config): |
| 483 | if not isinstance(self.module, torch.nn.Module): |