(path)
| 114 | torch.save(state, '{}/{}_iter_{}.pth.tar'.format(path, filename, step)) |
| 115 | |
| 116 | def load_last_iter(path): |
| 117 | if os.path.isfile(path): |
| 118 | checkpoint = torch.load(path, map_location='cpu') |
| 119 | dist.barrier() |
| 120 | print("=> loaded last_iter={} from {}".format(checkpoint['step'], path)) |
| 121 | dist.barrier() |
| 122 | return checkpoint['step'] |
| 123 | else: |
| 124 | raise RuntimeError("=> no checkpoint found at {}".format(path)) |
| 125 | |
| 126 | |
| 127 | def remove_prefix_string(string, prefix): |