(weights, map_location=None)
| 37 | |
| 38 | |
| 39 | def attempt_load(weights, map_location=None): |
| 40 | # Loads an ensemble of models weights=[a,b,c] or a single model weights=[a] or weights=a |
| 41 | model = Ensemble() |
| 42 | for w in weights if isinstance(weights, list) else [weights]: |
| 43 | attempt_download(w) |
| 44 | model.append(torch.load(w, map_location=map_location)['model'].float().fuse().eval()) # load FP32 model |
| 45 | |
| 46 | if len(model) == 1: |
| 47 | return model[-1] # return model |
| 48 | else: |
| 49 | print('Ensemble created with %s\n' % weights) |
| 50 | for k in ['names', 'stride']: |
| 51 | setattr(model, k, getattr(model[-1], k)) |
| 52 | return model # return ensemble |
| 53 | |
| 54 | |
| 55 | def gdrive_download(id='1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', name='coco128.zip'): |
nothing calls this directly
no test coverage detected