Skip to content

[tests] port final set of model tests and others#13974

Open
sayakpaul wants to merge 3 commits into
mainfrom
final-model-level-tests
Open

[tests] port final set of model tests and others#13974
sayakpaul wants to merge 3 commits into
mainfrom
final-model-level-tests

Conversation

@sayakpaul

@sayakpaul sayakpaul commented Jun 17, 2026

Copy link
Copy Markdown
Member

What does this PR do?

  • Port the remaining model tests to use our new mixins and remove the monolithic ModelTesterMixin class.
  • Port the remaining standalone testing classes to use pytest.

I have run all the GPU tests, too (and they pass).

@github-actions github-actions Bot added tests size/L PR with diff > 200 LOC labels Jun 17, 2026
@sayakpaul sayakpaul requested review from DN6, danieldk and dg845 and removed request for danieldk June 17, 2026 06:17
@sayakpaul

Copy link
Copy Markdown
Member Author

Failing tests are also exist on main.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @sayakpaul, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Fixes #1234) to the PR description so the issue is linked. See the contribution guide for more details. If this PR intentionally does not fix a tracked issue, a maintainer can add the no-issue-needed label to silence this reminder.

Comment on lines -93 to -94
class SanaVideoTransformerCompileTests(TorchCompileTesterMixin, unittest.TestCase):
model_class = SanaVideoTransformer3DModel

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like SanaVideoTransformer3DModel previously had a TorchCompileTesterMixin test subclass that got removed, would it be possible to add it back?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I intentionally didn't add it because it's not used much.

pass


class TestConsisIDTransformerTraining(ConsisIDTransformerTesterConfig, TrainingTesterMixin):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think ConsisIDTransformer3DModel is the only model that didn't get an AttentionTesterMixin test subclass, is this intentional?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ConsisIDTransformer3DModel uses a custom attention processor and in the old suite it had uses_custom_attn_processor = True, which exempted it from the attention-processor tests.

Comment on lines +98 to -123
def output_shape(self) -> tuple:
return (2, 4, 8, 8)

@property
def output_shape(self):
return (1, 4, 8, 8)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like the CogVideoX-1.5 test output_shape was changed from (1, 4, 8, 8) to (2, 4, 8, 8), is this intentional?

@sayakpaul sayakpaul Jun 17, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

1.5 config's dummy input uses num_frames=2 (vs num_frames=1 for base CogVideoX), and the transformer outputs the same frame count, so the true per-sample output is (2, 4, 8, 8).

The old (1, 4, 8, 8) was actually inconsistent with its own num_frames=2 input and it never tripped a test because the old test_output checked output.shape against the input tensor, not the declared output_shape; the declared value was only used to build the training-loss noise, where (2,1,4,8,8) happened to broadcast against the (2,2,4,8,8) output. I set it to the model's actual output shape so the loss target is built correctly instead of relying on broadcasting.

def test_missing_key_loading_warning_message(self):
with self.assertLogs("diffusers.models.modeling_utils", level="WARNING") as logs:
logger = logging.getLogger("diffusers.models.modeling_utils")
with CaptureLogger(logger) as cap_logger:
UNet2DConditionModel.from_pretrained("hf-internal-testing/stable-diffusion-broken", subfolder="unet")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would it be better to use pytest's caplog fixture here?

@dg845 dg845 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR! Left some comments :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L PR with diff > 200 LOC tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants