torch>=2.0.1 diffusers==0.33.1 transformers numpy Pillow huggingface_hub safetensors comfyui python-dotenv
custom_nodes directory:cd ComfyUI/custom_nodes
git clone https://github.com/APZmedia/ComfyUI-Dreamlight.git
cd ComfyUI-Dreamlight
pip install -r requirements.txt
# Copy the example environment file
cp .env.example .env
# Get your HuggingFace token and request access to FLUX.1-dev
# 1. Get your token from: https://huggingface.co/settings/tokens
# 2. Request access to FLUX.1-dev: https://huggingface.co/black-forest-labs/FLUX.1-dev
# 3. Add your token to .env file:
echo "HF_TOKEN=your_huggingface_token_here" > .env
⚠️ IMPORTANT: FLUX.1-dev is a gated model that requires:
# Create model directories
mkdir -p ckpt/FLUX/transformer
mkdir -p ckpt/CLIP
# Download FLUX transformer weights
curl -L "https://huggingface.co/LYAWWH/DreamLight/resolve/main/FLUX/transformer/model.pth" -o ckpt/FLUX/transformer/model.pth
# Download CLIP model
curl -L "https://huggingface.co/LYAWWH/DreamLight/resolve/main/CLIP/models/config.json" -o ckpt/CLIP/config.json
curl -L "https://huggingface.co/LYAWWH/DreamLight/resolve/main/CLIP/models/pytorch_model.bin" -o ckpt/CLIP/pytorch_model.bin
The node appears under “image/postprocessing” as “DreamLightNode”
Inputs:
foreground_image: Subject to be relit (IMAGE)background_image: New background (IMAGE)mask: Foreground subject mask (MASK)prompt: Lighting guidance textseed: Random seed for reproducibilityresolution: Output resolution (256-2048)environment_map: Optional environment map (IMAGE)Output:
relit_image: Final image with consistent lightingtest_dreamlight_workflow.json in ComfyUIexample_foreground.pngexample_background.pngexample_mask.pngHF_TOKEN in .env file for authenticated downloadsIf the automatic model setup fails, you can manually install the required models:
# Navigate to your ComfyUI models directory
cd ComfyUI/models
# Create the dedicated FLUX directory
mkdir -p dreamlight/flux_complete
cd dreamlight/flux_complete
# ⚠️ FLUX.1-dev is GATED - authentication required!
# Option A: Using git (requires authentication)
git clone https://huggingface.co/black-forest-labs/FLUX.1-dev .
# You'll be prompted for your HuggingFace username and token
# Option B: Using huggingface-hub (recommended)
pip install huggingface-hub
python -c "
from huggingface_hub import snapshot_download
snapshot_download(
repo_id='black-forest-labs/FLUX.1-dev',
local_dir='.',
local_dir_use_symlinks=False,
token='your_hf_token_here' # Required for gated models
)
"
# If you have flux1-dev.safetensors elsewhere, copy it:
cp /path/to/your/flux1-dev.safetensors transformer/diffusion_pytorch_model.safetensors
mkdir -p ComfyUI/models/dreamlight/CLIP/models
cd ComfyUI/models/dreamlight/CLIP/models
# Download config and model files
wget https://huggingface.co/LYAWWH/DreamLight/resolve/main/CLIP/models/config.json
wget https://huggingface.co/LYAWWH/DreamLight/resolve/main/CLIP/models/pytorch_model.bin
After manual installation, verify the structure:
# Check FLUX directory structure
ls -la ComfyUI/models/dreamlight/flux_complete/
# Should contain: model_index.json, vae/, text_encoder/, text_encoder_2/, transformer/, tokenizer/, tokenizer_2/, scheduler/
# Check each component has required files
ls -la ComfyUI/models/dreamlight/flux_complete/vae/
# Should contain: config.json, diffusion_pytorch_model.safetensors
ls -la ComfyUI/models/dreamlight/flux_complete/transformer/
# Should contain: config.json, diffusion_pytorch_model.safetensors
# Check CLIP directory
ls -la ComfyUI/models/dreamlight/CLIP/models/
# Should contain: config.json, pytorch_model.bin
Issue: “Error no file named diffusion_pytorch_model.bin found”
Issue: “Authentication failed” or “HuggingFace token required”
echo "HF_TOKEN=your_token_here" > .env
Issue: “Out of memory”
# In the node, set resolution to 512 or lower
Issue: “Model validation failed”
The complete directory structure should look like:
ComfyUI/models/dreamlight/
├── flux_complete/
│ ├── model_index.json
│ ├── vae/
│ │ ├── config.json
│ │ └── diffusion_pytorch_model.safetensors
│ ├── text_encoder/
│ │ ├── config.json
│ │ └── model.safetensors
│ ├── text_encoder_2/
│ │ ├── config.json
│ │ └── model.safetensors
│ ├── transformer/
│ │ ├── config.json
│ │ └── diffusion_pytorch_model.safetensors
│ ├── tokenizer/
│ │ └── tokenizer_config.json
│ ├── tokenizer_2/
│ │ └── tokenizer_config.json
│ └── scheduler/
│ └── scheduler_config.json
└── CLIP/
└── models/
├── config.json
└── pytorch_model.bin
If you encounter issues: