Skip to content

Commit a42f1fb

Browse files
committed
examples: add Voxtral TTS prototype and handoff docs
Add the in-progress Voxtral TTS export, runner, parity, and acceptance tooling so the work can be resumed on another machine without losing the current investigation state. Made-with: Cursor
1 parent a489707 commit a42f1fb

27 files changed

Lines changed: 8104 additions & 0 deletions
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
cmake_minimum_required(VERSION 3.24)
8+
project(voxtral_tts)
9+
10+
set(CMAKE_CXX_STANDARD 17)
11+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
12+
13+
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
14+
15+
include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
16+
17+
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
18+
19+
# gflags
20+
set(gflags_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../../third-party/gflags)
21+
find_package(gflags REQUIRED)
22+
23+
# ExecuTorch
24+
list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../../..)
25+
find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH)
26+
executorch_target_link_options_shared_lib(executorch)
27+
28+
set(link_libraries executorch gflags)
29+
30+
# Common ops
31+
list(APPEND link_libraries optimized_native_cpu_ops_lib cpublas eigen_blas)
32+
executorch_target_link_options_shared_lib(optimized_native_cpu_ops_lib)
33+
34+
# CPU-only builds need quantized and custom ops
35+
if(NOT EXECUTORCH_BUILD_CUDA)
36+
list(APPEND link_libraries quantized_ops_lib custom_ops)
37+
executorch_target_link_options_shared_lib(quantized_ops_lib)
38+
executorch_target_link_options_shared_lib(custom_ops)
39+
endif()
40+
41+
# XNNPACK
42+
if(TARGET xnnpack_backend)
43+
set(xnnpack_backend_libs xnnpack_backend XNNPACK xnnpack-microkernels-prod)
44+
if(TARGET kleidiai)
45+
list(APPEND xnnpack_backend_libs kleidiai)
46+
endif()
47+
list(APPEND link_libraries ${xnnpack_backend_libs})
48+
executorch_target_link_options_shared_lib(xnnpack_backend)
49+
endif()
50+
51+
# LLM runner extension
52+
if(NOT TARGET extension_llm_runner)
53+
message(
54+
FATAL_ERROR
55+
"ExecuTorch must be installed with EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER enabled."
56+
)
57+
endif()
58+
59+
if(ANDROID)
60+
list(APPEND link_libraries log)
61+
endif()
62+
63+
list(
64+
APPEND
65+
link_libraries
66+
extension_llm_runner
67+
extension_module
68+
extension_data_loader
69+
extension_tensor
70+
extension_flat_tensor
71+
)
72+
73+
# CUDA backend
74+
if(EXECUTORCH_BUILD_CUDA)
75+
find_package(CUDAToolkit REQUIRED)
76+
list(APPEND link_libraries aoti_cuda_backend)
77+
if(NOT MSVC)
78+
executorch_target_link_options_shared_lib(aoti_cuda_backend)
79+
endif()
80+
endif()
81+
82+
# Metal backend
83+
if(EXECUTORCH_BUILD_METAL)
84+
list(APPEND link_libraries metal_backend)
85+
executorch_target_link_options_shared_lib(metal_backend)
86+
endif()
87+
88+
# Tokenizer
89+
list(APPEND link_libraries tokenizers::tokenizers)
90+
91+
add_executable(
92+
voxtral_tts_runner
93+
main.cpp
94+
voxtral_tts_runner.cpp
95+
wav_writer.cpp
96+
)
97+
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
98+
target_link_options_gc_sections(voxtral_tts_runner)
99+
if(NOT APPLE AND NOT MSVC)
100+
target_link_options(voxtral_tts_runner PRIVATE "LINKER:-s")
101+
endif()
102+
endif()
103+
104+
target_include_directories(
105+
voxtral_tts_runner PUBLIC
106+
${_common_include_directories}
107+
${EXECUTORCH_ROOT}/third-party/json/include
108+
)
109+
target_link_libraries(voxtral_tts_runner PUBLIC ${link_libraries})
110+
target_compile_options(
111+
voxtral_tts_runner PUBLIC ${_common_compile_options}
112+
)
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"version": 6,
3+
"configurePresets": [
4+
{
5+
"name": "voxtral-tts-base",
6+
"hidden": true,
7+
"binaryDir": "${sourceDir}/../../../cmake-out/examples/models/voxtral_tts",
8+
"cacheVariables": {
9+
"CMAKE_BUILD_TYPE": "Release",
10+
"CMAKE_FIND_ROOT_PATH": "${sourceDir}/../../../cmake-out",
11+
"CMAKE_PREFIX_PATH": "${sourceDir}/../../../cmake-out"
12+
}
13+
},
14+
{
15+
"name": "voxtral-tts-cpu",
16+
"displayName": "Voxtral TTS runner (CPU)",
17+
"inherits": [
18+
"voxtral-tts-base"
19+
]
20+
},
21+
{
22+
"name": "voxtral-tts-xnnpack",
23+
"displayName": "Voxtral TTS runner (XNNPACK)",
24+
"inherits": [
25+
"voxtral-tts-base"
26+
]
27+
}
28+
],
29+
"buildPresets": [
30+
{
31+
"name": "voxtral-tts-cpu",
32+
"displayName": "Build Voxtral TTS runner (CPU)",
33+
"configurePreset": "voxtral-tts-cpu",
34+
"configuration": "Release",
35+
"targets": [
36+
"voxtral_tts_runner"
37+
]
38+
},
39+
{
40+
"name": "voxtral-tts-xnnpack",
41+
"displayName": "Build Voxtral TTS runner (XNNPACK)",
42+
"configurePreset": "voxtral-tts-xnnpack",
43+
"configuration": "Release",
44+
"targets": [
45+
"voxtral_tts_runner"
46+
]
47+
}
48+
],
49+
"workflowPresets": [
50+
{
51+
"name": "voxtral-tts-cpu",
52+
"displayName": "Voxtral TTS (CPU)",
53+
"steps": [
54+
{
55+
"type": "configure",
56+
"name": "voxtral-tts-cpu"
57+
},
58+
{
59+
"type": "build",
60+
"name": "voxtral-tts-cpu"
61+
}
62+
]
63+
},
64+
{
65+
"name": "voxtral-tts-xnnpack",
66+
"displayName": "Voxtral TTS (XNNPACK)",
67+
"steps": [
68+
{
69+
"type": "configure",
70+
"name": "voxtral-tts-xnnpack"
71+
},
72+
{
73+
"type": "build",
74+
"name": "voxtral-tts-xnnpack"
75+
}
76+
]
77+
}
78+
]
79+
}

0 commit comments

Comments
 (0)