Skip to content

fix(utils): Resolve backbone utils test regressions#45594

Open
harshaljanjani wants to merge 1 commit intohuggingface:mainfrom
harshaljanjani:fix/fix-backbone-test-regressions
Open

fix(utils): Resolve backbone utils test regressions#45594
harshaljanjani wants to merge 1 commit intohuggingface:mainfrom
harshaljanjani:fix/fix-backbone-test-regressions

Conversation

@harshaljanjani
Copy link
Copy Markdown
Contributor

@harshaljanjani harshaljanjani commented Apr 23, 2026

What does this PR do?

The following regressions were identified and fixed in this PR:

0c4fe5c ("Delete duplicate code in backbone utils") removed use_pretrained_backbone from load_backbone; pretrained weights are now loaded via from_pretrained on the parent. The tests in test_backbone_utils.py#L217 weren't updated likely because tests/utils/ wasn't in the run-slow scope of that PR. Updated the test to match the new design (load_backbone always initializes with random weights).
dff54ad ("out_indices always a list") made out_indices always return a list via backbone_utils.py#L57. The assertion at test_backbone_utils.py#L165 was written before that change in #28784 and still expected a tuple. Updated the assertion to expect a list.

cc: @zucchini-nlp @Rocketknight1

CI coverage fixed by this PR (checked in the latest CI run):

tests/generation/test_utils.py::GenerationIntegrationTests::test_green_red_watermark_generation, tests/utils/test_backbone_utils.py::BackboneUtilsTester::test_load_backbone_from_config, tests/utils/test_backbone_utils.py::BackboneUtilsTester::test_load_backbone_in_new_model

Current output:

6

Output after fix:

5

Code Agent Policy

  • I confirm that this is not a pure code agent PR.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline, Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you fix any necessary existing tests?

@harshaljanjani harshaljanjani marked this pull request as ready for review April 23, 2026 06:22
@github-actions github-actions Bot requested a review from ydshieh April 23, 2026 06:22
@Rocketknight1
Copy link
Copy Markdown
Member

cc @ydshieh @tarekziade maybe? We may want to consider ditching these tests if they're all slow and we don't even notice when they break!

@zucchini-nlp
Copy link
Copy Markdown
Member

Hm, I usually try to check daily CI for things that I might have broken, so prob this one slipped off the CI-bot feedback? Been quite a while since the last time "timm" was updated...

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