Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
AllentDan committed Mar 11, 2024
1 parent 1a4cf76 commit 9ed42c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/vl/qwen_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def messages2prompt(self, messages, sequence_start=True):
assistant=self.eoa + self.stop_word_suffix,
system=self.eosys)
ret = ''
if self.meta_instruction is not None:
if len(messages) and messages[0]['role'] != 'system':
ret += f'{self.system}{self.meta_instruction}{self.eosys}'
for message in messages:
role = message['role']
content = message['content']
Expand Down
3 changes: 3 additions & 0 deletions examples/vl/xcomposer_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def messages2prompt(self, messages, sequence_start=True):
assistant=self.eoa + self.stop_word_suffix,
system=self.eosys)
ret = ''
if self.meta_instruction is not None:
if len(messages) and messages[0]['role'] != 'system':
ret += f'{self.system}{self.meta_instruction}{self.eosys}'
for message in messages:
role = message['role']
content = message['content']
Expand Down

0 comments on commit 9ed42c1

Please sign in to comment.