|
|
|
|
|
by t-vi
2073 days ago
|
|
> The solution to Python’s GIL bottleneck is not some trick, it is to stop using Python for data-path code. At least for the PyTorch bits of it, using the PyTorch JIT works well. When you run PyTorch code through Python, the intermediate results will be created as Python objects (with GIL and all) while when you run it in TorchScript, the intermediates will only be in C++ PyTorch Tensors, all without the GIL.
We have a small comment about it in our PyTorch book in the section on what improvements to expect from the PyTorch JIT and it seems rather relevant in practice. |
|
PyTorch will happily let you export your model, even with Python code in it, and run it in C++ :)