Skip to content

Add distributed image captioning example#4096

Open
ZAID646 wants to merge 1 commit into
huggingface:mainfrom
ZAID646:main
Open

Add distributed image captioning example#4096
ZAID646 wants to merge 1 commit into
huggingface:mainfrom
ZAID646:main

Conversation

@ZAID646

@ZAID646 ZAID646 commented Jul 1, 2026

Copy link
Copy Markdown

This PR adds a distributed image captioning example to accelerate.

Summary

  • New script: examples/inference/distributed/distributed_image_captioning.py
  • Demonstrates distributed inference using PartialState, split_between_processes, and gather_object
  • Uses BLIP-2 (configurable) for image captioning with dataset inputs (Flickr30k by default)
  • Serializes results as images + captions.json for downstream use

Related Issue

Closes #3078

What it shows

  • How to split batches of images across multiple GPUs for caption generation
  • How to gather string results across processes with gather_object
  • How to serialize generated artifacts (images and caption metadata)

Usage

accelerate launch --num_processes {NUM_GPUS} examples/inference/distributed/distributed_image_captioning.py --batch_size 8

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.

[Community Contributions] examples on distributed inference using 🤗 Accelerate

1 participant