Skip to content

Commit f7a586a

Browse files
yaqiangsunJintao-Huang
authored andcommitted
[model] Fix FlorenceTemplate for florence2 (#4871)
1 parent b02c73a commit f7a586a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

swift/llm/template/template/microsoft.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ def decode(self, generate_ids: List[int], **kwargs) -> Any:
6868
image_size = None
6969
if images:
7070
image_size = (images[0].width, images[0].height)
71-
return json.dumps(
72-
self.processor.post_process_generation(response, task=template_inputs.query, image_size=image_size))
71+
query_before, query_sep, query_after = template_inputs.query.partition('>')
72+
task = query_before + query_sep if query_sep else ''
73+
return json.dumps(self.processor.post_process_generation(response, task=task, image_size=image_size))
7374

7475

7576
register_template(

0 commit comments

Comments
 (0)