From 7d9db09faf6d2671bec3b7de765c856f8dba9ff2 Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Brick" Date: Sat, 21 Mar 2026 20:51:29 -0700 Subject: [PATCH] Fix TensorRT/ESRGAN fallback: split requirements for RunPod cu128 - requirements.txt: Remove torch-tensorrt (wrong CUDA build breaks RunPod) - requirements-runpod.txt: New file with --extra-index-url cu128 for torch-tensorrt and torchaudio pinned to correct CUDA toolkit - goofer_video_concat.py: Loud warnings when TensorRT unavailable so silent fallback to Real-ESRGAN is obvious in logs Prevents the libcudart.so.13 error from recurring on CUDA 12.8 pods. Co-Authored-By: Claude Opus 4.6 --- goofer_video_concat.py | 17 ++++++++++++++--- requirements-runpod.txt | 20 ++++++++++++++++++++ requirements.txt | 5 ++++- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 requirements-runpod.txt diff --git a/goofer_video_concat.py b/goofer_video_concat.py index c64f1bf..b8f0f0f 100644 --- a/goofer_video_concat.py +++ b/goofer_video_concat.py @@ -387,10 +387,21 @@ def _upscale(images, target_resolution=1080, quality="ULTRA"): n_frames, result.shape[2], result.shape[1]) return result - except ImportError: - logger.info("torch-tensorrt not installed. Trying standard Real-ESRGAN...") + except ImportError as ie: + logger.warning( + "torch-tensorrt NOT INSTALLED — falling back to standard Real-ESRGAN. " + "To fix: pip install -r requirements-runpod.txt (import error: %s)", ie + ) + print( + "[VideoConcat] WARNING: torch-tensorrt not found! Using slow Real-ESRGAN fallback.\n" + "[VideoConcat] Fix: pip install -r requirements-runpod.txt" + ) except Exception as e: - logger.warning("TensorRT path failed: %s. Trying standard Real-ESRGAN...", e) + logger.warning( + "TensorRT path FAILED: %s — falling back to standard Real-ESRGAN. " + "Check CUDA version matches torch-tensorrt build (nvcc --version).", e + ) + print(f"[VideoConcat] WARNING: TensorRT failed: {e}. Using Real-ESRGAN fallback.") # --- Strategy 3: Real-ESRGAN via PyTorch CUDA (no TensorRT) --- try: diff --git a/requirements-runpod.txt b/requirements-runpod.txt new file mode 100644 index 0000000..d2dc934 --- /dev/null +++ b/requirements-runpod.txt @@ -0,0 +1,20 @@ +# ComfyUI-Goofer — RunPod / Linux NVIDIA TensorRT requirements +# Install AFTER base requirements.txt: +# pip install -r requirements.txt +# pip install -r requirements-runpod.txt +# +# CRITICAL: The --extra-index-url MUST match your CUDA toolkit. +# RunPod default (March 2026): CUDA 12.8 → cu128 +# Check yours: nvcc --version +# +# If you see "libcudart.so.13: cannot open shared object file" +# you installed the wrong CUDA build. Uninstall and reinstall +# with the correct index URL below. + +--extra-index-url https://download.pytorch.org/whl/cu128 + +# NVIDIA TensorRT — compiled for tensor cores (Blackwell, Ada, Hopper) +torch-tensorrt>=2.2.0 + +# Ensure torchaudio matches PyTorch CUDA build +torchaudio>=2.0.0 diff --git a/requirements.txt b/requirements.txt index 933cd22..0c42c6a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,10 @@ opencv-python>=4.8.0 # Optional: denoise/frame prep (graceful fallback) # Upscaling — NVIDIA hardware chain realesrgan>=0.3.0 # Real-ESRGAN upscaler (auto-downloads ~64 MB model) basicsr>=1.4.2 # Required by Real-ESRGAN -torch-tensorrt>=2.2.0 # NVIDIA TensorRT acceleration (Linux/RunPod — uses tensor cores) +# NOTE: torch-tensorrt moved to requirements-runpod.txt +# It MUST match your CUDA toolkit version (cu128/cu130). +# Installing the wrong build causes libcudart.so errors. +# On RunPod/Linux: pip install -r requirements-runpod.txt # Prompt generation (Qwen2.5 mode) — models auto-download on first use transformers>=4.37.0 # Qwen2.5-Instruct + MusicGen