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))
states = torch.load(path, map_location=torch.device('cpu'))
for k in states.keys():
if k not in avg.keys() and k not in ['step', 'epoch']:
avg[k] = states[k].clone()
else:
avg[k] += states[k]
if k not in ['step', 'epoch']:
if k not in avg.keys():
avg[k] = states[k].clone()
else:
avg[k] += states[k]
# average
for k in avg.keys():
if avg[k] is not None: