Skip to content

Add input validation to evaluate_diffusion_model#1523

Merged
xin3he merged 4 commits intoxinhe/3-10from
copilot/sub-pr-1522
Mar 10, 2026
Merged

Add input validation to evaluate_diffusion_model#1523
xin3he merged 4 commits intoxinhe/3-10from
copilot/sub-pr-1522

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

Description

evaluate_diffusion_model accepted all-optional parameters but would raise an opaque AttributeError at runtime when pipe=None and either autoround or model was also None. This adds a guard at the function entry point with a clear ValueError.

Changes:

  • auto_round/eval/evaluation.py: Validate at the top of evaluate_diffusion_model that either pipe is provided, or both autoround and model are provided — before any imports or logic runs:
    if pipe is None and (autoround is None or model is None):
        raise ValueError(
            "Either 'pipe' must be provided, or both 'autoround' and 'model' must be provided."
        )
  • test/test_cpu/advanced/test_evaluation_functions.py: Added TestEvaluateDiffusionModelValidation covering all three invalid-argument cases (all None, only autoround, only model).

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Performance improvement
  • Code refactoring
  • Other (please specify):

Related Issues

Relates to #1522

Checklist Before Submitting

  • My code has been tested locally.
  • Documentation has been updated as needed.
  • New or updated tests are included where applicable.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits March 10, 2026 02:52
Co-authored-by: xin3he <83260933+xin3he@users.noreply.github.com>
Co-authored-by: xin3he <83260933+xin3he@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on enabling --eval for diffusion model Add input validation to evaluate_diffusion_model Mar 10, 2026
@xin3he xin3he marked this pull request as ready for review March 10, 2026 02:59
@xin3he xin3he merged commit 790fdf0 into xinhe/3-10 Mar 10, 2026
1 check was pending
@xin3he xin3he deleted the copilot/sub-pr-1522 branch March 10, 2026 02:59
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.

2 participants