pytorch - 💡(How to fix) Fix DISABLED test_lazy_init_with_view (__main__.LazyFuncionalizationTest)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Traceback (most recent call last): File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 64, in test_lazy_init_with_view lazy_out_1 = f("lazy", reset_storage=False) File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 19, in f torch.manual_seed(2023) File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 22, in torch_dynamo_resume_in_f_at_19 metrics.reset() File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 24, in torch_dynamo_resume_in_f_at_22 class Model(torch.nn.Module): File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 51, in torch_dynamo_resume_in_f_at_24 raise AssertionError( f"Expected 2 synced tensors, got {sync_tensors}" ) AssertionError: Expected 2 synced tensors, got 3

To execute this test, run the following from the base repo dir: PYTORCH_TEST_WITH_DYNAMO=1 python test/lazy/test_functionalization.py LazyFuncionalizationTest.test_lazy_init_with_view

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0

Root Cause

This test was disabled because it is failing in CI. See recent examples and the most recent trunk workflow logs.

Code Example

Traceback (most recent call last):
  File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 64, in test_lazy_init_with_view
    lazy_out_1 = f("lazy", reset_storage=False)
  File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 19, in f
    torch.manual_seed(2023)
  File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 22, in torch_dynamo_resume_in_f_at_19
    metrics.reset()
  File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 24, in torch_dynamo_resume_in_f_at_22
    class Model(torch.nn.Module):
  File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 51, in torch_dynamo_resume_in_f_at_24
    raise AssertionError(
        f"Expected 2 synced tensors, got {sync_tensors}"
    )
AssertionError: Expected 2 synced tensors, got 3

To execute this test, run the following from the base repo dir:
    PYTORCH_TEST_WITH_DYNAMO=1 python test/lazy/test_functionalization.py LazyFuncionalizationTest.test_lazy_init_with_view

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
RAW_BUFFERClick to expand / collapse

Platforms: dynamo

This test was disabled because it is failing in CI. See recent examples and the most recent trunk workflow logs.

Over the past 6 hours, it has been determined flaky in 25 workflow(s) with 25 failures and 25 successes.

Debugging instructions (after clicking on the recent samples link): DO NOT ASSUME THINGS ARE OKAY IF THE CI IS GREEN. We now shield flaky tests from developers so CI will thus be green but it will be harder to parse the logs. To find relevant log snippets:

  1. Click on the workflow logs linked above
  2. Click on the Test step of the job so that it is expanded. Otherwise, the grepping will not work.
  3. Grep for test_lazy_init_with_view
  4. There should be several instances run (as flaky tests are rerun in CI) from which you can study the logs.
<details><summary>Sample error message</summary>
Traceback (most recent call last):
  File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 64, in test_lazy_init_with_view
    lazy_out_1 = f("lazy", reset_storage=False)
  File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 19, in f
    torch.manual_seed(2023)
  File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 22, in torch_dynamo_resume_in_f_at_19
    metrics.reset()
  File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 24, in torch_dynamo_resume_in_f_at_22
    class Model(torch.nn.Module):
  File "/__w/pytorch/pytorch/test/lazy/test_functionalization.py", line 51, in torch_dynamo_resume_in_f_at_24
    raise AssertionError(
        f"Expected 2 synced tensors, got {sync_tensors}"
    )
AssertionError: Expected 2 synced tensors, got 3

To execute this test, run the following from the base repo dir:
    PYTORCH_TEST_WITH_DYNAMO=1 python test/lazy/test_functionalization.py LazyFuncionalizationTest.test_lazy_init_with_view

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
</details>

Test file path: lazy/test_functionalization.py

For all disabled tests (by GitHub issue), see https://hud.pytorch.org/disabled.

cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel @chauhang @penguinwu

extent analysis

TL;DR

The test test_lazy_init_with_view is failing intermittently due to an AssertionError caused by an unexpected number of synced tensors.

Guidance

  • Review the test case test_lazy_init_with_view in lazy/test_functionalization.py to understand the expected behavior and the condition that's causing the AssertionError.
  • Investigate the torch_dynamo_resume_in_f_at_24 function to see why it's raising an AssertionError with the message "Expected 2 synced tensors, got 3".
  • Check the workflow logs linked in the issue to find relevant log snippets by grepping for test_lazy_init_with_view and study the logs to identify any patterns or common factors that might be contributing to the flakiness.
  • Run the test locally using the command PYTORCH_TEST_WITH_DYNAMO=1 python test/lazy/test_functionalization.py LazyFuncionalizationTest.test_lazy_init_with_view to reproduce the issue and gather more information.

Example

No code snippet is provided as the issue does not contain enough information to suggest a specific code change.

Notes

The test is failing intermittently, which makes it challenging to reproduce and debug. The AssertionError message suggests that the issue is related to the number of synced tensors, but more investigation is needed to determine the root cause.

Recommendation

Apply workaround: temporarily modify the test to expect 3 synced tensors instead of 2, or investigate and fix the underlying issue causing the extra synced tensor. This will allow the test to pass and provide more time to investigate the root cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING