load model
(filepath: str, **kwargs)
| 120 | |
| 121 | # resuming training |
| 122 | def load(filepath: str, **kwargs): |
| 123 | """ load model """ |
| 124 | if not filepath.startswith("hdfs://"): |
| 125 | return torch.load(filepath, **kwargs) |
| 126 | with hopen(filepath, "rb") as reader: |
| 127 | accessor = io.BytesIO(reader.read()) |
| 128 | state_dict = torch.load(accessor, **kwargs) |
| 129 | del accessor |
| 130 | return state_dict |
| 131 | |
| 132 | def load_from_pretrain(pretrain_path, map_location='cpu'): |
| 133 |
no test coverage detected