-
Notifications
You must be signed in to change notification settings - Fork 592
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 predictions Image Captioning task #58
Comments
Yes you can do batch inference. |
@LiJunnan1992 Сould you explain how i can do that? Should I write my own Dataloader? |
yes you have to write your own data loader I just done it myself |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, glad to see and use this cool project, thanks you.
I have a question: if it possible to batch predictions on Image captioning task?
I see #48 but it's not my case.
i do something like:
base_model_path = 'path_to_base_model'
model_base = blip_decoder(pretrained=base_model_path, vit='base', image_size=IMAGE_SIZE)
model_base.eval()
model_base.to(device)
img = transform(sample).unsqueeze(0).to(device)
with torch.no_grad():
caption_bs_base=model_base.generate(img, sample=False, num_beams=7, max_length=16, min_length=5)
It works good, but i want to inference 4 models(vit base/large and beam search/nucleus sampling) and it's to long. On my server signature 12 pictures 4 models takes ~34 sec (12*4 = 48 signature).
Thanks you.
The text was updated successfully, but these errors were encountered: