rename BIGDL_OPTIMIZE_LM_HEAD to IPEX_LLM_LAST_LM_HEAD and add qwen2 (#11418)
This commit is contained in:
		
							parent
							
								
									75f836f288
								
							
						
					
					
						commit
						9e4ee61737
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -328,8 +328,8 @@ def _replace_with_low_bit_linear(model, qtype, modules_to_not_convert=None,
 | 
				
			||||||
            optimize_lm_head = False
 | 
					            optimize_lm_head = False
 | 
				
			||||||
            if is_lm_head(name, model_config, out_features):
 | 
					            if is_lm_head(name, model_config, out_features):
 | 
				
			||||||
                model_type = getattr(model_config, "model_type", None)
 | 
					                model_type = getattr(model_config, "model_type", None)
 | 
				
			||||||
                if model_type in ["gptj", "llama"] and os.environ.get("BIGDL_OPTIMIZE_LM_HEAD",
 | 
					                if model_type in ["gptj", "llama", "qwen2"] and \
 | 
				
			||||||
                                                                      None) == "1":
 | 
					                        os.environ.get("IPEX_LLM_LAST_LM_HEAD", None) == "1":
 | 
				
			||||||
                    optimize_lm_head = True
 | 
					                    optimize_lm_head = True
 | 
				
			||||||
            with init_empty_weights():
 | 
					            with init_empty_weights():
 | 
				
			||||||
                new_linear = None
 | 
					                new_linear = None
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue