Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] interlm2 chat format #1002

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Conversation

Harold-lkk
Copy link
Contributor

update internlm2 chat format

@Harold-lkk Harold-lkk marked this pull request as draft January 19, 2024 08:04
@Harold-lkk Harold-lkk marked this pull request as ready for review January 19, 2024 09:33
@irexyc
Copy link
Collaborator

irexyc commented Jan 19, 2024

lmdeploy/lmdeploy/model.py

Lines 289 to 290 in 4d1fdfe

if self.meta_instruction:
ret += f'{self.system}:{self.meta_instruction}{self.eosys}'

这个地方多了个冒号

lmdeploy/lmdeploy/model.py

Lines 265 to 273 in 4d1fdfe

assert self.capability == 'chat', \
f'{type(self).__name__} has no capability of {self.capability}'
if sequence_start:
return f'{self.system}{self.meta_instruction}{self.eosys}' \
f'{self.user}{prompt}{self.eoh}' \
f'{self.assistant}'
else:
return f'\n{self.user}{prompt}{self.eoh}' \
f'{self.assistant}'

这个地方少了 289 行的逻辑。就是如果调messages2prompt的接口的话,不传meta_instruction可以不拼f'{self.system}{self.meta_instruction}{self.eosys}',但是上面decorate_prompt是一定会拼f'{self.system}{self.meta_instruction}{self.eosys}'

@Harold-lkk
Copy link
Contributor Author

lmdeploy/lmdeploy/model.py

Lines 289 to 290 in 4d1fdfe

if self.meta_instruction:
ret += f'{self.system}:{self.meta_instruction}{self.eosys}'

这个地方多了个冒号

lmdeploy/lmdeploy/model.py

Lines 265 to 273 in 4d1fdfe

assert self.capability == 'chat', \
f'{type(self).__name__} has no capability of {self.capability}'
if sequence_start:
return f'{self.system}{self.meta_instruction}{self.eosys}' \
f'{self.user}{prompt}{self.eoh}' \
f'{self.assistant}'
else:
return f'\n{self.user}{prompt}{self.eoh}' \
f'{self.assistant}'

这个地方少了 289 行的逻辑。就是如果调messages2prompt的接口的话,不传meta_instruction可以不拼f'{self.system}{self.meta_instruction}{self.eosys}',但是上面decorate_prompt是一定会拼f'{self.system}{self.meta_instruction}{self.eosys}'

#1003

@lvhan028 lvhan028 merged commit c8dad23 into InternLM:main Jan 19, 2024
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants