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