3 ms·
> The JIT is a set of compiler tools for bridging the gap between research in PyTorch and production. It allows for the creation of models that can run without
by amelius 8y ago
> The JIT is a set of compiler tools for bridging the gap between research in PyTorch
and production. It allows for the creation of models that can run without a dependency on the Python interpreter and which can be optimized more aggressively. Using program annotations existing models can be transformed into Torch Script, a subset of Python that PyTorch can run directly.
Isn't python bytecode simple enough that it can be run anywhere?
- skybrian 8y agoAlternative implementations of Python don't seem very easy to write, so I'm guessing the answer is no.
- yorwba 8y agoPython is not very difficult to implement [1], the hard part is making it fast. That's because every property access involves a lot of magic behind the scenes, like __getattribute__, __getattr__ and the method resolution order. And because Python is dynamically typed, that dispatch logic can't be compiled away but needs to execute every time. (PyPy's JIT can probably speed it up, but still needs deoptimization checks in case types change.) [1] see https://github.com/nedbat/byterun https://github.com/nedbat/byterun for a Python implementation
- rspeer 8y agoPython bytecode is a pre-processed form of instructions to a Python interpreter, such as getting the function with a specified name out of a Python library and calling it with certain Python objects as arguments. The point here is to run PyTorch code without having a Python interpreter, and without having to run slow Python code.
- levan_ts 8y agoThere was a huge problem with converting weight normalization module (torch.utils.weight_norm) and with forward and pre-forward hooks generally, so I had to rewrite the full model. Hope they've improved it in the stable release