Jimver / cuda-toolkit

GitHub Action to install CUDA
MIT License
142 stars 51 forks source link

Problems with python torch dependency #355

Open themw123 opened 1 month ago

themw123 commented 1 month ago

When I execute main.exe which I have built with github actions and cx_Freeze i am getting the following error:

Could not locate cudnn_ops_infer64_8.dll. Please make sure it is in your library path!

When i look at build/lib/torch/lib, i see that some cuda and cuddn dll's are missing. When I build it locally with cx_Freeze, I see that the required dll's are there. I think it's because it doesn't recognize the cuda installation correctly and therefore doesn't copy the dll's into the build

here is my action.yml:

 windows-backend-build:
    runs-on: windows-2019
    steps:
      - name: Install CUDA
        uses: Jimver/cuda-toolkit@v0.2.16
        id: cuda-toolkit
        with:
          cuda: "12.4.0"

      - name: Set environment variables
        run: |
          setx CUDA_PATH "%CUDA_PATH%"
          setx CUDA_PATH_V12_4 "%CUDA_PATH%"

        env:
          CUDA_PATH: ${{ env.CUDA_PATH }}

      - name: Display CUDA Version
        run: |
          echo "Installed cuda version is: ${{steps.cuda-toolkit.outputs.cuda}}"
          echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"

      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          submodules: true
          fetch-depth: 0

      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: "3.11.4"

      - name: Install dependencies
        run: |
          cd backend
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install transformers==4.40.1
        shell: bash

      - name: Build application
        run: |
          cd backend
          python setup.py build
        shell: cmd

      - name: Archive build output
        uses: actions/upload-artifact@v2
        with:
          name: build-output-windows-backend
          path: backend/build/

these are some of my requirements of requirements.txt:

torch==2.2.1 --index-url https://download.pytorch.org/whl/cu121
torchvision --index-url https://download.pytorch.org/whl/cu121
torchaudio==2.2.1
faster-whisper==1.0.2
themw123 commented 1 month ago

update: tried a lot of more things like setting CUDA_PATH and CUDA_PATH_V12_4 as windows environment variables and pathes in github action windows-2019 image. I checked it in my cx_Freeze setup.py script and have made sure that the windows environment variables can be recognized. Nothing helpes.

cx_Freeze still wants not to move the cuda and cudnn ddl's in build/lib/torch/lib. For now as a workarround i uploaded the dll's to google drive and my python programm is downloading and moving it to the directory.