You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently added some code to a library which did some dynamic signature munging, and it triggers this error on torch.export:
torch._dynamo.exc.Unsupported: 'inline in skipfiles: Signature.bind | bind /usr/lib/python3.10/inspect.py, skipped according trace_rules.lookup SKIP_DIRS'
This is originating from code like this (which is just doing some lazy selection of a target function for something):
def __init__(self, sigf: Callable):
self._sig = inspect.signature(sigf)
def __call__(self, *args, **kwargs):
tensor_names = self._tensor_names
bound_args = self._sig.bind(*args, **kwargs)
bound_args.apply_defaults()
value_spec = tuple(bound_args.arguments[k] for k in tensor_names)
Note that the constructor happens at module load time (outside of dynamo) and the call happens during dynamo tracing.
I don't recall seeing this listed in the DB or elsewhere as explicitly unsupported. Is there a plan for it or some workaround (I can also rewrite the code to something less dynamic but thought I'd ask first)?
Error logs
return super().call_function(tx, args, kwargs)
File "/home/rsuderman/.local/python/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py", line 293, in call_function
return super().call_function(tx, args, kwargs)
File "/home/rsuderman/.local/python/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py", line 90, in call_function
return tx.inline_user_function_return(self, [*self.self_args(), *args], kwargs)
File "/home/rsuderman/.local/python/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 741, in inline_user_function_return
return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
File "/home/rsuderman/.local/python/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 2427, in inline_call
return cls.inline_call_(parent, func, args, kwargs)
File "/home/rsuderman/.local/python/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 2471, in inline_call_
result = InliningInstructionTranslator.check_inlineable(func)
File "/home/rsuderman/.local/python/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 2448, in check_inlineable
unimplemented(
File "/home/rsuderman/.local/python/lib/python3.10/site-packages/torch/_dynamo/exc.py", line 212, in unimplemented
raise Unsupported(msg)
torch._dynamo.exc.Unsupported: 'inline in skipfiles: Signature.bind | bind /usr/lib/python3.10/inspect.py, skipped according trace_rules.lookup SKIP_DIRS'
So, you could patch Dynamo to yolo trace into it, but it probably won't work anyway. No reason for this not to work, but yes, making it less dynamic would help.
This reverts commit 834e558.
Per advice on pytorch/pytorch#126242, reworks the dispatch mechanism to be static. Also adds a test to ensure export is functional when these ops are used.
This reverts commit 834e558.
Per advice on pytorch/pytorch#126242, reworks
the dispatch mechanism to be static. Also adds a test to ensure export
is functional when these ops are used.
馃悰 Describe the bug
I recently added some code to a library which did some dynamic signature munging, and it triggers this error on torch.export:
This is originating from code like this (which is just doing some lazy selection of a target function for something):
Note that the constructor happens at module load time (outside of dynamo) and the call happens during dynamo tracing.
I don't recall seeing this listed in the DB or elsewhere as explicitly unsupported. Is there a plan for it or some workaround (I can also rewrite the code to something less dynamic but thought I'd ask first)?
Error logs
Minified repro
No response
Versions
torch==2.4.0.dev20240428+cpu
torchaudio==2.2.1
torchvision==0.19.0.dev20240416+cpu
cc @ezyang @msaroufim @bdhirsh @anijain2305 @chauhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @avikchaudhuri @gmagogsfm @zhxchen17 @tugsbayasgalan @angelayi @suo @ydwu4
The text was updated successfully, but these errors were encountered: