Skip to content

Conversation

@DN6
Copy link
Collaborator

@DN6 DN6 commented Nov 3, 2025

What does this PR do?

Some changes to make modular tests more in line with our new testing approach

  1. Remove unittest dependency
  2. Move get_pipeline to ModularPipelineTesterMixin (it's most likely going to be the same across all pipelines)
  3. Create distinction between tests and test mixins. Since we don't use unittest anymore, we need to be explicit about which objects are Mixins and which objects are actually running the tests and need attributes such as param, repo etc.
  4. Always use cpu based Generator through the self.get_generator method in ModularPipelineTesterMixin for better reproducibility (GPU based generator can introduce noise)
  5. Use torch.abs().max for comparing slices. Let's move away from np conversions. There isn't much of an advantage and when we run on GPU we can avoid .detach().cpu().numpy() calls
  6. Use single level inheritance for easier debugging.

Fixes # (issue)

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@DN6 DN6 requested a review from sayakpaul November 3, 2025 13:33
device = torch_device if torch_device != "mps" else "cpu"
generator = torch.Generator(device).manual_seed(seed)
def get_generator(self, seed=0):
generator = torch.Generator("cpu").manual_seed(seed)
Copy link
Member

Choose a reason for hiding this comment

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

(nit): torch.manual_seed(seed) is also enough.

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Very nice!

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.

3 participants