Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

torch.jit.trace crash in presence of hooks, even in well determined models. #20862

Closed
jeremycochoy opened this issue May 23, 2019 · 1 comment
Labels
oncall: jit Add this issue/PR to JIT oncall triage queue

Comments

@jeremycochoy
Copy link

馃悰 Bug

If one want to compile a model using hook but with a well determined behavior while traced, the trace function raise anyway. There doesn't seams to be a way to force the trace function to ignore the raise:

if orig._backward_hooks or orig._forward_hooks or orig._forward_pre_hooks:
    raise ValueError("Modules that have hooks assigned can't be compiled")

To Reproduce

Just take a model with a dummy hook. Trace will fail.

Expected behavior

Trace should only warn, or ask a special argument (something like torch.jit.trace(model, dummy, ignore_hooks=True) )

Additional context

A quick fix would be to transform the raise into a warning. A better fix would be to ask the user to explicitly tell he want trace to ignore the presence of hooks.

Best regards,

@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label May 23, 2019
@eellison
Copy link
Contributor

CC @Krovatkin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
oncall: jit Add this issue/PR to JIT oncall triage queue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants