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))])
 | 
			
		||||
        finally:
 | 
			
		||||
            if self.device == "xpu":
 | 
			
		||||
                torch.xpu.synchronize()
 | 
			
		||||
                torch.xpu.empty_cache()
 | 
			
		||||
            del self.model
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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