tnc-ca-geo / animl-ml

Machine Learning resources for camera trap data processing
Other
4 stars 1 forks source link

Explore bumping up the versions of torch and torchvision we use on the MIRAv2 endpoint #109

Open nathanielrindlaub opened 1 year ago

nathanielrindlaub commented 1 year ago

PyTorch started bundling GPU and CPU code bases somewhere down the line, but we can download ONLY the CPU version with:

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu for the latest versions or pip install torch==1.13.1+cpu torchvision==0.14.1+cpu torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cpu for older.

Previously when we had tried using more recent version of torch and torch vision it had ballooned the image to >9GB (from ~3GB previously) which was causing timeout issues. However, we suspect that was because we were also unwittingly loading the GPU code. We'd want to update the Dockerfile and likely update the version's we are running locally during torchscript model compilation and re-compile and test.

While we're at it, might as well as try running newer versions of torchserve: https://hub.docker.com/r/pytorch/torchserve/tags?page=1

nathanielrindlaub commented 1 year ago

Could give compiling to ONNX a shot too? With torch 2.0 it looks like it may be as simple as torch.onnx.export: https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html