modelscope / modelscope/DiffSynth-Studio

Questions about batch_size

Open
#928 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.1k
Forks
1.3k
Avg merge
13h 12m
Merged PRs (30d)
45

Description

Hi, Thank you for your great work! I noticed this line in DiffSynth-Studio/diffsynth/trainers/utils.py:

dataloader = torch.utils.data.DataLoader(dataset, shuffle=True, collate_fn=lambda x: x[0], num_workers=num_workers)

It keeps only the first sample of every batch, so the effective batch size becomes 1 no matter what we set. Could you kindly explain the reasoning behind this design choice? Was it intentional to limit each batch to a single sample, or is there a specific use case this addresses?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the DataLoader call in DiffSynth-Studio/diffsynth/trainers/utils.py and checking how its dataset and batch settings are used elsewhere. Determine whether collate_fn=lambda x: x[0] is intentional for diffusion training or makes batch_size ineffective. Done means clarifying the rationale and expected batch behavior in the issue or relevant documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.