mirror of https://github.com/alibaba/MNN.git
				
				
				
			LLM:Bugfix: Fix bug for set jinja cause crash when the model don't has template
This commit is contained in:
		
							parent
							
								
									1591ff114a
								
							
						
					
					
						commit
						9a3b45ec1c
					
				|  | @ -55,6 +55,7 @@ void Prompt::setParams(std::shared_ptr<LlmConfig> config) { | |||
| #ifdef LLM_USE_MINJA | ||||
|     if (config->config_.document.HasMember("jinja")) { | ||||
|         auto& document = config->config_.document["jinja"]; | ||||
|         if (document.HasMember("chat_template")) { | ||||
|             if (nullptr == mCommonTemplate.get()) { | ||||
|                 // Only create jinja once
 | ||||
|                 std::string bosToken, eosToken; | ||||
|  | @ -72,6 +73,7 @@ void Prompt::setParams(std::shared_ptr<LlmConfig> config) { | |||
|             } | ||||
|             return; | ||||
|         } | ||||
|     } | ||||
| #endif | ||||
|     mCommonTemplate.reset(); | ||||
|     mSystemPrompt = config->system_prompt(); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue