Repository navigation
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·82 lines (69 loc) · 3.06 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·82 lines (69 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env bash
# Download LiveWan assets and optional Wan2.1 components
# Usage: ./setup.sh [target directory]
set -euo pipefail
ROOT="${1:-$(cd "$(dirname "$0")" && pwd)}"
HF_REPO="${HF_REPO:-JonathanColetti/LiveWan}"
BASE_REPO="Wan-AI/Wan2.1-T2V-1.3B"
command -v hf >/dev/null || { echo "need the 'hf' CLI: pip install huggingface_hub" >&2; exit 1; }
echo "==> LiveWan weights and data -> $ROOT/assets (~12 GB)"
# optimizer shards are excluded from the inference download
hf download "$HF_REPO" --local-dir "$ROOT/assets" \
--exclude "checkpoints/t14b_b64/opt_rank*"
# the base transformer is only required for new world generation
echo "==> Wan2.1 VAE -> $ROOT/wan21_13b (0.5 GB, always required)"
hf download "$BASE_REPO" --local-dir "$ROOT/wan21_13b" \
--include "Wan2.1_VAE.pth" "config.json"
if [ "${SKIP_BASE:-0}" = "1" ]; then
echo "==> skipping the base transformer (SKIP_BASE=1); the four shipped worlds still"
echo " work, but you will not be able to generate new ones from text"
else
echo "==> Wan2.1 base transformer -> $ROOT/wan21_13b (5.7 GB, needed to generate new"
echo " worlds from text; set SKIP_BASE=1 to skip)"
hf download "$BASE_REPO" --local-dir "$ROOT/wan21_13b" \
--include "diffusion_pytorch_model.safetensors"
fi
if [ "${SKIP_T5:-0}" = "1" ]; then
echo "==> skipping umt5-xxl (SKIP_T5=1); the 96 prompt bank still works, free text will not"
else
echo "==> umt5-xxl text encoder -> $ROOT/wan21_13b (11 GB, only needed for free-text prompts;"
echo " set SKIP_T5=1 to skip it)"
hf download "$BASE_REPO" --local-dir "$ROOT/wan21_13b" \
--include "models_t5_umt5-xxl-enc-bf16.pth"
fi
echo "==> Wan2.1 reference code -> $ROOT/wan21_repo"
if [ ! -d "$ROOT/wan21_repo" ]; then
git clone -q --depth 1 https://github.com/Wan-Video/Wan2.1 "$ROOT/wan21_repo"
# apply the SDPA fallback and 640x368 configuration patches
cp "$ROOT/wan21_patches/modules/attention.py" "$ROOT/wan21_repo/wan/modules/attention.py"
cp "$ROOT/wan21_patches/configs/__init__.py" "$ROOT/wan21_repo/wan/configs/__init__.py"
echo " cloned and patched"
fi
# install the Wan checkout while keeping this projects dependency pins
pip install -q --no-deps -e "$ROOT/wan21_repo"
# verify checksums for downloaded files
if [ -f "$ROOT/assets/checksums.sha256" ]; then
echo "==> verifying checksums"
( cd "$ROOT/assets"
present=$(mktemp)
while read -r sum path; do
[ -f "$path" ] && printf '%s %s\n' "$sum" "$path" >> "$present"
done < checksums.sha256
n=$(wc -l < "$present")
if [ "$n" -eq 0 ]; then
echo " no checksummed files present; nothing to verify" >&2
elif sha256sum -c --quiet "$present"; then
echo " $n file(s) verified"
else
echo " CHECKSUM MISMATCH: the download is corrupt; delete $ROOT/assets and rerun" >&2
rm -f "$present"; exit 1
fi
rm -f "$present" )
else
echo "==> no checksums.sha256 in the download; skipping verification" >&2
fi
cat <<EOF
done. Everything landed under $ROOT, which is where the defaults look.
livewan-serve
then open http://localhost:17070/?token=1234
EOF