(module: torch.nn.Module, prefix: str = "")
| 169 | # PyTorch's `_load_from_state_dict` does not copy parameters in a module's descendants |
| 170 | # so we need to apply the function recursively. |
| 171 | def load(module: torch.nn.Module, prefix: str = ""): |
| 172 | args = (state_dict, prefix, {}, True, [], [], error_msgs) |
| 173 | module._load_from_state_dict(*args) |
| 174 | |
| 175 | for name, child in module._modules.items(): |
| 176 | if child is not None: |
| 177 | load(child, prefix + name + ".") |
| 178 | |
| 179 | load(model_to_load) |
| 180 |
no outgoing calls
no test coverage detected