patrick-kidger / patrick-kidger/jaxtyping

Issues with torch.compile

Open
#196 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.9k
Forks
96
PR merge metrics
No merged PRs in 30d

Description

We are very happy with the fact that jaxtyping supports Pytorch as well, but we are currently hitting some kind of weird error/edge case and was hoping if you can give some suggestions.
When compiling a module and trying to run it we get this stacktrace:

  File "/build/work/cfc8a89b76634373e85beb2a59a94e9e781a/google3/runfiles/google3/third_party/py/torch/_dynamo/bytecode_transformation.py", [line 646](https://cs.corp.google.com/piper///depot/google3/third_party/py/torch/_dynamo/bytecode_transformation.py?l=646&ws=botev/13260&snapshot=14397), in compute_exception_table
    keys_sorted = sorted(exn_dict.keys(), key=lambda t: (t[0], -t[1]))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
torch._dynamo.exc.InternalTorchDynamoError: '<' not supported between instances of 'NoneType' and 'int'

from user code:
   File "/build/work/cfc8a89b76634373e85beb2a59a94e9e781a/google3/runfiles/google3/third_party/py/jaxtyping/_decorator.py", [line 411](https://cs.corp.google.com/piper///depot/google3/third_party/py/jaxtyping/_decorator.py?l=411&ws=botev/13260&snapshot=14397), in wrapped_fn
    bound = param_signature.bind(*args, **kwargs)

Contributor guide

Open the contributing guide

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.

Research direction

Start with jaxtyping/_decorator.py around line 411, where wrapped_fn calls param_signature.bind, and compare that path with the reported torch.compile failure in torch._dynamo/bytecode_transformation.py. Reproduce the issue with a compiled module if possible; done means identifying the compatibility problem and verifying the resulting behavior with a regression test or a documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.