modelbeast/scripts/install_hunyuan3d_mlx.sh
m3ultra 9b525fa420 hunyuan install clones self-owned MLX fork; CLUSTER fleet final state
- install_hunyuan3d_mlx.sh: auto-clone monster/Hunyuan3D-2.2-mrp-MLX (our
  Gitea fork) into vendor/ when missing, so any node bootstraps identically.
- CLUSTER.md: M1 hunyuan verified, M4 = bg_remove + Ollama qwen2.5:7b endpoint,
  cpu-lane-not-pooled caveat, self-owned repo reference.
2026-07-16 10:35:11 +10:00

61 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# hunyuan3d-mlx — Hunyuan3D 2.1 native MLX port (local image→3D, both stages).
# Unlike trellis-mac there is no upstream setup.sh, so we build the venv here.
# The MLX path is HYBRID: MLX for the diffusion UNet/VAE/rasterizer/super-res,
# but PyTorch(+transformers) for DINOv2-giant image encoding — so torch is
# required, but NOT the CUDA-era requirements.txt (no basicsr/realesrgan/
# lightning/diffusers). bpy is optional (trimesh GLB fallback exists).
# MLX weights (dgrauet/hunyuan3d-2.1-mlx, ~15GB) + dinov2-giant (~4.5GB) are
# public and download at runtime on first generate.
set -euo pipefail
cd "$(dirname "$0")/.."
VENDOR="vendor/hunyuan3d-mlx"
# Our improved, self-owned MLX fork (upstream dgrauet/Hunyuan3D-2.1-mlx + our
# generate_e2e.py CLI + env-tunable remesh). Cloned from our Gitea so every node
# bootstraps identically.
HY3D_REPO="${HY3D_REPO:-ssh://git@100.71.119.27:222/monster/Hunyuan3D-2.2-mrp-MLX.git}"
if [ ! -d "$VENDOR" ]; then
echo "[hy3d] cloning improved MLX fork: $HY3D_REPO"
mkdir -p vendor
git clone "$HY3D_REPO" "$VENDOR"
fi
cd "$VENDOR"
echo "[hy3d] creating uv venv (python 3.11, matches trellis-mac) ..."
[ -x .venv/bin/python ] || uv venv --python 3.11 .venv
# shellcheck disable=SC1091
source .venv/bin/activate
echo "[hy3d] installing MLX-path dependencies (torch is MPS/CPU, no CUDA) ..."
uv pip install \
mlx mlx-arsenal \
torch torchvision \
transformers timm \
huggingface_hub safetensors \
numpy scipy scikit-image PyMCubes \
trimesh pygltflib xatlas \
opencv-python pillow \
pymeshlab \
einops omegaconf pyyaml tqdm torchdiffeq \
diffusers accelerate \
fast_simplification # trimesh 4.12 delegates simplify_quadric_decimation to this (Stage 2 remesh)
echo "[hy3d] import probe — the authoritative check of the real MLX entry points ..."
export HF_HUB_DISABLE_XET=1
python - <<'PY' || { echo "[hy3d] PROBE FAILED — see ModuleNotFoundError above; add the package to this script and re-run."; exit 2; }
import sys, os
sys.path.insert(0, "hy3dshape")
sys.path.insert(0, "hy3dpaint")
import mlx.core as mx
print("[probe] mlx device:", mx.default_device())
import torch
print("[probe] torch:", torch.__version__, "mps:", torch.backends.mps.is_available())
from hy3dshape.pipeline_mlx import ShapePipeline
print("[probe] Stage 1 ShapePipeline import OK")
from textureGenPipeline_mlx import Hunyuan3DPaintConfigMLX, Hunyuan3DPaintPipelineMLX
print("[probe] Stage 2 Hunyuan3DPaintPipelineMLX import OK")
print("[probe] ALL IMPORTS OK")
PY
echo "[hy3d] done — venv ready. First generate downloads ~15GB MLX weights + dinov2-giant."