(path:str)
| 117 | |
| 118 | @staticmethod |
| 119 | def from_str(path:str): |
| 120 | file_name = os.path.basename(path) |
| 121 | |
| 122 | if file_name.endswith('.pth'): |
| 123 | file_name = file_name[:-4] |
| 124 | |
| 125 | params = file_name.split('_') |
| 126 | |
| 127 | if file_name.endswith('interrupt'): |
| 128 | params = params[:-1] |
| 129 | |
| 130 | model_name = '_'.join(params[:-2]) |
| 131 | epoch = params[-2] |
| 132 | iteration = params[-1] |
| 133 | |
| 134 | return SavePath(model_name, int(epoch), int(iteration)) |
| 135 | |
| 136 | @staticmethod |
| 137 | def remove_interrupt(save_folder): |
no test coverage detected