pytorch / torchdynamo

A Python-level JIT compiler designed to make unmodified PyTorch programs faster.
BSD 3-Clause "New" or "Revised" License
1.01k stars 124 forks source link

Dynamo "You can suppress this exception and fall back to eager" garbles KeyError #1953

Closed ezyang closed 1 year ago

ezyang commented 1 year ago

🐛 Describe the bug

Looks like

KeyError: 'source\n\nSet torch._dynamo.config.verbose=True for more information\n\n\nYou can suppress this exception and fall back to eager by setting:\n    torch._dynamo.config.suppress_errors = True\n'

relevant tb

Traceback (most recent call last):
  File "/data/users/ezyang/a/pytorch/test/dynamo/test_modules.py", line 775, in test_torch_function_with_closure
    run()
  File "/data/users/ezyang/a/pytorch/test/dynamo/test_modules.py", line 768, in run
    out2 = opt_foo(x)
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/eval_frame.py", line 209, in _fn
    return fn(*args, **kwargs)
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/eval_frame.py", line 325, in catch_errors
    return callback(frame, cache_size)
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/convert_frame.py", line 102, in _fn
    return fn(*args, **kwargs)
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/utils.py", line 90, in time_wrapper
    r = func(*args, **kwargs)
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/convert_frame.py", line 339, in _convert_frame_assert
    return _compile(
  File "/data/users/ezyang/a/pytorch/torch/_dynamo/convert_frame.py", line 458, in _compile
    raise InternalTorchDynamoError() from e
torch._dynamo.exc.InternalTorchDynamoError

Error logs

No response

Minified repro

No response