#!/usr/bin/env bash # Setup script for MiniMax-AI/MiniMax-H3-Image on Linux, from https://gitmanual.com/MiniMax-AI/MiniMax-H3-Image # Read it before you run it: the commands come from the repo's own README and files. # Run: bash setup.sh set -eo pipefail trap 'echo "Setup stopped at the step above. Steps and fixes: https://gitmanual.com/MiniMax-AI/MiniMax-H3-Image" >&2' ERR step() { printf '\n\033[1m==> %s\033[0m\n' "$1"; } have() { command -v "$1" >/dev/null 2>&1; } # Installers put programs here; make them usable right away. export PATH="$HOME/.local/share/mise/shims:$HOME/.cargo/bin:$HOME/.local/bin:$HOME/.deno/bin:$HOME/.bun/bin:$PATH" # nvm is a shell function, so load it into this script when it's installed. export NVM_DIR="${NVM_DIR:-$HOME/.nvm}" load_nvm() { [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"; } have_nvm() { load_nvm >/dev/null 2>&1; type nvm >/dev/null 2>&1; } step '1/3 Clone the repository' [ -d 'MiniMax-H3-Image' ] || git clone https://github.com/MiniMax-AI/MiniMax-H3-Image.git cd 'MiniMax-H3-Image' step '2/3 Install the required tools' # Python 3 have python3 || sudo apt install -y python3 python3-pip step '3/3 Follow the README: Run Locally' # In the maintainers' order. Do the README instructions above first — they cover steps outside the terminal. hf download MiniMaxAI/MiniMax-H3-Image model_index.json "pdd_*" "processor/*" "tokenizer/*" \ "transformer/*" "vae/*" hf download MiniMaxAI/MiniMax-H3 --include "text_encoder/*" hf download MiniMaxAI/MiniMax-H3-Image-PE python3 -m pip install -e 'python[diffusion]' sglang serve --model-path MiniMaxAI/MiniMax-H3-Image --host 0.0.0.0 --port 30000 --warmup-mode off sglang serve --model-path MiniMaxAI/MiniMax-H3-Image --host 0.0.0.0 --port 30000 --warmup-mode off \ --num-gpus 4 --ulysses-degree 4 uv venv --python 3.12 --seed && source .venv/bin/activate uv pip install vllm==0.33.0 --torch-backend=cu130 vllm serve MiniMaxAI/MiniMax-H3-Image --omni --host 0.0.0.0 --port 8000 \ --num-gpus 4 --usp 4 --text-encoder-tp-size 4 vllm serve MiniMaxAI/MiniMax-H3-Image --omni --host 0.0.0.0 --port 8000 --num-gpus 1 vllm serve MiniMaxAI/MiniMax-H3-Image --omni --host 0.0.0.0 --port 8000 --num-gpus 1 \ --diffusion-offload-config '{"mode":"layer","components":["text_encoder"]}' # 4576x3648 python3 -c "from context_ir import size_for; print(size_for('5:4'))" # China: https://api.minimax.cn export MINIMAX_API_BASE="https://api.minimax.io" # (fill in your own values, then run it) export MINIMAX_API_KEY="" echo 'Set up MiniMax-AI/MiniMax-H3-Image.' echo 'Manual: https://gitmanual.com/MiniMax-AI/MiniMax-H3-Image'