Skip to content

Commit 0977eb6

Browse files
authored
Merge branch 'pytorch:main' into main
2 parents 1d860b9 + 1619308 commit 0977eb6

443 files changed

Lines changed: 16473 additions & 4186 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.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5bf1aeb587e9b1f3572b0bd60265c5dafd007b73
1+
a9592258daacad7423fd5f39aaa59c6e36471520

.ci/scripts/export_model_artifact.sh

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Arguments:
3434
3535
output_dir Output directory for artifacts (optional, default: current directory)
3636
37-
mode Export mode (optional, default: auto-detect based on model and device)
37+
mode Export mode (optional, default: vr-streaming)
3838
Supported modes:
3939
- vr-streaming: Voxtral Realtime streaming mode
4040
- vr-offline: Voxtral Realtime offline mode
@@ -141,6 +141,14 @@ case "$HF_MODEL" in
141141
PREPROCESSOR_FEATURE_SIZE=""
142142
PREPROCESSOR_OUTPUT=""
143143
;;
144+
Qwen/Qwen3-0.6B)
145+
MODEL_NAME="qwen3"
146+
TASK="text-generation"
147+
MAX_SEQ_LEN="64"
148+
EXTRA_PIP=""
149+
PREPROCESSOR_FEATURE_SIZE=""
150+
PREPROCESSOR_OUTPUT=""
151+
;;
144152
nvidia/parakeet-tdt)
145153
MODEL_NAME="parakeet"
146154
TASK=""
@@ -159,7 +167,7 @@ case "$HF_MODEL" in
159167
;;
160168
*)
161169
echo "Error: Unsupported model '$HF_MODEL'"
162-
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, nvidia/parakeet-tdt"
170+
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/parakeet-tdt"
163171
exit 1
164172
;;
165173
esac
@@ -249,23 +257,20 @@ if [ "$MODEL_NAME" = "voxtral_realtime" ]; then
249257

250258
# Per-component quantization flags
251259
VR_QUANT_ARGS=""
260+
VR_DTYPE_ARGS=""
252261
if [ "$QUANT_NAME" = "quantized-8da4w" ]; then
253262
VR_QUANT_ARGS="--qlinear-encoder 8da4w --qlinear 8da4w --qlinear-group-size 32 --qembedding 8w"
254263
elif [ "$QUANT_NAME" = "quantized-int4-metal" ]; then
255264
VR_QUANT_ARGS="--qlinear-encoder fpa4w --qlinear fpa4w"
265+
elif [ "$QUANT_NAME" = "quantized-int4-tile-packed" ]; then
266+
VR_QUANT_ARGS="--qlinear-encoder 4w --qlinear-encoder-packing-format tile_packed_to_4d --qlinear 4w --qlinear-packing-format tile_packed_to_4d --qembedding 8w"
267+
VR_DTYPE_ARGS="--dtype bf16"
256268
fi
257269

258270
# Determine streaming mode based on MODE parameter
259-
USE_STREAMING="false"
260-
if [ "$MODE" = "vr-streaming" ]; then
261-
USE_STREAMING="true"
262-
elif [ "$MODE" = "vr-offline" ]; then
271+
USE_STREAMING="true"
272+
if [ "$MODE" = "vr-offline" ]; then
263273
USE_STREAMING="false"
264-
elif [ -z "$MODE" ]; then
265-
# Auto-detect: XNNPACK uses streaming, others use offline
266-
if [ "$DEVICE" = "xnnpack" ]; then
267-
USE_STREAMING="true"
268-
fi
269274
fi
270275

271276
# Configure export and preprocessor based on streaming mode
@@ -283,13 +288,17 @@ if [ "$MODEL_NAME" = "voxtral_realtime" ]; then
283288
--backend "$DEVICE" \
284289
${STREAMING_ARG} \
285290
--output-dir "${OUTPUT_DIR}" \
286-
${VR_QUANT_ARGS}
291+
${VR_QUANT_ARGS} \
292+
${VR_DTYPE_ARGS}
287293

288294
# Export preprocessor
289295
python -m executorch.extension.audio.mel_spectrogram ${PREPROCESSOR_ARGS}
290296

291297
test -f "${OUTPUT_DIR}/model.pte"
292298
test -f "${OUTPUT_DIR}/preprocessor.pte"
299+
if [ "$DEVICE" = "cuda" ] || [ "$DEVICE" = "cuda-windows" ]; then
300+
test -f "${OUTPUT_DIR}/aoti_cuda_blob.ptd"
301+
fi
293302
# Copy tokenizer from downloaded model weights
294303
cp "$LOCAL_MODEL_DIR/tekken.json" "${OUTPUT_DIR}/tekken.json"
295304
ls -al "${OUTPUT_DIR}"

.ci/scripts/test_huggingface_optimum_model.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,50 @@ def test_text_generation(model_id, model_dir, recipe, *, quantize=True, run_only
142142
"--qembedding",
143143
"8w",
144144
]
145+
elif recipe == "cuda":
146+
command += [
147+
"--dtype",
148+
"bfloat16",
149+
"--device",
150+
"cuda",
151+
]
152+
if quantize:
153+
command += [
154+
"--qlinear",
155+
"4w",
156+
"--qlinear_packing_format",
157+
"tile_packed_to_4d",
158+
"--qembedding",
159+
"8w",
160+
]
145161
else:
146162
assert (
147163
not quantize
148-
), "Quantization is only supported for XnnPack and CoreML recipes at the moment."
164+
), "Quantization is only supported for XnnPack, CoreML, and CUDA recipes at the moment."
149165

150166
if not run_only:
151167
cli_export(command, model_dir)
152168

169+
if recipe == "cuda":
170+
model_path = Path(model_dir) / "model.pte"
171+
cuda_blob_path = Path(model_dir) / "aoti_cuda_blob.ptd"
172+
assert model_path.exists(), f"Main model file not found: {model_path}"
173+
assert cuda_blob_path.exists(), f"CUDA blob not found: {cuda_blob_path}"
174+
153175
tokenizer = AutoTokenizer.from_pretrained(model_id)
154176
saved_files = tokenizer.save_pretrained(model_dir)
155177
tokenizer_path = get_tokenizer_path(model_dir, saved_files)
156178

157179
from executorch.extension.llm.runner import GenerationConfig, TextLLMRunner
158180

159-
runner = TextLLMRunner(f"{model_dir}/model.pte", tokenizer_path)
181+
if recipe == "cuda":
182+
runner = TextLLMRunner(
183+
f"{model_dir}/model.pte",
184+
tokenizer_path,
185+
f"{model_dir}/aoti_cuda_blob.ptd",
186+
)
187+
else:
188+
runner = TextLLMRunner(f"{model_dir}/model.pte", tokenizer_path)
160189
tokens = []
161190
runner.generate(
162191
"Simply put, the theory of relativity states that",

.ci/scripts/test_lora.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212
cmake_install_executorch_libraries() {
1313
echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a"
1414
rm -rf cmake-out
15-
cmake --workflow llm-release
15+
cmake --preset llm-release -DEXECUTORCH_ENABLE_LOGGING=ON
16+
cmake --build --preset llm-release-install
1617
}
1718

1819
cmake_build_llama_runner() {

.ci/scripts/test_lora_multimethod.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212
cmake_install_executorch_libraries() {
1313
echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a"
1414
rm -rf cmake-out
15-
cmake --workflow llm-release
15+
cmake --preset llm-release -DEXECUTORCH_ENABLE_LOGGING=ON
16+
cmake --build --preset llm-release-install
1617
}
1718

1819
cmake_build_llama_runner() {

.ci/scripts/test_model_e2e.sh

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Arguments:
2121
- mistralai/Voxtral-Mini-3B-2507
2222
- openai/whisper series (whisper-{small, medium, large, large-v2, large-v3, large-v3-turbo})
2323
- google/gemma-3-4b-it
24+
- Qwen/Qwen3-0.6B
2425
- nvidia/parakeet-tdt
2526
- mistralai/Voxtral-Mini-4B-Realtime-2602
2627
@@ -151,6 +152,18 @@ case "$HF_MODEL" in
151152
AUDIO_FILE=""
152153
IMAGE_PATH="docs/source/_static/img/et-logo.png"
153154
;;
155+
Qwen/Qwen3-0.6B)
156+
MODEL_NAME="qwen3"
157+
RUNNER_TARGET="llama_main"
158+
RUNNER_PATH="llama"
159+
EXPECTED_OUTPUT="Paris"
160+
PREPROCESSOR=""
161+
TOKENIZER_URL="https://huggingface.co/Qwen/Qwen3-0.6B/resolve/main" # @lint-ignore
162+
TOKENIZER_FILE=""
163+
AUDIO_URL=""
164+
AUDIO_FILE=""
165+
IMAGE_PATH=""
166+
;;
154167
nvidia/parakeet-tdt)
155168
MODEL_NAME="parakeet"
156169
RUNNER_TARGET="parakeet_runner"
@@ -177,7 +190,7 @@ case "$HF_MODEL" in
177190
;;
178191
*)
179192
echo "Error: Unsupported model '$HF_MODEL'"
180-
echo "Supported models: mistralai/Voxtral-Mini-3B-2507, mistralai/Voxtral-Mini-4B-Realtime-2602, openai/whisper series (whisper-{small, medium, large, large-v2, large-v3, large-v3-turbo}), google/gemma-3-4b-it, nvidia/parakeet-tdt"
193+
echo "Supported models: mistralai/Voxtral-Mini-3B-2507, mistralai/Voxtral-Mini-4B-Realtime-2602, openai/whisper series (whisper-{small, medium, large, large-v2, large-v3, large-v3-turbo}), google/gemma-3-4b-it, Qwen/Qwen3-0.6B, nvidia/parakeet-tdt"
181194
exit 1
182195
;;
183196
esac
@@ -246,9 +259,14 @@ if [ "$(uname -s)" = "Darwin" ] && [ -f "$RUNNER_BIN" ]; then
246259
install_name_tool -change /opt/llvm-openmp/lib/libomp.dylib @rpath/libomp.dylib "$RUNNER_BIN"
247260
fi
248261
fi
249-
# For CUDA, add data_path argument (Metal embeds data in .pte)
262+
# For CUDA, add named data argument (Metal embeds data in .pte).
263+
# Llama runner uses --data_paths, other runners use --data_path.
250264
if [ "$DEVICE" = "cuda" ]; then
251-
RUNNER_ARGS="$RUNNER_ARGS --data_path ${MODEL_DIR}/aoti_cuda_blob.ptd"
265+
if [ "$RUNNER_PATH" = "llama" ]; then
266+
RUNNER_ARGS="$RUNNER_ARGS --data_paths ${MODEL_DIR}/aoti_cuda_blob.ptd"
267+
else
268+
RUNNER_ARGS="$RUNNER_ARGS --data_path ${MODEL_DIR}/aoti_cuda_blob.ptd"
269+
fi
252270
fi
253271

254272
# Add model-specific arguments
@@ -262,6 +280,15 @@ case "$MODEL_NAME" in
262280
gemma3)
263281
RUNNER_ARGS="$RUNNER_ARGS --tokenizer_path ${MODEL_DIR}/ --image_path $IMAGE_PATH"
264282
;;
283+
qwen3)
284+
PROMPT_FILE="${MODEL_DIR}/qwen3_prompt.txt"
285+
cat > "${PROMPT_FILE}" << 'EOF'
286+
<|im_start|>user
287+
What is the capital of France?<|im_end|>
288+
<|im_start|>assistant
289+
EOF
290+
RUNNER_ARGS="$RUNNER_ARGS --tokenizer_path ${MODEL_DIR}/ --prompt_file ${PROMPT_FILE}"
291+
;;
265292
parakeet)
266293
RUNNER_ARGS="--model_path ${MODEL_DIR}/model.pte --audio_path ${MODEL_DIR}/$AUDIO_FILE --tokenizer_path ${MODEL_DIR}/$TOKENIZER_FILE"
267294
# For CUDA, add data_path argument (Metal embeds data in .pte)
@@ -271,17 +298,14 @@ case "$MODEL_NAME" in
271298
;;
272299
voxtral_realtime)
273300
RUNNER_ARGS="--model_path ${MODEL_DIR}/model.pte --tokenizer_path ${MODEL_DIR}/$TOKENIZER_FILE --preprocessor_path ${MODEL_DIR}/$PREPROCESSOR --audio_path ${MODEL_DIR}/$AUDIO_FILE --temperature 0"
301+
# Add CUDA data path if present
302+
if [ "$DEVICE" = "cuda" ] && [ -f "${MODEL_DIR}/aoti_cuda_blob.ptd" ]; then
303+
RUNNER_ARGS="$RUNNER_ARGS --data_path ${MODEL_DIR}/aoti_cuda_blob.ptd"
304+
fi
274305
# Determine streaming mode based on MODE parameter
275-
USE_STREAMING="false"
276-
if [ "$MODE" = "vr-streaming" ]; then
277-
USE_STREAMING="true"
278-
elif [ "$MODE" = "vr-offline" ]; then
306+
USE_STREAMING="true"
307+
if [ "$MODE" = "vr-offline" ]; then
279308
USE_STREAMING="false"
280-
elif [ -z "$MODE" ]; then
281-
# Auto-detect: XNNPACK uses streaming, others use offline
282-
if [ "$DEVICE" = "xnnpack" ]; then
283-
USE_STREAMING="true"
284-
fi
285309
fi
286310
# Add streaming flag if needed
287311
if [ "$USE_STREAMING" = "true" ]; then

.ci/scripts/test_model_e2e_windows.ps1

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,19 @@ switch ($HfModel) {
6464
$audioUrl = "https://dldata-public.s3.us-east-2.amazonaws.com/2086-149220-0033.wav"
6565
$audioFile = "test_audio.wav"
6666
}
67+
"mistralai/Voxtral-Mini-4B-Realtime-2602" {
68+
$runnerTarget = "voxtral_realtime_runner"
69+
$runnerPath = "voxtral_realtime"
70+
$runnerPreset = "voxtral-realtime-cuda"
71+
$expectedOutput = "Loading audio from"
72+
$preprocessor = "preprocessor.pte"
73+
$tokenizerUrl = ""
74+
$tokenizerFile = "tekken.json"
75+
$audioUrl = "https://github.com/voxserv/audio_quality_testing_samples/raw/refs/heads/master/testaudio/16000/test01_20s.wav"
76+
$audioFile = "poem.wav"
77+
}
6778
default {
68-
throw "Unsupported model '$HfModel'. Supported: mistralai/Voxtral-Mini-3B-2507, nvidia/parakeet-tdt"
79+
throw "Unsupported model '$HfModel'. Supported: mistralai/Voxtral-Mini-3B-2507, mistralai/Voxtral-Mini-4B-Realtime-2602, nvidia/parakeet-tdt"
6980
}
7081
}
7182

@@ -171,6 +182,14 @@ try {
171182
"--data_path", $cudaBlob
172183
)
173184
}
185+
"mistralai/Voxtral-Mini-4B-Realtime-2602" {
186+
$runnerArgs += @(
187+
"--temperature", "0",
188+
"--tokenizer_path", (Join-Path -Path $resolvedModelDir -ChildPath $tokenizerFile),
189+
"--audio_path", (Join-Path -Path $resolvedModelDir -ChildPath $audioFile),
190+
"--preprocessor_path", (Join-Path -Path $resolvedModelDir -ChildPath $preprocessor)
191+
)
192+
}
174193
}
175194

176195
$stdoutFile = Join-Path -Path $env:TEMP -ChildPath ("et_runner_stdout_{0}.log" -f ([Guid]::NewGuid().ToString("N")))
@@ -186,23 +205,31 @@ try {
186205
-RedirectStandardError $stderrFile
187206

188207
$stdout = if (Test-Path -Path $stdoutFile -PathType Leaf) { Get-Content -Path $stdoutFile -Raw } else { "" }
208+
$stderr = if (Test-Path -Path $stderrFile -PathType Leaf) { Get-Content -Path $stderrFile -Raw } else { "" }
189209
$exitCode = $proc.ExitCode
190210
}
191211
finally {
192212
Remove-Item -Path $stdoutFile -ErrorAction SilentlyContinue
193213
Remove-Item -Path $stderrFile -ErrorAction SilentlyContinue
194214
}
195-
Write-Host "Runner output:"
215+
Write-Host "Runner stdout:"
196216
Write-Host $stdout
217+
Write-Host "Runner stderr:"
218+
Write-Host $stderr
197219

198220
if ($exitCode -ne 0) {
199221
Write-Warning "Runner exited with code $exitCode (may be benign)"
200222
}
201223

202-
if ($expectedOutput -ne "" -and $stdout -notmatch [Regex]::Escape($expectedOutput)) {
203-
throw "Expected output '$expectedOutput' not found in runner output"
224+
if ($expectedOutput -ne "") {
225+
if ($stdout -notmatch [Regex]::Escape($expectedOutput)) {
226+
throw "Expected output '$expectedOutput' not found in runner output"
227+
}
228+
Write-Host "Success: '$expectedOutput' found in output"
229+
}
230+
else {
231+
Write-Host "Success: runner completed"
204232
}
205-
Write-Host "Success: '$expectedOutput' found in output"
206233
Write-Host "::endgroup::"
207234
}
208235
finally {

.ci/scripts/test_wheel_package_qnn.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ EOF
8686
# ----------------------------
8787
echo "=== Building Wheel Package ==="
8888
source .ci/scripts/utils.sh
89+
90+
# Ensure QNN SDK is available so setup.py auto-detects it.
91+
source backends/qualcomm/scripts/install_qnn_sdk.sh
92+
install_qnn
93+
94+
# Make QNN SDK libraries available for runtime loading (e.g. libQnnHtp.so)
95+
export LD_LIBRARY_PATH="${QNN_SDK_ROOT}/lib/x86_64-linux-clang/:${LD_LIBRARY_PATH:-}"
96+
8997
install_executorch
9098
EXECUTORCH_BUILDING_WHEEL=1 python setup.py bdist_wheel
9199
unset EXECUTORCH_BUILDING_WHEEL

.ci/scripts/unittest-buck2.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ done
4545

4646
# Build only without testing
4747
buck2 build //codegen/tools/... \
48+
//exir/_serialize/test/... \
49+
//exir/backend/test:test_delegate_map_builder \
50+
//exir/backend/test:test_graph_partition \
51+
//exir/backend/test:test_group_partitioner \
52+
//exir/backend/test:test_passes \
53+
//exir/dialects/backend/test/... \
54+
//exir/dialects/edge/op/... \
55+
//exir/operator/... \
4856
//extension/llm/runner/io_manager:io_manager \
4957
//extension/llm/modules/... \
5058
//extension/llm/runner:multimodal_runner_lib \

.ci/scripts/unittest-linux-cmake.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@ if ! python -c "import tosa_serializer" >/dev/null 2>&1; then
1414
TOSA_SERIALIZATION_DIR="./examples/arm/arm-scratch/tosa-tools/serialization"
1515
if [[ ! -d "${TOSA_SERIALIZATION_DIR}" ]]; then
1616
TOSA_TOOLS_DIR="$(mktemp -d /tmp/tosa-tools.XXXXXX)"
17-
git clone --depth 1 --branch v2025.11.0 \
17+
git clone --depth 1 --branch v2025.11.2 \
1818
https://git.gitlab.arm.com/tosa/tosa-tools.git "${TOSA_TOOLS_DIR}"
1919
TOSA_SERIALIZATION_DIR="${TOSA_TOOLS_DIR}/serialization"
2020
fi
2121

22-
# Workaround to allow TOSA serializer to build for v2025.11.0
23-
python -m pip install pybind11==2.10.4
24-
2522
CMAKE_POLICY_VERSION_MINIMUM=3.5 BUILD_PYBIND=1 \
2623
python -m pip install --no-dependencies \
2724
"${TOSA_SERIALIZATION_DIR}"

0 commit comments

Comments
 (0)