Skip to content

Commit 2d4533a

Browse files
authored
Whisper targets
Differential Revision: D79949336 Pull Request resolved: #13269
1 parent 3840b28 commit 2d4533a

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
2+
load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary")
3+
load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_version")
4+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
5+
6+
oncall("executorch")
7+
8+
python_library(
9+
name = "whisper_model_lib",
10+
srcs = [
11+
"whisper_model.py",
12+
],
13+
deps = [
14+
"//caffe2:torch",
15+
"fbsource//third-party/pypi/transformers:transformers",
16+
],
17+
)
18+
19+
python_library(
20+
name = "whisper_lib",
21+
srcs = ["whisper.py"],
22+
deps = [
23+
":whisper_model_lib",
24+
"//caffe2:torch",
25+
"//executorch/backends/qualcomm/_passes:passes",
26+
"//executorch/backends/qualcomm/partition:partition",
27+
"//executorch/backends/qualcomm/quantizer:quantizer",
28+
"//executorch/backends/qualcomm/serialization:serialization",
29+
"//executorch/backends/qualcomm/utils:utils",
30+
"//executorch/devtools/backend_debug:delegation_info",
31+
"//executorch/examples/qualcomm:utils",
32+
"//executorch/exir/capture:config",
33+
"//executorch/exir/passes:memory_planning_pass",
34+
"fbsource//third-party/pypi/datasets:datasets",
35+
"fbsource//third-party/pypi/librosa:librosa",
36+
"fbsource//third-party/pypi/soundfile:soundfile",
37+
"fbsource//third-party/pypi/torchmetrics:torchmetrics",
38+
"fbsource//third-party/pypi/transformers:transformers",
39+
],
40+
)
41+
42+
python_binary(
43+
name = "whisper",
44+
main_module = "executorch.examples.qualcomm.oss_scripts.whisper.whisper",
45+
deps = [
46+
":whisper_lib",
47+
],
48+
)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
load(
2+
"@fbsource//tools/build_defs:default_platform_defs.bzl",
3+
"ANDROID",
4+
)
5+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_oss_build_kwargs", "runtime")
6+
load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_version")
7+
8+
def define_common_targets():
9+
runtime.cxx_library(
10+
name = "runner_lib",
11+
srcs = glob(
12+
[
13+
"runner/*.cpp",
14+
],
15+
),
16+
exported_headers = glob([
17+
"runner/*.h",
18+
]),
19+
compiler_flags = [
20+
"-Wno-global-constructors",
21+
"-Wunused-command-line-argument",
22+
],
23+
deps = [
24+
"//executorch/extension/llm/runner:stats",
25+
"//executorch/kernels/quantized:generated_lib",
26+
"fbsource//third-party/qualcomm/qnn/qnn-{0}:api".format(get_qnn_library_version()),
27+
],
28+
exported_deps = [
29+
"//executorch/extension/module:module",
30+
"//executorch/extension/llm/sampler:sampler",
31+
"//executorch/extension/tensor:tensor",
32+
"//pytorch/tokenizers:hf_tokenizer",
33+
"//executorch/extension/evalue_util:print_evalue",
34+
"//executorch/backends/qualcomm/runtime:runtime",
35+
],
36+
external_deps = [
37+
"gflags",
38+
],
39+
platforms = [ANDROID],
40+
**get_oss_build_kwargs()
41+
)
42+
43+
runtime.cxx_binary(
44+
name = "qnn_whisper_runner",
45+
srcs = [
46+
"qnn_whisper_runner.cpp",
47+
],
48+
compiler_flags = [
49+
"-Wno-global-constructors",
50+
],
51+
deps = [
52+
":runner_lib",
53+
"//executorch/extension/threadpool:threadpool",
54+
],
55+
external_deps = [
56+
"gflags",
57+
],
58+
platforms = [ANDROID],
59+
**get_oss_build_kwargs()
60+
)

examples/qualcomm/oss_scripts/whisper/whisper.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
#
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
6+
7+
# TODO: reenable pyre after fixing the issues
8+
# pyre-ignore-all-errors
9+
610
import getpass
711
import json
812
import logging

0 commit comments

Comments
 (0)