(module, prefix='')
| 775 | state_dict._metadata = metadata |
| 776 | |
| 777 | def load(module, prefix=''): |
| 778 | local_metadata = {} if metadata is None else metadata.get(prefix[:-1], {}) |
| 779 | module._load_from_state_dict( |
| 780 | state_dict, prefix, local_metadata, True, missing_keys, unexpected_keys, error_msgs) |
| 781 | for name, child in module._modules.items(): |
| 782 | if child is not None: |
| 783 | load(child, prefix + name + '.') |
| 784 | load(model, prefix='' if hasattr(model, 'bert') else 'bert.') |
| 785 | if len(missing_keys) > 0: |
| 786 | logger.info("Weights of {} not initialized from pretrained model: {}".format( |
no outgoing calls
no test coverage detected