Skip to content

Instantly share code, notes, and snippets.

@evzpav
Created September 23, 2025 00:39
Show Gist options
  • Select an option

  • Save evzpav/85d95e821908dff2ffe73c36b653354d to your computer and use it in GitHub Desktop.

Select an option

Save evzpav/85d95e821908dff2ffe73c36b653354d to your computer and use it in GitHub Desktop.
#!/bin/bash
# Cause the script to exit on failure
set -eo pipefail
# Activate the main virtual environment
. /venv/main/bin/activate
# Install required packages for model downloading
pip install huggingface_hub transformers torch
# Create model directory
mkdir -p "${WORKSPACE}/models/flux"
# Download FLUX.1-dev model from Hugging Face
echo "Starting FLUX.1-dev model download..."
# Method 1: Using huggingface-cli (recommended for large models)
huggingface-cli download black-forest-labs/FLUX.1-dev \
--local-dir "${WORKSPACE}/models/flux/FLUX.1-dev" \
--local-dir-use-symlinks False
# Alternative Method 2: Using git-lfs (uncomment if preferred)
# cd "${WORKSPACE}/models/flux"
# git lfs install
# git clone https://huggingface.co/black-forest-labs/FLUX.1-dev
echo "FLUX.1-dev model download completed!"
# Set environment variable for model path
echo "export FLUX_MODEL_PATH=${WORKSPACE}/models/flux/FLUX.1-dev" >> ~/.bashrc
# Optional: Set up supervisor service for your application
# echo "your-supervisor-config" > /etc/supervisor/conf.d/flux-app.conf
# echo "your-supervisor-wrapper" > /opt/supervisor-scripts/flux-app.sh
# chmod +x /opt/supervisor-scripts/flux-app.sh
# Optional: Configure instance portal
# rm -f /etc/portal.yaml
# export PORTAL_CONFIG="localhost:8080:18080:/:FLUX Portal|localhost:7860:17860:/:Gradio Interface"
# Reload Supervisor (uncomment if using supervisor)
# supervisorctl reload
echo "Provisioning script completed successfully!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment