Skip to content

Commit 0804a80

Browse files
authored
Merge branch 'main' into main
2 parents 1b3e52c + 298311e commit 0804a80

File tree

839 files changed

+42349
-9466
lines changed

Some content is hidden

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

839 files changed

+42349
-9466
lines changed

.ci/docker/build.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ case "${IMAGE_NAME}" in
4040
LINTRUNNER=""
4141
GCC_VERSION=11
4242
;;
43+
executorch-ubuntu-22.04-gcc11-aarch64-android)
44+
LINTRUNNER=""
45+
GCC_VERSION=11
46+
ANDROID_NDK_VERSION=r28c
47+
;;
48+
executorch-ubuntu-22.04-gcc11-aarch64-arm-sdk)
49+
ARM_SDK=yes
50+
GCC_VERSION=11
51+
;;
4352
executorch-ubuntu-22.04-linter)
4453
LINTRUNNER=yes
4554
CLANG_VERSION=12
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7a79b41e29a790ebb4b530eb98a89381e2d7de29
1+
659af3c353e49b35c191cdd2dba3b3c79d0e6822

.ci/docker/common/install_android.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@ install_ndk() {
4040
rm -rf "${NDK_INSTALLATION_DIR}" && mkdir -p "${NDK_INSTALLATION_DIR}"
4141

4242
pushd /tmp
43-
# The NDK installation is cached on ossci-android S3 bucket
44-
curl -Os --retry 3 "https://ossci-android.s3.amazonaws.com/android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
43+
ARCH=$(uname -m)
44+
if [ "${ARCH}" = "aarch64" ]; then
45+
# aarch64 NDK is not cached on S3, download from Google directly
46+
curl -Os --retry 3 "https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
47+
else
48+
# The NDK installation is cached on ossci-android S3 bucket
49+
curl -Os --retry 3 "https://ossci-android.s3.amazonaws.com/android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
50+
fi
4551
unzip -qo "android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
4652

4753
# Print the content for manual verification
@@ -73,7 +79,10 @@ install_sdk() {
7379
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "build-tools;35.0.0"
7480
# And some more tools for future emulator tests
7581
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "platform-tools"
76-
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "tools"
82+
# The 'tools' package (emulator) is not available on aarch64
83+
if [ "$(uname -m)" != "aarch64" ]; then
84+
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "tools"
85+
fi
7786
}
7887

7988
install_prerequiresites

.ci/docker/requirements-ci.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ sphinx-reredirects==0.1.4
3030
matplotlib>=3.9.4
3131
sphinx-copybutton==0.5.2
3232
# PyTorch Theme
33-
pytorch_sphinx_theme2==0.2.0
33+
pytorch_sphinx_theme2==0.4.4
3434
# script unit test requirements
3535
yaspin==3.1.0
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# Copyright (c) Samsung Electronics Co. LTD
4+
# All rights reserved.
5+
#
6+
# This source code is licensed under the BSD-style license found in the
7+
# LICENSE file in the root directory of this source tree.
8+
9+
set +ex
10+
11+
if [[ "${DEVICE_ACQUIRED:-0}" != "1" ]]; then
12+
exit 0
13+
fi
14+
15+
if ! command -v devicefarm-cli >/dev/null 2>&1; then
16+
echo "[WARN] Skip device disconnect (devicefarm-cli not installed)." >&2
17+
exit 0
18+
fi
19+
20+
echo "[INFO] Disconnecting device (-d)..."
21+
devicefarm-cli -d || echo "::warning::Device disconnect failed (ignored)"
22+
23+
set -ex

.ci/scripts/export_model_artifact.sh

Lines changed: 98 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
show_help() {
1111
cat << EOF
12-
Usage: export_model_artifact.sh <device> <hf_model> [quant_name] [output_dir]
12+
Usage: export_model_artifact.sh <device> <hf_model> [quant_name] [output_dir] [mode]
1313
1414
Export a HuggingFace model to CUDA/Metal/XNNPACK format with optional quantization.
1515
@@ -19,6 +19,7 @@ Arguments:
1919
hf_model HuggingFace model ID (required)
2020
Supported models:
2121
- mistralai/Voxtral-Mini-3B-2507
22+
- mistralai/Voxtral-Mini-4B-Realtime-2602
2223
- openai/whisper series (whisper-{small, medium, large, large-v2, large-v3, large-v3-turbo})
2324
- google/gemma-3-4b-it
2425
- nvidia/parakeet-tdt
@@ -33,13 +34,22 @@ Arguments:
3334
3435
output_dir Output directory for artifacts (optional, default: current directory)
3536
37+
mode Export mode (optional, default: auto-detect based on model and device)
38+
Supported modes:
39+
- vr-streaming: Voxtral Realtime streaming mode
40+
- vr-offline: Voxtral Realtime offline mode
41+
3642
Examples:
3743
export_model_artifact.sh metal "openai/whisper-small"
3844
export_model_artifact.sh metal "nvidia/parakeet-tdt" "quantized-int4-metal"
45+
export_model_artifact.sh metal "mistralai/Voxtral-Mini-4B-Realtime-2602" "quantized-int4-metal"
46+
export_model_artifact.sh metal "mistralai/Voxtral-Mini-4B-Realtime-2602" "non-quantized" "." "vr-streaming"
3947
export_model_artifact.sh cuda "mistralai/Voxtral-Mini-3B-2507" "quantized-int4-tile-packed"
4048
export_model_artifact.sh cuda "google/gemma-3-4b-it" "non-quantized" "./output"
4149
export_model_artifact.sh cuda "nvidia/parakeet-tdt" "non-quantized" "./output"
4250
export_model_artifact.sh xnnpack "nvidia/parakeet-tdt" "quantized-8da4w" "./output"
51+
export_model_artifact.sh xnnpack "mistralai/Voxtral-Mini-4B-Realtime-2602" "quantized-8da4w" "./output"
52+
export_model_artifact.sh xnnpack "mistralai/Voxtral-Mini-4B-Realtime-2602" "non-quantized" "./output" "vr-offline"
4353
EOF
4454
}
4555

@@ -60,6 +70,26 @@ DEVICE="$1"
6070
HF_MODEL="$2"
6171
QUANT_NAME="${3:-non-quantized}"
6272
OUTPUT_DIR="${4:-.}"
73+
MODE="${5:-}"
74+
75+
# Validate mode if specified
76+
if [ -n "$MODE" ]; then
77+
case "$MODE" in
78+
vr-streaming|vr-offline)
79+
# Voxtral Realtime modes require Voxtral Realtime model
80+
if [ "$HF_MODEL" != "mistralai/Voxtral-Mini-4B-Realtime-2602" ]; then
81+
echo "Error: Mode '$MODE' can only be used with Voxtral Realtime model"
82+
echo "Provided model: $HF_MODEL"
83+
exit 1
84+
fi
85+
;;
86+
*)
87+
echo "Error: Unsupported mode '$MODE'"
88+
echo "Supported modes: vr-streaming, vr-offline"
89+
exit 1
90+
;;
91+
esac
92+
fi
6393

6494
case "$DEVICE" in
6595
cuda)
@@ -119,9 +149,17 @@ case "$HF_MODEL" in
119149
PREPROCESSOR_FEATURE_SIZE=""
120150
PREPROCESSOR_OUTPUT=""
121151
;;
152+
mistralai/Voxtral-Mini-4B-Realtime-2602)
153+
MODEL_NAME="voxtral_realtime"
154+
TASK=""
155+
MAX_SEQ_LEN=""
156+
EXTRA_PIP="mistral-common librosa"
157+
PREPROCESSOR_FEATURE_SIZE=""
158+
PREPROCESSOR_OUTPUT=""
159+
;;
122160
*)
123161
echo "Error: Unsupported model '$HF_MODEL'"
124-
echo "Supported models: mistralai/Voxtral-Mini-3B-2507, openai/whisper-{small, medium, large, large-v2, large-v3, large-v3-turbo}, google/gemma-3-4b-it, nvidia/parakeet-tdt"
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"
125163
exit 1
126164
;;
127165
esac
@@ -201,6 +239,64 @@ if [ "$MODEL_NAME" = "parakeet" ]; then
201239
exit 0
202240
fi
203241

242+
# Voxtral Realtime uses a custom export script
243+
if [ "$MODEL_NAME" = "voxtral_realtime" ]; then
244+
pip install safetensors huggingface_hub
245+
246+
# Download model weights from HuggingFace (requires HF_TOKEN for gated model)
247+
LOCAL_MODEL_DIR="${OUTPUT_DIR}/model_weights"
248+
python -c "from huggingface_hub import snapshot_download; snapshot_download('${HF_MODEL}', local_dir='${LOCAL_MODEL_DIR}')"
249+
250+
# Per-component quantization flags
251+
VR_QUANT_ARGS=""
252+
if [ "$QUANT_NAME" = "quantized-8da4w" ]; then
253+
VR_QUANT_ARGS="--qlinear-encoder 8da4w --qlinear 8da4w --qlinear-group-size 32 --qembedding 8w"
254+
elif [ "$QUANT_NAME" = "quantized-int4-metal" ]; then
255+
VR_QUANT_ARGS="--qlinear-encoder fpa4w --qlinear fpa4w"
256+
fi
257+
258+
# 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
263+
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
269+
fi
270+
271+
# Configure export and preprocessor based on streaming mode
272+
STREAMING_ARG=""
273+
PREPROCESSOR_ARGS="--feature_size 128 --output_file ${OUTPUT_DIR}/preprocessor.pte"
274+
if [ "$USE_STREAMING" = "true" ]; then
275+
STREAMING_ARG="--streaming"
276+
PREPROCESSOR_ARGS="$PREPROCESSOR_ARGS --streaming"
277+
else
278+
PREPROCESSOR_ARGS="$PREPROCESSOR_ARGS --stack_output --max_audio_len 300"
279+
fi
280+
281+
python -m executorch.examples.models.voxtral_realtime.export_voxtral_rt \
282+
--model-path "$LOCAL_MODEL_DIR" \
283+
--backend "$DEVICE" \
284+
${STREAMING_ARG} \
285+
--output-dir "${OUTPUT_DIR}" \
286+
${VR_QUANT_ARGS}
287+
288+
# Export preprocessor
289+
python -m executorch.extension.audio.mel_spectrogram ${PREPROCESSOR_ARGS}
290+
291+
test -f "${OUTPUT_DIR}/model.pte"
292+
test -f "${OUTPUT_DIR}/preprocessor.pte"
293+
# Copy tokenizer from downloaded model weights
294+
cp "$LOCAL_MODEL_DIR/tekken.json" "${OUTPUT_DIR}/tekken.json"
295+
ls -al "${OUTPUT_DIR}"
296+
echo "::endgroup::"
297+
exit 0
298+
fi
299+
204300
MAX_SEQ_LEN_ARG=""
205301
if [ -n "$MAX_SEQ_LEN" ]; then
206302
MAX_SEQ_LEN_ARG="--max_seq_len $MAX_SEQ_LEN"

.ci/scripts/setup-samsung-linux-deps.sh

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,40 @@ if [[ -z "${API_KEY}" ]]; then
1414
exit 1
1515
fi
1616

17-
OS_NAME="Ubuntu 22.04"
18-
LITECORE_BASE="https://soc-developer.semiconductor.samsung.com/api/v1/resource/ai-litecore/download"
19-
DEVICEFARM_BASE="https://soc-developer.semiconductor.samsung.com/api/v1/resource/remotelab/download"
20-
21-
parse_url() {
22-
local json="$1"
23-
if command -v jq >/dev/null 2>&1; then
24-
jq -r '.data // empty' <<<"$json"
25-
else
26-
sed -n 's/.*"data":[[:space:]]*"\([^"]*\)".*/\1/p' <<<"$json"
27-
fi
28-
}
17+
export DEVICE_CONNECT_ENABLED=1
18+
19+
while [[ $# -gt 0 ]]; do
20+
case "$1" in
21+
--skip-device-connect)
22+
export DEVICE_CONNECT_ENABLED=0
23+
shift
24+
;;
25+
*)
26+
# Unknown option
27+
shift
28+
;;
29+
esac
30+
done
31+
32+
LITECORE_VERSION="v1.0"
33+
LITECORE_FILE_NAME="ai-litecore-ubuntu2204-${LITECORE_VERSION}.tar.gz"
34+
DEVICEFARM_CLI_VERSION="beta-v1.1.0"
35+
DEVICEFARM_FILE_NAME="devicefarmcli-${DEVICEFARM_CLI_VERSION}.zip"
36+
37+
LITECORE_URL="https://soc-developer.semiconductor.samsung.com/api/v1/resource/download-file/${LITECORE_FILE_NAME}"
38+
DEVICEFARM_URL="https://soc-developer.semiconductor.samsung.com/api/v1/resource/download-file/${DEVICEFARM_FILE_NAME}"
2939

