Skip to content

Commit

Permalink
fixed regex
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Sep 3, 2024
1 parent f722be4 commit 7dac4cc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions vision_agent/tools/meta_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,11 @@ def use_florence2_fine_tuning(

code = artifacts[name]
if task.lower() == "phrase_grounding":
pattern = r"florence2_phrase_grounding\(([^,]+),\s*([^\)]+)\)"
pattern = r"florence2_phrase_grounding\(\s*([^\)]+)\)"

def replacer(match: re.Match) -> str:
arg1 = match.group(1)
arg2 = match.group(2)
return f'florence2_phrase_grounding({arg1}, {arg2}, "{fine_tune_id}")'
arg = match.group(1) # capture all initial arguments
return f'florence2_phrase_grounding({arg}, "{fine_tune_id}")'

else:
raise ValueError(f"Task {task} is not supported.")
Expand Down

0 comments on commit 7dac4cc

Please sign in to comment.