This commit is contained in:
ZehuaCao 2024-05-13 13:57:19 +08:00 committed by GitHub
parent 04d5a900e1
commit 99255fe36e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -74,6 +74,7 @@ class BigDLPPL:
ppl_mean = np.mean(np.array(ppls)[~np.isnan(np.array(ppls))])
finally:
if self.device == "xpu":
torch.xpu.synchronize()
torch.xpu.empty_cache()
del self.model

View file

@ -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)