Source code for lmflow.utils.conversation_template.internlm
#!/usr/bin/env python
# coding=utf-8
# Copyright 2024 Statistics and Machine Learning Research Group. All rights reserved.
from .base import StringFormatter, TemplateComponent, ConversationTemplate
[docs]
INTERNLM2_TEMPLATE = ConversationTemplate(
template_name='internlm2',
user_formatter=StringFormatter(
template=[
TemplateComponent(type='string', content='<|im_start|>user\n{{content}}<|im_end|>\n')
]
),
assistant_formatter=StringFormatter(
template=[
TemplateComponent(type='string', content='<|im_start|>assistant\n{{content}}<|im_end|>\n')
]
),
system_formatter=StringFormatter(
template=[
TemplateComponent(type='string', content='<|im_start|>system\n{{content}}<|im_end|>\n')
]
),
special_starter=TemplateComponent(type='token', content='bos_token')
)