Skip to content

Commit 405379d

Browse files
authored
add buck and vtito model support
Differential Revision: D93530191 Pull Request resolved: #17513
1 parent 83fd8d0 commit 405379d

3 files changed

Lines changed: 39 additions & 2 deletions

File tree

examples/models/gemma3/BUCK

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target")
22
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
33
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
4+
load(":targets.bzl", "define_common_targets")
45

56
oncall("executorch")
67

8+
non_fbcode_target(_kind = define_common_targets,)
9+
10+
fbcode_target(_kind = define_common_targets,)
11+
712
fbcode_target(_kind = runtime.python_library,
813
name = "gemma3",
914
srcs = [

examples/models/gemma3/e2e_runner.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ DEFINE_int32(
5555
-1,
5656
"Number of CPU threads for inference. Defaults to -1, which implies we'll use a heuristic to derive the # of performant cores for a specific device.");
5757

58+
DEFINE_int32(
59+
target_size,
60+
896,
61+
"Target image size for resizing. Defaults to 896.");
62+
5863
DEFINE_bool(warmup, false, "Whether to run a warmup run.");
5964

6065
namespace {
@@ -109,8 +114,7 @@ MultimodalInput loadImage(const std::string& image_path) {
109114
height,
110115
channels);
111116

112-
// Resize to 896x896 (Gemma3 vision encoder input size)
113-
const int target_size = 896;
117+
const int target_size = FLAGS_target_size;
114118
std::vector<uint8_t> resized_data(target_size * target_size * channels);
115119

116120
int resize_result = stbir_resize_uint8(

examples/models/gemma3/targets.bzl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2+
3+
def define_common_targets():
4+
runtime.cxx_binary(
5+
name = "vision_llm_runner",
6+
srcs = [
7+
"e2e_runner.cpp",
8+
],
9+
compiler_flags = ["-Wno-global-constructors"],
10+
preprocessor_flags = ["-DET_USE_THREADPOOL"],
11+
deps = [
12+
"//executorch/extension/llm/runner:multimodal_runner_lib",
13+
"//executorch/extension/llm/runner:runner_lib",
14+
"//executorch/extension/module:module",
15+
"//executorch/extension/tensor:tensor",
16+
"//executorch/extension/threadpool:cpuinfo_utils",
17+
"//executorch/extension/threadpool:threadpool",
18+
"//pytorch/tokenizers:tiktoken",
19+
"//executorch/backends/xnnpack:xnnpack_backend",
20+
"//executorch/configurations:optimized_native_cpu_ops",
21+
"//executorch/kernels/quantized:generated_lib",
22+
"//executorch/extension/llm/custom_ops:custom_ops",
23+
],
24+
external_deps = [
25+
"gflags",
26+
"stb",
27+
],
28+
)

0 commit comments

Comments
 (0)