WINDOWS SOLUTION

I didn’t test the following for anything other than Windows 10.

For anyone trying to use PyTorch with PyInstaller I highly recommend you just don’t. I had a lot of issues and even when it worked it was much slower than the application should be. Instead use cx freeze with your application in an if name == main block :
import sys
from cx_Freeze import setup, Executable

build_exe_options = {"packages": ["onnxruntime","cv2","numpy","torch","PIL", "torchvision"]}

setup(
    name="project_name",
    version="1.0",
    description="your app", # on windows it will use that name if your exe crashes to display a message
    options={"build_exe": build_exe_options},
    executables=[Executable(application_main.py")]
)

It will generate a lib directory with your packages and your app.exe with the name you passed (project_name in this case) and works just fine.