(self, sd)
| 502 | strict=load_module_strict) |
| 503 | |
| 504 | def _choose_module_key(self, sd): |
| 505 | assert not ('module' in sd |
| 506 | and 'model' in sd), "checkpoint has both 'model' and 'module' keys, not sure how to proceed" |
| 507 | assert 'module' in sd or 'model' in sd, "checkpoint contains neither 'model' or 'module' keys, not sure how to proceed" |
| 508 | if 'module' in sd: |
| 509 | return 'module' |
| 510 | elif 'model' in sd: |
| 511 | return 'model' |
| 512 | |
| 513 | def _convert_to_dtype(self, config): |
| 514 | if not isinstance(self.module, torch.nn.Module): |