Skip to content

Test model imports with older TorchAO installations - #15117

Open
wpyaoxueros wants to merge 1 commit into
huggingface:mainfrom
wpyaoxueros:codex/torchao-import-regression
Open

wpyaoxueros wants to merge 1 commit into
huggingface:mainfrom
wpyaoxueros:codex/torchao-import-regression

Conversation

@wpyaoxueros

Copy link
Copy Markdown

What does this PR do?

Add isolated regression coverage for the old-TorchAO model-import failure fixed by #15095 (reported in #15085). This changes only tests/others/test_dependencies.py; the merged runtime fix is unchanged.

The test places a minimal TorchAO 0.14.1 package and distribution metadata on a subprocess's PYTHONPATH, verifies Diffusers recognizes the installed older version, and imports the real UNet2DModel and DDPMPipeline classes. The stand-in deliberately lacks the newer FqnToConfig export. It does not monkeypatch Diffusers availability/version helpers, install TorchAO, or download model weights. The subprocess isolates optional-dependency detection from the parent test process; the case skips when PyTorch is disabled.

Validation

All checks ran on the designated remote Linux workstation, Python 3.11.17 / PyTorch 2.6.0+cu124, against main 48cdbaef5ee3d718aaee392b44f2099ae511c4a5:

  • python -m pytest -q tests/others/test_dependencies.py: 5 passed.
  • The exact same new test with only the Fix model imports when torchao is older than 0.15 #15095 version guard reverted: 1 failed, with cannot import name 'FqnToConfig'; restoring the guard passes. No runtime modification is included in the PR.
  • USE_TORCH=0 python -m pytest -q tests/others/test_dependencies.py -k old_torchao: 1 skipped.
  • make style and make fix-copies completed; an unrelated generated loader-init change was reverted. Final changed-file Ruff check/format, utils/check_ai.py, utils/check_copies.py, utils/check_dummies.py, and git diff --check pass.

The full Diffusers suite and Windows/macOS were not run.

Self-review notes

Reviewed against .ai/references/review-rules.md, coding-style and testing guidance. No blocking technical findings or dead code found. The fixture represents the optional dependency's package/metadata boundary, and the regression demonstrably fails when the production guard is removed. No new pipeline, model, runtime behavior or documentation surface is added.

AI disclosure: Codex prepared the test, performed the remote validation and self-review, wrote this description, and submitted the PR on behalf of @wpyaoxueros at the contributor's explicit request. No independent human review or personally executed human tests are claimed.

Add isolated regression coverage for the version guard from huggingface#15095. Codex prepared the test, ran remote validation, and submitted it at the contributor request; no human review is claimed.

Co-authored-by: Codex <noreply@openai.com>
@github-actions github-actions Bot added tests size/S PR with diff < 50 LOC labels Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi @wpyaoxueros, 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.

Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice.

Once the PR links an issue (or gets the no-issue-needed label), you can ignore this message — it stays here as a comment, but it no longer applies.

This branch has not been deployed

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

Labels

size/S PR with diff < 50 LOC tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant