Skip to content

Commit d2ef854

Browse files
authored
Merge branch 'main' into main
2 parents 29c9332 + ed65b12 commit d2ef854

631 files changed

Lines changed: 64709 additions & 7711 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/docker/common/install_openssl.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
# This source code is licensed under the BSD-style license found in the
66
# LICENSE file in the root directory of this source tree.
77

8-
# NB: This script is needed for sccache and is adopted from PyTorch core repo at
9-
# https://github.com/pytorch/pytorch/blob/main/.ci/docker/common/install_openssl.sh
8+
# NB: This script is needed for sccache and is adopted from PyTorch core repo.
9+
# Core deleted its copy in pytorch/pytorch#179513, so this points at the last
10+
# revision that still had it instead of at a branch.
11+
# https://github.com/pytorch/pytorch/blob/9274b93eac9f026e9f51e282449b0300b8e05482/.ci/docker/common/install_openssl.sh
1012
set -ex
1113

1214
OPENSSL=openssl-1.1.1k

.ci/docker/common/install_pytorch.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,29 @@ install_pytorch_and_domains() {
4949
export MAX_JOBS="${PYTORCH_BUILD_MAX_JOBS}"
5050
fi
5151
configure_pytorch_compiler
52-
# Then build and install PyTorch
53-
conda_run python setup.py bdist_wheel
52+
# PyTorch no longer supports "python setup.py bdist_wheel"; it now builds
53+
# through scikit-build-core (PEP 517). Build the wheel with the standard
54+
# frontend and keep build isolation off, so PyTorch builds against this
55+
# environment's numpy and toolchain (avoids an ABI mismatch) and reuses
56+
# sccache.
57+
#
58+
# With isolation off the frontend does not fetch the PEP 517 build
59+
# requirements, so install them here. They go into a throwaway venv rather
60+
# than into the image, because scikit-build-core registers a setuptools
61+
# build_ext plugin: left in the image it hijacks every later
62+
# "pip install --no-build-isolation" and turns on C++20 module scanning that
63+
# the image compiler cannot satisfy. The venv inherits the image's
64+
# site-packages, so PyTorch still builds against the same numpy.
65+
#
66+
# Keep the list in sync with pytorch/pyproject.toml [build-system].requires.
67+
local build_venv=/tmp/pytorch-build-venv
68+
rm -rf "${build_venv}"
69+
conda_run python -m venv --system-site-packages "${build_venv}"
70+
conda_run "${build_venv}/bin/pip" install build "scikit-build-core>=1.0" \
71+
"setuptools>=77.0.0,<82" "cmake>=3.27,<4" ninja "packaging>=24.2" \
72+
"typing-extensions>=4.10.0" pyyaml six
73+
conda_run "${build_venv}/bin/python" -m build --wheel --no-isolation
74+
rm -rf "${build_venv}"
5475
pip_install "$(echo dist/*.whl)"
5576

5677
# Grab the pinned audio and vision commits from PyTorch

.ci/scripts/export_model_artifact.sh

Lines changed: 114 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Arguments:
2525
- nvidia/diar_streaming_sortformer_4spk-v2
2626
- nvidia/parakeet-tdt
2727
- facebook/dinov2-small-imagenet1k-1-layer
28+
- meta-models/Muse-Glimmer-30B-GGUF
2829
2930
quant_name Quantization type (optional, default: non-quantized)
3031
Options:
@@ -33,13 +34,17 @@ Arguments:
3334
- quantized-int4-weight-only (CUDA only)
3435
- quantized-int4-metal (Metal only)
3536
- quantized-8da4w (XNNPACK only)
37+
- kquant-17gb (Muse Glimmer only)
38+
- kquant-dynamic (Muse Glimmer only)
3639
3740
output_dir Output directory for artifacts (optional, default: current directory)
3841
3942
mode Export mode (optional, default: vr-streaming)
4043
Supported modes:
4144
- vr-streaming: Voxtral Realtime streaming mode
4245
- vr-offline: Voxtral Realtime offline mode
46+
- solo-text: Muse Glimmer solo text mode
47+
- dflash-image: Muse Glimmer DFlash vision mode
4348
4449
Examples:
4550
export_model_artifact.sh metal "openai/whisper-small"
@@ -53,6 +58,7 @@ Examples:
5358
export_model_artifact.sh xnnpack "nvidia/parakeet-tdt" "quantized-8da4w" "./output"
5459
export_model_artifact.sh xnnpack "mistralai/Voxtral-Mini-4B-Realtime-2602" "quantized-8da4w" "./output"
5560
export_model_artifact.sh xnnpack "mistralai/Voxtral-Mini-4B-Realtime-2602" "non-quantized" "./output" "vr-offline"
61+
export_model_artifact.sh cuda "meta-models/Muse-Glimmer-30B-GGUF" "kquant-17gb" "./output" "solo-text"
5662
EOF
5763
}
5864

@@ -89,9 +95,16 @@ if [ -n "$MODE" ]; then
8995
exit 1
9096
fi
9197
;;
98+
solo-text|dflash-image)
99+
if [ "$HF_MODEL" != "meta-models/Muse-Glimmer-30B-GGUF" ]; then
100+
echo "Error: Mode '$MODE' can only be used with Muse Glimmer model"
101+
echo "Provided model: $HF_MODEL"
102+
exit 1
103+
fi
104+
;;
92105
*)
93106
echo "Error: Unsupported mode '$MODE'"
94-
echo "Supported modes: vr-streaming, vr-offline"
107+
echo "Supported modes: vr-streaming, vr-offline, solo-text, dflash-image"
95108
exit 1
96109
;;
97110
esac
@@ -203,9 +216,17 @@ case "$HF_MODEL" in
203216
PREPROCESSOR_FEATURE_SIZE=""
204217
PREPROCESSOR_OUTPUT=""
205218
;;
219+
meta-models/Muse-Glimmer-30B-GGUF)
220+
MODEL_NAME="muse_glimmer"
221+
TASK=""
222+
MAX_SEQ_LEN=""
223+
EXTRA_PIP=""
224+
PREPROCESSOR_FEATURE_SIZE=""
225+
PREPROCESSOR_OUTPUT=""
226+
;;
206227
*)
207228
echo "Error: Unsupported model '$HF_MODEL'"
208-
echo "Supported models: mistralai/Voxtral-Mini-3B-2507, mistralai/Voxtral-Mini-4B-Realtime-2602, openai/whisper-{small, medium, large, large-v2, large-v3, large-v3-turbo}, google/gemma-3-4b-it, Qwen/Qwen3-0.6B, nvidia/diar_streaming_sortformer_4spk-v2, nvidia/parakeet-tdt, facebook/dinov2-small-imagenet1k-1-layer, SocialLocalMobile/Qwen3.5-35B-A3B-HQQ-INT4, unsloth/gemma-4-31B-it-GGUF"
229+
echo "Supported models: mistralai/Voxtral-Mini-3B-2507, mistralai/Voxtral-Mini-4B-Realtime-2602, openai/whisper-{small, medium, large, large-v2, large-v3, large-v3-turbo}, google/gemma-3-4b-it, Qwen/Qwen3-0.6B, nvidia/diar_streaming_sortformer_4spk-v2, nvidia/parakeet-tdt, facebook/dinov2-small-imagenet1k-1-layer, SocialLocalMobile/Qwen3.5-35B-A3B-HQQ-INT4, unsloth/gemma-4-31B-it-GGUF, meta-models/Muse-Glimmer-30B-GGUF"
209230
exit 1
210231
;;
211232
esac
@@ -243,13 +264,36 @@ case "$QUANT_NAME" in
243264
fi
244265
EXTRA_ARGS="--qlinear 8da4w --qlinear_group_size 32 --qlinear_encoder 8da4w --qlinear_encoder_group_size 32"
245266
;;
267+
kquant-17gb|kquant-dynamic)
268+
if [ "$HF_MODEL" != "meta-models/Muse-Glimmer-30B-GGUF" ]; then
269+
echo "Error: Quantization '$QUANT_NAME' can only be used with Muse Glimmer model"
270+
echo "Provided model: $HF_MODEL"
271+
exit 1
272+
fi
273+
EXTRA_ARGS=""
274+
;;
246275
*)
247276
echo "Error: Unsupported quantization '$QUANT_NAME'"
248-
echo "Supported quantizations: non-quantized, quantized-int4-tile-packed, quantized-int4-weight-only, quantized-int4-metal, quantized-8da4w"
277+
echo "Supported quantizations: non-quantized, quantized-int4-tile-packed, quantized-int4-weight-only, quantized-int4-metal, quantized-8da4w, kquant-17gb, kquant-dynamic"
249278
exit 1
250279
;;
251280
esac
252281

