Updated PyTorch ONNX exporter (markdown)

Justin Chu
2024-11-22 08:37:13 -08:00
parent bd46e3d780
commit a52a7414d7

@ -109,30 +109,18 @@ NOTE: [GitLens](https://gitlens.amod.io/)'s interactive rebase feature comes in
pip install onnxruntime onnx
```
> ONNX and ONNX Runtime are also available from conda-forge, but they depend on a version of protobuf that's newer than
> what the ONNX submodule wants to use, which lead to seg-faults in my case. This may be resolved with future
> versions of ONNX or ONNX Runtime. If you find `conda install -c conda-forge onnxruntime` works, please update
> these instructions to use conda instead of pip.
#### TorchVision
The ONNX tests depend on torchvision.
This is tricky because TorchVision depends on PyTorch, but we don't want our
package manager to install PyTorch, we want to use our locally built one.
The best solution I've found is to install torchvision with pip (so that
conda doesn't try to manage it) without any deps (so that pip doesn't install
pytorch and the locally built version is used).
```sh
# If you're not using CUDA, use the command below. If you are, see https://pytorch.org/get-started/locally/
pip install --upgrade --no-deps --pre torchvision --extra-index-url https://download.pytorch.org/whl/nightly/cpu
# manually install torchvision deps
conda install -c conda-forge pillow
```
> I hope there's a better way to deal with this. If you know of one please
> update these instructions and email the team!
### Sanity check
You should be able to run these commands successfully: