Skip to content

Commit

Permalink
fix yi
Browse files Browse the repository at this point in the history
  • Loading branch information
AllentDan committed Mar 7, 2024
1 parent bff5c43 commit c7d83fd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lmdeploy/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,14 @@ def get_prompt(self, prompt, sequence_start=True):
if self.capability == 'completion':
return prompt
if sequence_start:
return f'{self.system}{self.meta_instruction}{self.eosys}' \
f'{self.user}{prompt}{self.eoh}' \
f'{self.assistant}'
# None is different from ''
if self.meta_instruction is not None:
return f'{self.system}{self.meta_instruction}{self.eosys}' \
f'{self.user}{prompt}{self.eoh}' \
f'{self.assistant}'
else:
return f'{self.user}{prompt}{self.eoh}' \
f'{self.assistant}'
else:
return f'{self.separator}{self.user}{prompt}{self.eoh}' \
f'{self.assistant}'
Expand Down Expand Up @@ -702,7 +707,7 @@ class Yi(BaseChatTemplate):

def __init__(self,
system='<|im_start|>system\n',
meta_instruction='',
meta_instruction=None,
eosys='<|im_end|>\n',
user='<|im_start|>user\n',
eoh='<|im_end|>\n',
Expand Down

0 comments on commit c7d83fd

Please sign in to comment.