Skip to content

Include module name and type in validation error messages#823

Open
RohithVangalla1 wants to merge 1 commit into
meta-pytorch:mainfrom
RohithVangalla1:fix/module-validator-include-module-name-in-errors
Open

Include module name and type in validation error messages#823
RohithVangalla1 wants to merge 1 commit into
meta-pytorch:mainfrom
RohithVangalla1:fix/module-validator-include-module-name-in-errors

Conversation

@RohithVangalla1
Copy link
Copy Markdown

@RohithVangalla1 RohithVangalla1 commented May 22, 2026

Previously, validation errors from ModuleValidator.validate() did not indicate which specific sub-module caused the failure. For models with many layers, this made debugging DP compatibility issues difficult — users had to manually inspect each layer to find the offending module.

This change prepends the module path and type to each validation error message. For example, instead of:
'BatchNorm cannot support DP'
users now see:
'encoder.layer.3.norm (BatchNorm2d): BatchNorm cannot support DP'

This makes it immediately clear which layer needs to be replaced, especially in large models with hundreds of sub-modules.

Addresses the TODO:
'use module name here - it's useful part of error message'

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Docs change / refactoring / dependency upgrade

Motivation and Context / Related issue

How Has This Been Tested (if it applies)

Checklist

  • The documentation is up-to-date with the changes I made.
  • I have read the CONTRIBUTING document and completed the CLA (see CONTRIBUTING).
  • All tests passed, and additional code has been covered with new tests.

Previously, validation errors from ModuleValidator.validate() did not
indicate which specific sub-module caused the failure. For models with
many layers, this made debugging DP compatibility issues difficult —
users had to manually inspect each layer to find the offending module.

This change prepends the module path and type to each validation error
message. For example, instead of:
  'BatchNorm cannot support DP'
users now see:
  'encoder.layer.3.norm (BatchNorm2d): BatchNorm cannot support DP'

This makes it immediately clear which layer needs to be replaced,
especially in large models with hundreds of sub-modules.

Addresses the TODO:
  'use module name here - it's useful part of error message'
@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 22, 2026

Hi @RohithVangalla1!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

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.

1 participant