[NPU] Fix regression caused by layer_norm change (#12627)
This commit is contained in:
		
							parent
							
								
									90f6709486
								
							
						
					
					
						commit
						46eeab4479
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -472,7 +472,11 @@ class LLMBaseNNFactory(NNFactory):
 | 
			
		|||
        )
 | 
			
		||||
        eps = self.constant(self.rms_norm_eps)
 | 
			
		||||
        hidden_states = self.eltwise_div(hidden_states, self.sqrt(self.eltwise_add(variance, eps)))
 | 
			
		||||
        hidden_states = self.convert_to_fp16(hidden_states)
 | 
			
		||||
        if os.environ.get("IPEX_LLM_NPU_DRIVER_VERSION", None) in ["5716", "5733"]:
 | 
			
		||||
            # to support special drivers
 | 
			
		||||
            hidden_states = self.convert_to_fp16(hidden_states)
 | 
			
		||||
        else:
 | 
			
		||||
            layernorm_weight = self.convert_to_fp32(layernorm_weight)
 | 
			
		||||
        hidden_states = self.eltwise_mul(layernorm_weight, hidden_states)
 | 
			
		||||
        hidden_states = self.convert_to_fp16(hidden_states)
 | 
			
		||||
        return hidden_states
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue