-
Notifications
You must be signed in to change notification settings - Fork 12
Description
cd ~/comfyui_install/comfyui_install/
mkdir -p installation_scripts
mkdir -p projects
Result: You now have:
~/comfyui_install/comfyui_install/installation_scripts/
~/comfyui_install/comfyui_install/projects/
cd ~/comfyui_install/comfyui_install/installation_scripts/
nano install_ltx_kernels.sh
`> #!/bin/bash
Script to install Lightricks LTXVideo-Q8-Kernels for ComfyUI
Exit immediately if a command exits with a non-zero status.
set -e--- Configuration ---
COMFYUI_DIR is the main directory of your ComfyUI installation
COMFYUI_DIR="$HOME/comfyui_install/comfyui_install"PROJECTS_DIR is where the source code of LTXVideo-Q8-Kernels will be cloned
PROJECTS_DIR="$COMFYUI_DIR/projects" # Source code for LTXVideo-Q8-Kernels goes hereVENV_PATH is the path to ComfyUI's virtual environment
VENV_PATH="$COMFYUI_DIR/.venv"LTXVideo-Q8-Kernels specific details
REPO_URL="https://github.com/Lightricks/LTXVideo-Q8-Kernels.git"
REPO_NAME="LTXVideo-Q8-Kernels" # This is the directory name that 'git clone' will createPyTorch and CUDA build configurations
CUDA_VERSION_PYTORCH_INDEX="cu128" # For PyTorch wheels for CUDA 12.8
TARGET_CUDA_ARCH="sm_90" # For Blackwell GPU (adjust if your GPU arch is different)
SYSTEM_CUDA_HOME="/usr/local/cuda-12.8" # VERIFY this path for your container's CUDA Toolkit--- Main Script ---
echo "=== LTXVideo-Q8-Kernels Installation Script ==="
echo "Installing into ComfyUI environment: $VENV_PATH"
echo "Project source will be cloned to/updated in: $PROJECTS_DIR/$REPO_NAME"
echo "-----------------------------------------------------"
Activate the ComfyUI Virtual Environment
echo "[Step 1/7] Activating ComfyUI virtual environment: $VENV_PATH"
if [ -f "$VENV_PATH/bin/activate" ]; then
source "$VENV_PATH/bin/activate"
else
echo "ERROR: Virtual environment not found at $VENV_PATH"
echo "Please ensure ComfyUI and its .venv are set up correctly."
exit 1
fi
echo " Current Python in venv: $(python --version)"
echo " Current PyTorch in venv: $(python -c 'import torch; print(torch.version)' 2>/dev/null || echo 'Not installed, will attempt install.')"
echo "-----------------------------------------------------"Install PyTorch and build dependencies (idempotent - pip will skip if already satisfied)
echo "[Step 2/7] Installing/Verifying PyTorch and build dependencies..."
pip install torch torchvision torchaudio --index-url "https://download.pytorch.org/whl/$CUDA_VERSION_PYTORCH_INDEX"
pip install packaging wheel ninja setuptools
echo "-----------------------------------------------------"Ensure the PROJECTS_DIR exists (it should if you followed the setup steps)
echo "[Step 3/7] Ensuring projects directory exists: $PROJECTS_DIR"
mkdir -p "$PROJECTS_DIR" # Creates it if it doesn't exist, does nothing if it does
echo "-----------------------------------------------------"Clone or update the LTXVideo-Q8-Kernels repository
echo "[Step 4/7] Cloning/Updating $REPO_NAME repository..."
if [ -d "$PROJECTS_DIR/$REPO_NAME" ]; then
echo " Repository already exists at $PROJECTS_DIR/$REPO_NAME."
echo " Attempting to pull latest changes..."
cd "$PROJECTS_DIR/$REPO_NAME"
git pull origin master # Or main, depending on the default branch of the repo
else
echo " Cloning $REPO_NAME repository into $PROJECTS_DIR/ ..."
cd "$PROJECTS_DIR"
git clone "$REPO_URL" "$REPO_NAME" # Explicitly name the target directory
cd "$REPO_NAME"
fi
echo " Current directory: $(pwd)"
echo "-----------------------------------------------------"Initialize and update submodules
echo "[Step 5/7] Initializing and updating submodules (if any)..."
(Assumes current directory is $PROJECTS_DIR/$REPO_NAME)
git submodule update --init --recursive
echo "-----------------------------------------------------"Set Environment Variables for CUDA Compilation
echo "[Step 6/7] Setting environment variables for CUDA compilation (Target: $TARGET_CUDA_ARCH)..."
export TORCH_CUDA_ARCH_LIST="$TARGET_CUDA_ARCH"
export CUDA_HOME="$SYSTEM_CUDA_HOME"
export CUDA_PATH="$SYSTEM_CUDA_HOME" # Some build systems might use CUDA_PATH
unset CMAKE_ARGS # Clear any potentially conflicting CMake argumentsecho " CUDA_HOME is set to: $CUDA_HOME"
echo " TORCH_CUDA_ARCH_LIST is set to: $TORCH_CUDA_ARCH_LIST"
echo "-----------------------------------------------------"
- Run the installation command
echo "[Step 7/7] Building and installing $REPO_NAME (package name might be different, e.g., q8_kernels)..."
(Assumes current directory is $PROJECTS_DIR/$REPO_NAME)
python setup.py install
echo "-----------------------------------------------------"Deactivating is optional for a script like this if it runs in its own subshell.
If you want to be explicit and ensure the venv is deactivated after script completion:
echo "Deactivating virtual environment."
deactivateecho "=== LTXVideo-Q8-Kernels Installation Script Finished ==="
echo "If no errors occurred, the package (likely named 'q8_kernels') should now be installed in your ComfyUI .venv."
echo "Verify with: 'pip show q8_kernels' (while .venv is active)."
echo "Remember to restart ComfyUI if it was running during this script execution."
`
chmod +x install_ltx_kernels.sh
cd ~/comfyui_install/comfyui_install/installation_scripts/
./install_ltx_kernels.sh
cd ~/comfyui_install/comfyui_install/
source YOUR VENV/bin/activate
pip list | grep -i q8_kernels
pip show q8_kernels