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 qwen2-audio #2157

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading