Your packages are already large, so I don't think there's much you can do.
torch: 1.5 GB
triton: 420 MB
ray: 170 MB
Using venv not as an isolator but as a package wrapper is a good strategy.
Many AI libraries, especially PyTorch, offer different versions. If you're not going to use a GPU for inference in your container, never install the default version of PyTorch.