File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
libs/langchain_llm/langchain_llm/adapters Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -757,7 +757,7 @@ class InternLM2Template(BaseTemplate):
757
757
"- InternLM (书生·浦语) can understand and communicate fluently in the language chosen by the user such as English and 中文."
758
758
)
759
759
stop = {
760
- "strings" : ["</s>" , "[UNUSED_TOKEN_145] " ],
760
+ "strings" : ["</s>" , "<|im_end|> " ],
761
761
}
762
762
763
763
def match (self , name ) -> bool :
@@ -767,17 +767,17 @@ def match(self, name) -> bool:
767
767
def template (self ) -> str :
768
768
return (
769
769
"{% if messages[0]['role'] == 'system' %}"
770
- "{{ '<s>[UNUSED_TOKEN_146] ' + 'system\\ n' + messages[0]['content'] + '[UNUSED_TOKEN_145] ' + '\\ n' }}"
770
+ "{{ '<s><|im_start|> ' + 'system\\ n' + messages[0]['content'] + '<|im_end|> ' + '\\ n' }}"
771
771
"{% else %}"
772
- "{{ '<s>[UNUSED_TOKEN_146] ' + 'system\\ n' + system_prompt + '[UNUSED_TOKEN_145] ' + '\\ n' }}"
772
+ "{{ '<s><|im_start|> ' + 'system\\ n' + system_prompt + '<|im_end|> ' + '\\ n' }}"
773
773
"{% endif %}"
774
774
"{% for message in messages %}"
775
775
"{% if messages[0]['role'] != 'system' %}"
776
- "{{ '[UNUSED_TOKEN_146] ' + message['role'] + '\\ n' + message['content'] + '[UNUSED_TOKEN_145] ' + '\\ n' }}"
776
+ "{{ '<|im_start|> ' + message['role'] + '\\ n' + message['content'] + '<|im_end|> ' + '\\ n' }}"
777
777
"{% endif %}"
778
778
"{% endfor %}"
779
779
"{% if add_generation_prompt %}"
780
- "{{ '[UNUSED_TOKEN_146] assistant\\ n' }}"
780
+ "{{ '<|im_start|> assistant\\ n' }}"
781
781
"{% endif %}"
782
782
)
783
783
Original file line number Diff line number Diff line change @@ -757,7 +757,7 @@ class InternLM2Template(BaseTemplate):
757
757
"- InternLM (书生·浦语) can understand and communicate fluently in the language chosen by the user such as English and 中文."
758
758
)
759
759
stop = {
760
- "strings" : ["</s>" , "[UNUSED_TOKEN_145] " ],
760
+ "strings" : ["</s>" , "<|im_end|> " ],
761
761
}
762
762
763
763
def match (self , name ) -> bool :
@@ -767,17 +767,17 @@ def match(self, name) -> bool:
767
767
def template (self ) -> str :
768
768
return (
769
769
"{% if messages[0]['role'] == 'system' %}"
770
- "{{ '<s>[UNUSED_TOKEN_146] ' + 'system\\ n' + messages[0]['content'] + '[UNUSED_TOKEN_145] ' + '\\ n' }}"
770
+ "{{ '<s><|im_start|> ' + 'system\\ n' + messages[0]['content'] + '<|im_end|> ' + '\\ n' }}"
771
771
"{% else %}"
772
- "{{ '<s>[UNUSED_TOKEN_146] ' + 'system\\ n' + system_prompt + '[UNUSED_TOKEN_145] ' + '\\ n' }}"
772
+ "{{ '<s><|im_start|> ' + 'system\\ n' + system_prompt + '<|im_end|> ' + '\\ n' }}"
773
773
"{% endif %}"
774
774
"{% for message in messages %}"
775
775
"{% if messages[0]['role'] != 'system' %}"
776
- "{{ '[UNUSED_TOKEN_146] ' + message['role'] + '\\ n' + message['content'] + '[UNUSED_TOKEN_145] ' + '\\ n' }}"
776
+ "{{ '<|im_start|> ' + message['role'] + '\\ n' + message['content'] + '<|im_end|> ' + '\\ n' }}"
777
777
"{% endif %}"
778
778
"{% endfor %}"
779
779
"{% if add_generation_prompt %}"
780
- "{{ '[UNUSED_TOKEN_146] assistant\\ n' }}"
780
+ "{{ '<|im_start|> assistant\\ n' }}"
781
781
"{% endif %}"
782
782
)
783
783
You can’t perform that action at this time.
0 commit comments