This commit is contained in:
lyuxiang.lx
2025-02-11 15:56:20 +08:00
parent f77c6a85aa
commit 890300513c

View File

@@ -75,10 +75,11 @@ def main():
print('Processing {}'.format(path)) print('Processing {}'.format(path))
states = torch.load(path, map_location=torch.device('cpu')) states = torch.load(path, map_location=torch.device('cpu'))
for k in states.keys(): for k in states.keys():
if k not in avg.keys() and k not in ['step', 'epoch']: if k not in ['step', 'epoch']:
avg[k] = states[k].clone() if k not in avg.keys():
else: avg[k] = states[k].clone()
avg[k] += states[k] else:
avg[k] += states[k]
# average # average
for k in avg.keys(): for k in avg.keys():
if avg[k] is not None: if avg[k] is not None: