intersect_dicts() in hubconf.py fix (#5542)

This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-11-06 15:41:17 +01:00
1 parent fa2344cdd8
commit e189fa15ea
4 files changed
+10 -12

No files matched your search

+5
View File
@@ -125,6 +125,11 @@ def init_seeds(seed=0):
cudnn.benchmark, cudnn.deterministic = (False, True) if seed == 0 else (True, False)
def intersect_dicts(da, db, exclude=()):
# Dictionary intersection of matching keys and shapes, omitting 'exclude' keys, using da values
return {k: v for k, v in da.items() if k in db and not any(x in k for x in exclude) and v.shape == db[k].shape}
def get_latest_run(search_dir='.'):
# Return path to most recent 'last.pt' in /runs (i.e. to --resume from)
last_list = glob.glob(f'{search_dir}/**/last*.pt', recursive=True)