question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Side effect of jit_set_profiling_*(False) at import time?

See original GitHub issue

I just spent 2 days wondering why my code got way slower and finally narrowed it down to a side effect of this line:

import speechbrain

How ironic! 😃

It looks like, when imported, it runs the following two lines that seem to have a huge impact on the speed of the rest of my (otherwise speechbrain-free) PyTorch code:

https://github.com/speechbrain/speechbrain/blob/7443adca55c1c673360b4d382e525413aa1de312/speechbrain/core.py#L42-L43

I found this related issue on pytorch repo: https://github.com/pytorch/pytorch/issues/38342

Any up-to-date details of why those two lines are needed?

Additional information about my setup:

import torch
torch.__version__
# 1.8.1+cu102
speechbrain.__version__
# 0.5.10

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
TParcolletcommented, Oct 26, 2021

oh no, not jit again. Yeah, we did this due to a regression observed in between pytorch version with Jit based code. @mravanelli should we try to see if higher version of Pytorch are now free of this previously observed regression ? Then we could maybe remove these lines …

0reactions
hbredincommented, Oct 26, 2021

Anyway, feel free to rename/close this issue as it somehow diverged from what I thought it was about…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Discussion: Minimising code execution at import time / the ...
The import side-effects / order requirements alone mean that I've been unable to recommend the use of the JPype import system for anything...
Read more >
Say “no” to import side‐effects in Python
In Python, side-effects are simply not acceptable at all. One should instead put the code with the side-effect in a function and call...
Read more >
Say “no” to import side‐effects in Python
Sometimes it's a choice between "do something at import time" or "deal ... That doesn't have side-effects outside the module being imported, so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found