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

Batch for image captioning #51

Closed
rafstahelin opened this issue Sep 2, 2023 · 7 comments
Closed

Batch for image captioning #51

rafstahelin opened this issue Sep 2, 2023 · 7 comments

Comments

@rafstahelin
Copy link

Is anyone working on recursive folder batch script for captioning stable diffusion captions? Speed needs to be under 2 seconds for 50 tokens max per image. English phrases

@vealocia
Copy link
Contributor

vealocia commented Sep 4, 2023

Hi, @rafstahelin!
For your information, we evaluate Qwen-VL on Flickr30K caption dataset (about 1K images) with 8 gpus, a total batch size of 64 (8 images per gpu) and 30 max tokens per image. It costs about 20 seconds for whole process and 1.3 second for a batch of images (8 images).
There are lots of thing you can do to get faster inference, including but not limited to:

  • Batch inference.
  • Try our Int-4 quantized model. You can get the weights here.

@rafstahelin
Copy link
Author

That's great. However none of us use multi GPU's on runpod. Could you point me in the direction of a service to does this? Is there code to use to be able to implement this?

@ShadoWxShinigamI
Copy link

#136 Should be able to batch a directory with this. Modify as required

@FangGet
Copy link

FangGet commented Nov 6, 2023

import this file: qwen_generation_utils.py

  1. call make_context for context_token and construct a batch;
  2. call model.generate for batch generation;
  3. call decode_token to get final response

@trouble-maker007
Copy link

@ShadoWxShinigamI I found your batch code is still chat one image with model.chat, not with batch

@matankley
Copy link

@rafstahelin Were you able to run a batch successfully ?

@rafstahelin
Copy link
Author

rafstahelin commented Feb 13, 2024 via email

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

No branches or pull requests

6 participants