Skip to content

Conversation

@CristianLara
Copy link
Contributor

Summary:
TopSurfacesAnalysis requires a TorchAdapter to function correctly. This change adds validation in the validate_inputs method to ensure that a TorchAdapter is available before the analysis runs, providing a clearer error message if not.

Essentially an extension of D84641586

Without this, the top surfaces analysis fails with a much more opaque error (came up while investigating T244217568):

[ERROR 11-10 12:25:58] ax.analysis.analysis: Failed to compute TopSurfacesAnalysis
[ERROR 11-10 12:25:58] ax.analysis.analysis: Traceback (most recent call last):
  File "/var/svcscm/.bento/kernels/bento_kernel_pts/2124/bento_kernel_pts_binary-inplace#link-tree/ax/analysis/analysis.py", line 107, in compute_result
    card = self.compute(
           ^^^^^^^^^^^^^
  File "/var/svcscm/.bento/kernels/bento_kernel_pts/2124/bento_kernel_pts_binary-inplace#link-tree/ax/analysis/plotly/top_surfaces.py", line 100, in compute
    ).compute(
      ^^^^^^^^
  File "/var/svcscm/.bento/kernels/bento_kernel_pts/2124/bento_kernel_pts_binary-inplace#link-tree/ax/analysis/plotly/sensitivity.py", line 126, in compute
    relevant_adapter = assert_is_instance(
                       ^^^^^^^^^^^^^^^^^^^
  File "/var/svcscm/.bento/kernels/bento_kernel_pts/2124/bento_kernel_pts_binary-inplace#link-tree/pyre_extensions/refinement.py", line 28, in assert_is_instance
    raise TypeError(f"obj is not an instance of cls: obj={obj} cls={cls}")
TypeError: obj is not an instance of cls: obj=RandomAdapter(generator=SobolGenerator) cls=<class 'ax.adapter.torch.TorchAdapter'>

Differential Revision: D86793014

Summary:
TopSurfacesAnalysis requires a TorchAdapter to function correctly. This change adds validation in the validate_inputs method to ensure that a TorchAdapter is available before the analysis runs, providing a clearer error message if not.

Essentially an extension of D84641586

Without this, the top surfaces analysis fails with a much more opaque error (came up while investigating T244217568):

```
[ERROR 11-10 12:25:58] ax.analysis.analysis: Failed to compute TopSurfacesAnalysis
[ERROR 11-10 12:25:58] ax.analysis.analysis: Traceback (most recent call last):
  File "/var/svcscm/.bento/kernels/bento_kernel_pts/2124/bento_kernel_pts_binary-inplace#link-tree/ax/analysis/analysis.py", line 107, in compute_result
    card = self.compute(
           ^^^^^^^^^^^^^
  File "/var/svcscm/.bento/kernels/bento_kernel_pts/2124/bento_kernel_pts_binary-inplace#link-tree/ax/analysis/plotly/top_surfaces.py", line 100, in compute
    ).compute(
      ^^^^^^^^
  File "/var/svcscm/.bento/kernels/bento_kernel_pts/2124/bento_kernel_pts_binary-inplace#link-tree/ax/analysis/plotly/sensitivity.py", line 126, in compute
    relevant_adapter = assert_is_instance(
                       ^^^^^^^^^^^^^^^^^^^
  File "/var/svcscm/.bento/kernels/bento_kernel_pts/2124/bento_kernel_pts_binary-inplace#link-tree/pyre_extensions/refinement.py", line 28, in assert_is_instance
    raise TypeError(f"obj is not an instance of cls: obj={obj} cls={cls}")
TypeError: obj is not an instance of cls: obj=RandomAdapter(generator=SobolGenerator) cls=<class 'ax.adapter.torch.TorchAdapter'>
```

Differential Revision: D86793014
@meta-cla meta-cla bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Nov 11, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 11, 2025

@CristianLara has exported this pull request. If you are a Meta employee, you can view the originating Diff in D86793014.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.56%. Comparing base (4af6bea) to head (3838fbd).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4526      +/-   ##
==========================================
- Coverage   96.56%   96.56%   -0.01%     
==========================================
  Files         546      546              
  Lines       56091    56096       +5     
==========================================
+ Hits        54164    54168       +4     
- Misses       1927     1928       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants