Skip to content

Commit

Permalink
fix qwen2-audio (#2157)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jintao-Huang authored Sep 29, 2024
1 parent 91e9751 commit 6330c70
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions swift/llm/utils/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,9 @@ def add_default_tags(self, example: Dict[str, Any]) -> None:
num_new_tags = num_media - num_media_tags
assert num_new_tags >= 0, f'Number of media: {num_media}, number of media_tags: {num_media_tags}'
history[0][0] = media_tag * num_new_tags + history[0][0]

example['query'], example['response'] = history[-1]
example['query'] = history[-1][0]
if example.get('response') is not None:
example['response'] = history[-1][1]
example['history'] = history[:-1]

def replace_media_tags(self, example) -> None:
Expand Down Expand Up @@ -2106,10 +2107,10 @@ class Internlm2Template(ChatmlTemplate):


def replace_img_tag(query: str,
response: str,
response: Optional[str],
history: History,
replace_token: str,
pattern=r'<img>(.+?)</img>') -> Tuple[str, History, List[str]]:
pattern=r'<img>(.+?)</img>') -> Tuple[str, Optional[str], History, List[str]]:
images_path = []
new_history = []
history.append([query, response])
Expand Down

0 comments on commit 6330c70

Please sign in to comment.