Open awaelchli opened 3 years ago
@ansley @suo @tugsbayasgalan would it be possible to get some help on this issue?
hey PyTorch team, is there any update on this?
TorchScript is no longer supported, so I don't think we'll get a core dev to fix this. If we can get a fix in, I assume it will get approved though.
@suo any chance we can get your thoughts or direction for working on a fix? Thank you!
This is a bug. There is a code that is throwing this error
NotSupportedError: keyword-arg expansion is not supported:
and I cannot special case the scripting path. I use torch._C._get_tracing_state()
to special case when tracing, but it also is False when scripting. And I have to use scripting because of a for-loop
If you come across this issue and need a workaround, I had success with this:
import inspect
import os
def is_scripting():
return any(os.path.join("torch", "jit") in frameinfo.filename for frameinfo in inspect.stack())
This isn't very smart, but should help when in desparate need :)
🐛 Bug
The function
torch.jit.is_scripting()
returns constant False when accessed in a property implemented in a Module.To Reproduce
This shows a warning despite
if not torch.jit.is_scripting()
is not workingExpected behavior
The code above should not produce any warning from the hello property, because it is never used.
There should be a way to detect if scripting is turned on. The function
torch.jit.is_scripting()
should return True even outside the forward() function when scripting a Module.Environment
Additional context