Skip to content

Fix FlorenceTemplate for florence2 #4871

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

Merged
merged 3 commits into from
Jul 11, 2025
Merged

Conversation

yaqiangsun
Copy link
Contributor

Remove description when using task_prompts_with_input mode to get correct task.

self.task_prompts_with_input = {
            '<CAPTION_TO_PHRASE_GROUNDING>': "Locate the phrases in the caption: {input}",
            '<REFERRING_EXPRESSION_SEGMENTATION>': 'Locate {input} in the image with mask',
            '<REGION_TO_SEGMENTATION>': 'What is the polygon mask of region {input}',
            '<OPEN_VOCABULARY_DETECTION>': 'Locate {input} in the image.',
            '<REGION_TO_CATEGORY>': 'What is the region {input}?',
            '<REGION_TO_DESCRIPTION>': 'What does the region {input} describe?',
            '<REGION_TO_OCR>': 'What text is in the region {input}?',
        }

When using the mode in task_prompts_with_input, such as <OPEN_VOCABULARY_DETECTION>, the input should be like '<OPEN_VOCABULARY_DETECTION>animals'. And in post_process_generation, it should be <OPEN_VOCABULARY_DETECTION>.

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

Write the detail information belongs to this PR.

Experiment results

Paste your experiment result here(if needed).

Remove description when using task_prompts_with_input mode to get correct task.
@Jintao-Huang
Copy link
Collaborator

thanks!

@Jintao-Huang
Copy link
Collaborator

please run:

pip install pre-commit
pre-commit run --all-files

@yaqiangsun
Copy link
Contributor Author

@Jintao-Huang I have run the it, and update the PR.

please run:

pip install pre-commit
pre-commit run --all-files

@Jintao-Huang Jintao-Huang merged commit 7772c6b into modelscope:main Jul 11, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants