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