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

Support internvl2 grounding #1473

Merged
merged 23 commits into from
Jul 24, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix
  • Loading branch information
tastelikefeet committed Jul 23, 2024
commit 79cb4895942d61138fbeef6547d0b0f2af32b725
12 changes: 12 additions & 0 deletions swift/llm/utils/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,18 @@ def preprocess(self, example):
if example.get('objects') and isinstance(example['objects'], str):
# reload grounding from str
example['objects'] = json.loads(example['objects'])
objects = []
for object in example['objects']:
# Compatible with list format
if isinstance(object, list):
object = {
'caption': object[0],
'bbox': object[1],
'bbox_type': None,
'image': 0,
}
objects.append(object)
example['objects'] = objects

# Reset system (by default value and agent tools)
system: Optional[str] = example.get('system', None)
Expand Down
Loading