3040
download_and_extract() {
31-
local base_url="$1"
32-
local version="$2"
33-
local out_dir="$3"
34-
local out_file="$4"
41+
local download_url="$1"
42+
local out_dir="$2"
43+
local out_file="$3"
3544

36-
local resp
37-
resp=$(curl -fsSL -G \
45+
echo "Downloading from ${download_url}..."
46+
curl -fsSL --retry 3 \
3847
-H "apikey: ${API_KEY}" \
39-
--data-urlencode "version=${version}" \
40-
--data-urlencode "os=${OS_NAME}" \
41-
"${base_url}")
42-
43-
local download_url
44-
download_url=$(parse_url "$resp")
45-
if [[ -z "${download_url}" ]]; then
46-
echo "ERROR: It failed to download from ${base_url} ."
47-
echo "Response: $resp" >&2
48-
exit 1
49-
fi
48+
-o "${out_file}" \
49+
"${download_url}"
5050

51-
curl -fsSL -L --retry 3 -o "${out_file}" "${download_url}"
5251
echo "Download completed: ${out_file}"
5352

5453
mkdir -p "${out_dir}"
@@ -60,7 +59,7 @@ download_and_extract() {
6059

6160
zip)
6261
echo "Extracting ZIP..."
63-
unzip -q -d "${out_dir}" "${out_file}"
62+
unzip -qo -d "${out_dir}" "${out_file}"
6463
;;
6564

6665
*)
@@ -71,13 +70,12 @@ download_and_extract() {
7170
}
7271

7372
download_ai_lite_core() {
74-
local litecore_version="${1:-1.0}"
75-
local litecore_out="/tmp/exynos-ai-litecore-v${litecore_version}.tar.gz"
73+
local litecore_version="${1:-${LITECORE_VERSION}}"
74+
local litecore_out="/tmp/${LITECORE_FILE_NAME}"
7675
local litecore_dir="/tmp/exynos_ai_lite_core"
7776

7877
download_and_extract \
79-
"${LITECORE_BASE}" \
80-
"${litecore_version}" \
78+
"${LITECORE_URL}" \
8179
"${litecore_dir}" \
8280
"${litecore_out}"
8381

@@ -86,22 +84,21 @@ download_ai_lite_core() {
8684
}
8785

8886
install_devicefarm_cli() {
89-
local cli_version="${1:-beta-1.0.9}"
90-
local cli_out="/tmp/devicefarm-cli-v${cli_version}.zip"
87+
local cli_version="${1:-${DEVICEFARM_CLI_VERSION}}"
88+
local cli_out="/tmp/${DEVICEFARM_FILE_NAME}"
9189
local cli_dir="/tmp/devicefarm_cli"
9290

9391
download_and_extract \
94-
"${DEVICEFARM_BASE}" \
95-
"${cli_version}" \
92+
"${DEVICEFARM_URL}" \
9693
"${cli_dir}" \
9794
"${cli_out}"
9895

9996
export PATH="${PATH%:}:${cli_dir}"
10097
chmod +x "${cli_dir}/devicefarm-cli"
10198
}
10299

103-
Enqueue_device_request() {
104-
export DEVICE_RESERVED=0
100+
acquire_device() {
101+
export DEVICE_ACQUIRED=0
105102
if ! command -v devicefarm-cli >/dev/null 2>&1; then
106103
echo "[WARN] devicefarm-cli is not installed." >&2
107104
return 1
@@ -138,7 +135,7 @@ Enqueue_device_request() {
138135
echo "$out"
139136
# Execute test command
140137
devicefarm-cli -E "ls /" || true
141-
export DEVICE_RESERVED=1
138+
export DEVICE_ACQUIRED=1
142139
echo "[INFO] Device successfully assigned and connected."
143140
return 0
144141
;;
@@ -173,10 +170,12 @@ install_enn_backend() {
173170
export PYTHONPATH="${PYTHONPATH:-}:${EXECUTORCH_ROOT}/.."
174171
}
175172

176-
litecore_ver="1.0"
177-
devicefarm_ver="beta-1.0.9"
178-
179-
download_ai_lite_core ${litecore_ver}
180-
install_devicefarm_cli "${devicefarm_ver}"
173+
download_ai_lite_core ${LITECORE_VERSION}
181174
install_enn_backend
182-
Enqueue_device_request
175+
176+
if [[ "${DEVICE_CONNECT_ENABLED}" == "1" ]]; then
177+
install_devicefarm_cli "${DEVICEFARM_CLI_VERSION}"
178+
acquire_device
179+
else
180+
export DEVICE_ACQUIRED=0
181+
fi

0 commit comments

Comments
 (0)