# Setup script for MiniMax-AI/MiniMax-H3-Image on Windows (PowerShell), 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: powershell -ExecutionPolicy Bypass -File .\setup.ps1 $ErrorActionPreference = "Stop" function Write-Step($t) { Write-Host "`n==> $t" -ForegroundColor Cyan } # Windows ships a python that only opens the Microsoft Store; it doesn't count. function Have($c) { $cmd = Get-Command $c -ErrorAction SilentlyContinue; [bool]$cmd -and $cmd.Source -notlike '*\WindowsApps\*' } # New installs change PATH; pick it up without opening a new window. function Update-Path { $env:Path = [Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [Environment]::GetEnvironmentVariable("Path", "User") } # Stop when a program fails, like bash's set -e. Dot-sourced, so cd and venv activation carry on to the next step. function Invoke-Step([scriptblock]$Block) { $global:LASTEXITCODE = 0; . $Block; if ($LASTEXITCODE) { throw "Failed with exit code $LASTEXITCODE" } } Write-Step '1/3 Clone the repository' if (-not (Test-Path 'MiniMax-H3-Image')) { Invoke-Step { git clone https://github.com/MiniMax-AI/MiniMax-H3-Image.git } } Set-Location 'MiniMax-H3-Image' Write-Step '2/3 Install the required tools' # Python 3 if (-not (Have 'python')) { Invoke-Step { winget install Python.Python.3.12 -e --accept-source-agreements --accept-package-agreements }; Update-Path } Write-Step '3/3 Follow the README: Run Locally' # In the maintainers' order. Do the README instructions above first — they cover steps outside the terminal. Invoke-Step { hf download MiniMaxAI/MiniMax-H3-Image model_index.json "pdd_*" "processor/*" "tokenizer/*" \ } Invoke-Step { "transformer/*" "vae/*" } Invoke-Step { hf download MiniMaxAI/MiniMax-H3 --include "text_encoder/*" } Invoke-Step { hf download MiniMaxAI/MiniMax-H3-Image-PE } Invoke-Step { python3 -m pip install -e 'python[diffusion]' } Invoke-Step { sglang serve --model-path MiniMaxAI/MiniMax-H3-Image --host 0.0.0.0 --port 30000 --warmup-mode off } Invoke-Step { sglang serve --model-path MiniMaxAI/MiniMax-H3-Image --host 0.0.0.0 --port 30000 --warmup-mode off \ } Invoke-Step { --num-gpus 4 --ulysses-degree 4 } # (needs Git Bash or WSL on Windows) uv venv --python 3.12 --seed && source .venv/bin/activate Invoke-Step { uv pip install vllm==0.33.0 --torch-backend=cu130 } Invoke-Step { vllm serve MiniMaxAI/MiniMax-H3-Image --omni --host 0.0.0.0 --port 8000 \ } Invoke-Step { --num-gpus 4 --usp 4 --text-encoder-tp-size 4 } Invoke-Step { vllm serve MiniMaxAI/MiniMax-H3-Image --omni --host 0.0.0.0 --port 8000 --num-gpus 1 } Invoke-Step { vllm serve MiniMaxAI/MiniMax-H3-Image --omni --host 0.0.0.0 --port 8000 --num-gpus 1 \ } Invoke-Step { --diffusion-offload-config '{"mode":"layer","components":["text_encoder"]}' } # 4576x3648 Invoke-Step { python3 -c "from context_ir import size_for; print(size_for('5:4'))" } # (needs Git Bash or WSL on Windows) export MINIMAX_API_BASE="https://api.minimax.io" # China: https://api.minimax.cn # (fill in your own values, then run it) export MINIMAX_API_KEY="" Write-Host 'Set up MiniMax-AI/MiniMax-H3-Image.' Write-Host 'Manual: https://gitmanual.com/MiniMax-AI/MiniMax-H3-Image'