282+
if [ "$MODEL_NAME" = "muse_glimmer" ]; then
283+
if [ "$DEVICE" != "cuda" ]; then
284+
echo "Error: Muse Glimmer is only supported with the cuda device"
285+
exit 1
286+
fi
287+
if [ "$QUANT_NAME" != "kquant-17gb" ] && [ "$QUANT_NAME" != "kquant-dynamic" ]; then
288+
echo "Error: Muse Glimmer requires quantization 'kquant-17gb' or 'kquant-dynamic'"
289+
exit 1
290+
fi
291+
if [ "$MODE" != "solo-text" ] && [ "$MODE" != "dflash-image" ]; then
292+
echo "Error: Muse Glimmer requires mode 'solo-text' or 'dflash-image'"
293+
exit 1
294+
fi
295+
fi
296+
253297
echo "::group::Export $MODEL_NAME"
254298

255299
if [ -n "$EXTRA_PIP" ]; then
@@ -470,6 +514,73 @@ if [ "$MODEL_NAME" = "qwen3_5_moe" ]; then
470514
exit 0
471515
fi
472516

517+
# Muse Glimmer: download the selected GGUFs and export the requested CUDA configuration.
518+
if [ "$MODEL_NAME" = "muse_glimmer" ]; then
519+
pip install safetensors huggingface_hub gguf
520+
521+
LOCAL_MODEL_DIR=$(mktemp -d)
522+
INDUCTOR_CACHE=$(mktemp -d "${RUNNER_TEMP:-/tmp}/inductor_cache_XXXXXX")
523+
INDUCTOR_TMPDIR=$(mktemp -d "${RUNNER_TEMP:-/tmp}/tmpdir_XXXXXX")
524+
trap 'rm -rf "$LOCAL_MODEL_DIR" "$INDUCTOR_CACHE" "$INDUCTOR_TMPDIR"' EXIT
525+
526+
case "$QUANT_NAME" in
527+
kquant-17gb)
528+
TARGET_GGUF_FILE="Muse-Glimmer-30B-KQuant-17GB-Q4_K_M.gguf"
529+
;;
530+
kquant-dynamic)
531+
TARGET_GGUF_FILE="Muse-Glimmer-30B-KQuant-Dynamic-Q4_K_XL.gguf"
532+
;;
533+
esac
534+
535+
python -c "from huggingface_hub import hf_hub_download; hf_hub_download('${HF_MODEL}', '${TARGET_GGUF_FILE}', local_dir='${LOCAL_MODEL_DIR}')"
536+
TARGET_GGUF_PATH="${LOCAL_MODEL_DIR}/${TARGET_GGUF_FILE}"
537+
538+
echo "::group::Export"
539+
case "$MODE" in
540+
solo-text)
541+
EXPORT_START_SECONDS=$SECONDS
542+
TMPDIR="$INDUCTOR_TMPDIR" \
543+
TORCHINDUCTOR_CACHE_DIR="$INDUCTOR_CACHE" \
544+
python -m executorch.examples.models.muse_glimmer.export.export_solo \
545+
--gguf "$TARGET_GGUF_PATH" \
546+
--backend cuda \
547+
--output-dir "${OUTPUT_DIR}"
548+
;;
549+
dflash-image)
550+
DRAFT_GGUF_FILE="dflash-Muse-Glimmer-30B-Q4_K_M.gguf"
551+
MMPROJ_GGUF_FILE="mmproj-Muse-Glimmer-30B-Q4_K_M.gguf"
552+
python -c "from huggingface_hub import hf_hub_download; hf_hub_download('${HF_MODEL}', '${DRAFT_GGUF_FILE}', local_dir='${LOCAL_MODEL_DIR}')"
553+
python -c "from huggingface_hub import hf_hub_download; hf_hub_download('${HF_MODEL}', '${MMPROJ_GGUF_FILE}', local_dir='${LOCAL_MODEL_DIR}')"
554+
EXPORT_START_SECONDS=$SECONDS
555+
TMPDIR="$INDUCTOR_TMPDIR" \
556+
TORCHINDUCTOR_CACHE_DIR="$INDUCTOR_CACHE" \
557+
python -m executorch.examples.models.muse_glimmer.export.export_dflash \
558+
--target-gguf "$TARGET_GGUF_PATH" \
559+
--draft-gguf "${LOCAL_MODEL_DIR}/${DRAFT_GGUF_FILE}" \
560+
--mmproj "${LOCAL_MODEL_DIR}/${MMPROJ_GGUF_FILE}" \
561+
--backend cuda \
562+
--output-dir "${OUTPUT_DIR}"
563+
;;
564+
*)
565+
echo "Error: Muse Glimmer requires mode 'solo-text' or 'dflash-image'"
566+
exit 1
567+
;;
568+
esac
569+
EXPORT_DURATION_SECONDS=$((SECONDS - EXPORT_START_SECONDS))
570+
EXPORT_DURATION_MINUTES=$(awk -v seconds="$EXPORT_DURATION_SECONDS" 'BEGIN {printf "%.2f", seconds / 60}')
571+
echo "Muse Glimmer took ${EXPORT_DURATION_MINUTES} minutes to export."
572+
echo "::endgroup::"
573+
574+
test -f "${OUTPUT_DIR}/model.pte"
575+
test -f "${OUTPUT_DIR}/aoti_cuda_blob.ptd"
576+
if [ "$MODE" = "dflash-image" ]; then
577+
test -f "${OUTPUT_DIR}/pos_embed.bin"
578+
fi
579+
ls -al "${OUTPUT_DIR}"
580+
581+
exit 0
582+
fi
583+
473584
# Gemma 4 31B: download the Q4_K_M GGUF and export via the GGUF loader
474585
if [ "$MODEL_NAME" = "gemma4_31b" ]; then
475586
pip install safetensors huggingface_hub gguf
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Set-PSDebug -Trace 1
2+
$ErrorActionPreference = 'Stop'
3+
$PSNativeCommandUseErrorActionPreference = $true
4+
5+
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
6+
$vsInstallPath = & $vsWhere -latest -products * `
7+
-requires Microsoft.VisualStudio.Component.VC.Tools.ARM64 `
8+
-property installationPath
9+
if (-not $vsInstallPath) {
10+
throw "Visual Studio with the ARM64 C++ toolchain was not found."
11+
}
12+
$vsDevShell = Join-Path $vsInstallPath "Common7\Tools\Launch-VsDevShell.ps1"
13+
& $vsDevShell -Arch arm64 -HostArch amd64
14+
15+
$buildDir = "cmake-out-windows-arm64"
16+
if (Test-Path -Path $buildDir) {
17+
Remove-Item -Path $buildDir -Recurse -Force
18+
}
19+
20+
# XNNPACK's optional ARM ISA and assembly microkernels do not build with MSVC.
21+
# Baseline ARM64 NEON kernels remain enabled.
22+
cmake -S . -B $buildDir `
23+
-G "Visual Studio 17 2022" `
24+
-A ARM64 `
25+
-DCMAKE_BUILD_TYPE=Release `
26+
-DCMAKE_CXX_STANDARD=20 `
27+
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=ON `
28+
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON `
29+
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON `
30+
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON `
31+
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON `
32+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON `
33+
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON `
34+
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF `
35+
-DEXECUTORCH_BUILD_KERNELS_CUSTOM_AOT=OFF `
36+
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=OFF `
37+
-DEXECUTORCH_BUILD_XNNPACK=ON `
38+
-DEXECUTORCH_BUILD_EXTENSION_LLM=ON `
39+
-DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON `
40+
-DXNNPACK_ENABLE_ASSEMBLY=OFF `
41+
-DXNNPACK_ENABLE_ARM_BF16=OFF `
42+
-DXNNPACK_ENABLE_ARM_DOTPROD=OFF `
43+
-DXNNPACK_ENABLE_ARM_FP16_SCALAR=OFF `
44+
-DXNNPACK_ENABLE_ARM_FP16_VECTOR=OFF
45+
46+
cmake --build $buildDir --config Release -j $env:NUMBER_OF_PROCESSORS
47+
48+
Write-Host "Windows ARM64 build completed successfully!"

.ci/scripts/test_llava.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export_llava() {
114114
# Download a new image
115115
download_image() {
116116
echo "Downloading image"
117-
curl -o basketball.jpg https://upload.wikimedia.org/wikipedia/commons/7/73/Chicago_Bulls_and_New_Jersey_Nets%2C_March_28%2C_1991.jpg
117+
curl -fL -o basketball.jpg https://upload.wikimedia.org/wikipedia/commons/3/3e/Chicago_Bulls_-_New_Jersey_Nets_match_on_March_28%2C_1991.jpg
118118
}
119119

120120
run_and_verify() {

0 commit comments

Comments
 (0)