Skip to content

Instantly share code, notes, and snippets.

@cicalooo
Forked from Sankalp0203/ltx_24gb.sh
Created May 6, 2026 12:41
Show Gist options
  • Select an option

  • Save cicalooo/257ae669402c90740b7c8721dd93b111 to your computer and use it in GitHub Desktop.

Select an option

Save cicalooo/257ae669402c90740b7c8721dd93b111 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Provisioning Script for 24GB VRAM (e.g., A5000, RTX A5000, 3090, 4090)
# Uses LTX-2 FP8 Model (~19GB) + Quantized Text Encoder (~6GB)
# Tries to fit within 24GB VRAM, might swap slightly to system RAM or require strict offloading.
source /venv/main/bin/activate
COMFYUI_DIR=${WORKSPACE}/ComfyUI
APT_PACKAGES=(
"ffmpeg"
"git"
"wget"
"aria2"
)
PIP_PACKAGES=(
"yt_dlp"
)
NODES=(
"https://github.com/ltdrdata/ComfyUI-Manager"
"https://github.com/cubiq/ComfyUI_essentials"
"https://github.com/Lightricks/ComfyUI-LTXVideo"
"https://github.com/yuvraj108c/ComfyUI-Whisper"
"https://github.com/MixLabPro/comfyui-sound-lab"
"https://github.com/Fannovel16/ComfyUI-VideoHelperSuite"
"https://github.com/Fannovel16/ComfyUI-Frame-Interpolation"
"https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet"
)
# LTX-2 FP8 Model (Best balance for 24GB)
CHECKPOINT_MODELS=(
"https://huggingface.co/Lightricks/LTX-2/resolve/main/ltx-2-19b-dev-fp8.safetensors"
)
UNET_MODELS=(
)
LORA_MODELS=(
)
VAE_MODELS=(
)
ESRGAN_MODELS=(
"https://huggingface.co/Lightricks/LTX-2/resolve/main/ltx-2-spatial-upscaler-x2-1.0.safetensors"
"https://huggingface.co/Lightricks/LTX-2/resolve/main/ltx-2-temporal-upscaler-x2-1.0.safetensors"
)
CONTROLNET_MODELS=(
)
# Text Encoder for LTX-2 (Quantized to save VRAM)
TEXT_ENCODER_MODELS=(
"https://huggingface.co/city96/t5-v1_1-xxl-encoder-gguf/resolve/main/t5-v1_1-xxl-encoder-Q4_K_M.gguf"
# LTX-2 Text Encoder: Gemma 3 12B (Required)
"https://huggingface.co/Lightricks/LTX-2/resolve/main/gemma-3-12b-it-qat-q4_0-unquantized.safetensors"
# T5 Text Encoder (Often required for standard SD/Flux/LTX pipelines)
"https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors"
)
# MusicGen / Stable Audio Models (for comfyui-sound-lab)
MUSICGEN_MODELS=(
"https://huggingface.co/facebook/musicgen-small/resolve/main/state_dict.bin"
)
STABLE_AUDIO_MODELS=(
"https://huggingface.co/stabilityai/stable-audio-open-1.0/resolve/main/model.safetensors"
)
### DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ###
function provisioning_start() {
provisioning_print_header
provisioning_get_apt_packages
provisioning_get_nodes
provisioning_get_pip_packages
# ComfyUI Model Structure
provisioning_get_files "${COMFYUI_DIR}/models/checkpoints" "${CHECKPOINT_MODELS[@]}"
provisioning_get_files "${COMFYUI_DIR}/models/unet" "${UNET_MODELS[@]}"
provisioning_get_files "${COMFYUI_DIR}/models/loras" "${LORA_MODELS[@]}"
provisioning_get_files "${COMFYUI_DIR}/models/controlnet" "${CONTROLNET_MODELS[@]}"
provisioning_get_files "${COMFYUI_DIR}/models/vae" "${VAE_MODELS[@]}"
provisioning_get_files "${COMFYUI_DIR}/models/esrgan" "${ESRGAN_MODELS[@]}"
# LTX-2 Text Encoder often needs to be in models/text_encoders
provisioning_get_files "${COMFYUI_DIR}/models/text_encoders" "${TEXT_ENCODER_MODELS[@]}"
# MusicGen & Stable Audio
provisioning_get_files "${COMFYUI_DIR}/models/musicgen" "${MUSICGEN_MODELS[@]}"
provisioning_get_files "${COMFYUI_DIR}/models/stable_audio" "${STABLE_AUDIO_MODELS[@]}"
# Pre-create folders for other nodes to avoid permissions issues
mkdir -p "${COMFYUI_DIR}/models/whisper"
provisioning_print_end
}
function provisioning_get_apt_packages() {
if [[ -n $APT_PACKAGES ]]; then
sudo apt-get update
sudo apt-get install -y ${APT_PACKAGES[@]}
fi
}
function provisioning_get_pip_packages() {
if [[ -n $PIP_PACKAGES ]]; then
pip install --no-cache-dir ${PIP_PACKAGES[@]}
fi
}
function provisioning_get_nodes() {
for repo in "${NODES[@]}"; do
dir="${repo##*/}"
path="${COMFYUI_DIR}/custom_nodes/${dir}"
requirements="${path}/requirements.txt"
if [[ -d $path ]]; then
if [[ ${AUTO_UPDATE,,} != "false" ]]; then
printf "Updating node: %s...\n" "${repo}"
( cd "$path" && git pull )
if [[ -e $requirements ]]; then
pip install --no-cache-dir -r "$requirements"
fi
fi
else
printf "Downloading node: %s...\n" "${repo}"
git clone "${repo}" "${path}" --recursive
if [[ -e $requirements ]]; then
pip install --no-cache-dir -r "${requirements}"
fi
fi
done
}
function provisioning_get_files() {
if [[ -z $2 ]]; then return 1; fi
dir="$1"
mkdir -p "$dir"
shift
arr=("$@")
if [[ ${#arr[@]} -eq 0 ]]; then return; fi
printf "Downloading %s model(s) to %s...\n" "${#arr[@]}" "$dir"
for url in "${arr[@]}"; do
printf "Downloading: %s\n" "${url}"
provisioning_download "${url}" "${dir}"
printf "\n"
done
}
function provisioning_print_header() {
printf "\n##############################################\n# #\n# Provisioning (24GB VRAM) #\n# #\n# This will take some time #\n# #\n##############################################\n\n"
}
function provisioning_print_end() {
printf "\nProvisioning complete: Application will start now\n\n"
}
# Download from $1 URL to $2 file path
function provisioning_download() {
if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then
auth_token="$HF_TOKEN"
elif
[[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then
auth_token="$CIVITAI_TOKEN"
fi
if [[ -n $auth_token ]];then
wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1"
else
wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1"
fi
}
if [[ ! -f /.noprovisioning ]]; then
provisioning_start
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment