Lightning-AI / Lightning-AI/lightning-thunder

`test_vjp_correctness` fails with ops that return tensors that do not require grads.

Open
#120 1 comment 0 reactions 1 assignee View on GitHub

@kshitij12345 is already working on this.

Since Apr 29, 2024.

bug help wanted
Dominant language
Python
Stars
1.5k
Forks
121
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug

As per title. To reproduce, one could uncomment these tests in these tests in https://github.com/Lightning-AI/lightning-thunder/pull/118 to get:

```python
thunder/tests/test_grad.py:423: in test_vjp_correctness
result = run_snippet(
thunder/tests/framework.py:483: in run_snippet
raise ex
thunder/tests/framework.py:475: in run_snippet
snippet(*args, **kwargs)
thunder/tests/test_grad.py:394: in snippet_vjp_correctness
check_vjp(func, *args, executor=executor)
thunder/tests/test_grad.py:304: in check_vjp
_, J_star_v = executor.make_callable_legacy(vjp(f), disable_torch_autograd_support=True)(primals, v)
thunder/common.py:783: in _fn
trc_or_result = trace(compile_data=cd)(processed_function, *args, **kwargs)
thunder/core/interpreter.py:1298: in fn_
return fn(*args, **kwargs)
thunder/common.py:534: in _trace
result = fn(*proxyargs, **proxykwargs)
thunder/core/transforms.py:3629: in _vjp
result, vjp_result = vjp_call(flat_args, cotangents, trace=trace)
thunder/core/transforms.py:3603: in vjp_call_metafunc
result, env = augmented_forward_pass(*primals, trace=trace, **kwargs)
thunder/core/transforms.py:3414: in augmented_forward_pass
result, env = eval_trace(
thunder/core/transforms.py:1693: in eval_trace
prim_func = symbol_mapper(symbol)
thunder/core/transforms.py:3338: in vjp_symbol_mapper
vjp_impl, backward_fn = make_aug_forward_and_backward(symbol)
thunder/core/vjp_utils.py:99: in make_aug_forward_and_backward
backward_bsyms = utils.find_producer_symbols(joint_trace, flat_bw_outputs, tree_flatten(bw_inputs)[0])
thunder/core/utils.py:1062: in find_producer_symbols
if arg_name not in map(lambda x: x.name, stop_proxies) and arg_name not in seen:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

x = None

> if arg_name not in map(lambda x: x.name, stop_proxies) and arg_name not in seen:
E AttributeError: 'NoneType' object has no attribute 'name'

thunder/core/utils.py:1062: AttributeError
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.