fix ppl (#10996)
This commit is contained in:
parent
04d5a900e1
commit
99255fe36e
2 changed files with 4 additions and 3 deletions
|
|
@ -74,8 +74,9 @@ class BigDLPPL:
|
|||
|
||||
ppl_mean = np.mean(np.array(ppls)[~np.isnan(np.array(ppls))])
|
||||
finally:
|
||||
torch.xpu.synchronize()
|
||||
torch.xpu.empty_cache()
|
||||
if self.device == "xpu":
|
||||
torch.xpu.synchronize()
|
||||
torch.xpu.empty_cache()
|
||||
del self.model
|
||||
gc.collect()
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ def main():
|
|||
dumped = json.dumps(results, indent=2)
|
||||
print(dumped)
|
||||
|
||||
if args.output_path:
|
||||
if output_path:
|
||||
with open(f"{log_dir}/result.json", "w") as f:
|
||||
f.write(dumped)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue