Unverified Commit ce9e0756 authored by Lyu Han's avatar Lyu Han Committed by GitHub
Browse files

Miss meta instruction of internlm-chat model (#470)

parent e980377a
...@@ -174,8 +174,13 @@ class Vicuna(BaseModel): ...@@ -174,8 +174,13 @@ class Vicuna(BaseModel):
class InternLMChat7B(BaseModel): class InternLMChat7B(BaseModel):
"""Chat template of InternLM model.""" """Chat template of InternLM model."""
def __init__(self, def __init__(
system='', self,
system='<|System|>',
meta_instruction="""You are an AI assistant whose name is InternLM (书生·浦语).
- InternLM (书生·浦语) is a conversational language model that is developed by Shanghai AI Laboratory (上海人工智能实验室). It is designed to be helpful, honest, and harmless.
- InternLM (书生·浦语) can understand and communicate fluently in the language chosen by the user such as English and 中文.
""", # noqa: E501
user='<|User|>', user='<|User|>',
eoh='', eoh='',
eoa='<eoa>', eoa='<eoa>',
...@@ -183,6 +188,7 @@ class InternLMChat7B(BaseModel): ...@@ -183,6 +188,7 @@ class InternLMChat7B(BaseModel):
**kwargs): **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
self.system = system self.system = system
self.meta_instruction = meta_instruction
self.user = user self.user = user
self.eoh = eoh self.eoh = eoh
self.eoa = eoa self.eoa = eoa
...@@ -202,7 +208,8 @@ class InternLMChat7B(BaseModel): ...@@ -202,7 +208,8 @@ class InternLMChat7B(BaseModel):
assert self.capability == 'chat', \ assert self.capability == 'chat', \
f'{type(self).__name__} has no capability of {self.capability}' f'{type(self).__name__} has no capability of {self.capability}'
if sequence_start: if sequence_start:
return f'<BOS>{self.user}:{prompt}{self.eoh}\n' \ return f'<BOS>{self.system}:{self.meta_instruction}\n' \
f'{self.user}:{prompt}{self.eoh}\n' \
f'{self.assistant}:' f'{self.assistant}:'
else: else:
return f'\n{self.user}:{prompt}{self.eoh}\n' \ return f'\n{self.user}:{prompt}{self.eoh}\n' \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment