Skip to content

[Benchmark][New Dataset]Added benchmark support for Unsloth Vision Datasets #19894

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

arunmadhusud
Copy link

@arunmadhusud arunmadhusud commented Jun 20, 2025

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Purpose

This PR adds support for two Hugging Face datasets from Unsloth for vision benchmarking tasks: unsloth/LaTeX_OCR and unsloth/Radiology_mini .

Test Plan

  1. Benchmark Serving
# Serve the model
vllm serve unsloth/Qwen2-VL-2B-Instruct \
    --dtype bfloat16 \
    --max-model-len 4096 \
    --max-num-seqs 5 \
    --limit-mm-per-prompt "image=1,video=0" \
    --max-seq-len-to-capture 4096 \
    --mm-processor-kwargs '{"min_pixels": 784, "max_pixels": 1003520}'
# Benchmark
python3 vllm/benchmarks/benchmark_serving.py \
  --backend openai-chat \
  --request-rate 5 \
  --max-concurrency 5 \
  --model unsloth/Qwen2-VL-2B-Instruct \
  --endpoint /v1/chat/completions \
  --dataset-name hf \
  --dataset-path unsloth/LaTeX_OCR \
  --hf-split train \
  --hf-output-len 256 \
  --num-prompts 1000 
  1. Benchmark throughput
python3 vllm/benchmarks/benchmark_throughput.py \
  --model unsloth/Qwen2-VL-2B-Instruct \
  --backend vllm-chat \
  --dataset-name hf \
  --dataset-path unsloth/LaTeX_OCR \
  --hf-split train \
  --num-prompts 1000 

Test Result

  1. Benchmark serving
============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  201.35    
Total input tokens:                      8000      
Total generated tokens:                  73002     
Request throughput (req/s):              4.97      
Output token throughput (tok/s):         362.57    
Total Token throughput (tok/s):          402.30    
---------------Time to First Token----------------
Mean TTFT (ms):                          44.91     
Median TTFT (ms):                        42.01     
P99 TTFT (ms):                           72.49     
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          5.50      
Median TPOT (ms):                        5.40      
P99 TPOT (ms):                           7.38      
---------------Inter-token Latency----------------
Mean ITL (ms):                           5.43      
Median ITL (ms):                         4.69      
P99 ITL (ms):                            32.08     
==================================================
  1. Benchmark throughput
Throughput: 40.87 requests/s, 12228.12 total tokens/s, 10461.48 output tokens/s
Total num prompt tokens:  43231
Total num output tokens:  256000

(Optional) Documentation Update

Updated benchmark README

Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @arunmadhusud, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the benchmarking capabilities by integrating new multimodal vision datasets from Unsloth. It provides the necessary infrastructure to accurately benchmark models on image-based tasks, complete with updated documentation and specific dataset handling logic.

Highlights

  • New Dataset Support: Added support for two new Hugging Face vision datasets from Unsloth: unsloth/LaTeX_OCR and unsloth/Radiology_mini. These datasets are now integrated into the benchmarking suite for both serving and throughput tests.
  • Multimodal Benchmarking Capabilities: Introduced a dedicated UnslothVisionDataset class to handle the specific structure of these multimodal datasets, ensuring that image and text prompts are correctly parsed and prepared for benchmarking, including support for multimodal chat transformations.
  • Documentation Updates: Updated the benchmarks/README.md to include the newly supported Unsloth vision datasets in the dataset table and provided clear example commands for running serving and throughput benchmarks with them.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mergify mergify bot added the qwen Related to Qwen models label Jun 20, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for Unsloth vision datasets in the benchmarking scripts. The changes involve adding a new dataset class and updating the benchmark scripts to include the new datasets. The code appears to be well-structured and follows the existing conventions. However, there are a few areas where additional checks and improvements could be made to enhance robustness and efficiency.

Comment on lines +873 to +874
if len(sampled_requests) >= num_requests:
break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding a check to ensure that the length of self.data is greater than 0 before proceeding with the sampling process. This would prevent a potential IndexError if the dataset is empty.

Suggested change
if len(sampled_requests) >= num_requests:
break
for item in self.data:
if not self.data:
break
if len(sampled_requests) >= num_requests:


for item in self.data:
if len(sampled_requests) >= num_requests:
break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It would be more efficient to check sampled_requests length before iterating through the data, potentially saving unnecessary iterations.

Suggested change
break
if len(sampled_requests) >= num_requests:
break
for item in self.data:

Comment on lines +377 to +381
elif args.dataset_path in UnslothVisionDataset.SUPPORTED_DATASET_PATHS:
dataset_cls = UnslothVisionDataset
common_kwargs['dataset_subset'] = None
common_kwargs['dataset_split'] = args.hf_split
sample_kwargs["enable_multimodal_chat"] = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding a check to ensure that args.dataset_path is not None before accessing UnslothVisionDataset.SUPPORTED_DATASET_PATHS. This would prevent a potential AttributeError if args.dataset_path is not set.

Suggested change
elif args.dataset_path in UnslothVisionDataset.SUPPORTED_DATASET_PATHS:
dataset_cls = UnslothVisionDataset
common_kwargs['dataset_subset'] = None
common_kwargs['dataset_split'] = args.hf_split
sample_kwargs["enable_multimodal_chat"] = True
elif args.dataset_path and args.dataset_path in UnslothVisionDataset.SUPPORTED_DATASET_PATHS:
dataset_cls = UnslothVisionDataset
common_kwargs['dataset_subset'] = None
common_kwargs['dataset_split'] = args.hf_split
sample_kwargs["enable_multimodal_chat"] = True

Comment on lines 534 to 538
if args.dataset_path in (
VisionArenaDataset.SUPPORTED_DATASET_PATHS.keys()
| ConversationDataset.SUPPORTED_DATASET_PATHS
| UnslothVisionDataset.SUPPORTED_DATASET_PATHS.keys()
):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding a check to ensure that args.dataset_path is not None before accessing UnslothVisionDataset.SUPPORTED_DATASET_PATHS.keys(). This would prevent a potential AttributeError if args.dataset_path is not set.

            VisionArenaDataset.SUPPORTED_DATASET_PATHS.keys()
            | ConversationDataset.SUPPORTED_DATASET_PATHS
            | (UnslothVisionDataset.SUPPORTED_DATASET_PATHS.keys() if args.dataset_path else set())

@DarkLight1337 DarkLight1337 requested review from ywang96 and mgoin June 20, 2025 09:28
Copy link
Member

@ywang96 ywang96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! This PR looks good to me but I also want @mgoin to take a look in case we want to integrate this into our CLI.

@mergify mergify bot added the performance Performance-related issues label Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance-related issues qwen Related to Qwen models
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants