11load ("@fbcode_macros//build_defs:build_file_migration.bzl" , "fbcode_target" , "non_fbcode_target" )
2+ load ("@fbcode_macros//build_defs:python_library.bzl" , "python_library" )
3+ load ("@fbsource//xplat/executorch/build:runtime_wrapper.bzl" , "runtime" )
4+
25oncall ("executorch" )
36# Any targets that should be shared between fbcode and xplat must be defined in
47# targets.bzl. This file can contain fbcode-only targets.
@@ -17,3 +20,37 @@ load(":targets.bzl", "define_common_targets")
1720
1821
1922fbcode_target (_kind = define_common_targets ,)
23+
24+ # Python bindings for LLM runner
25+ fbcode_target (
26+ _kind = runtime .cxx_python_extension ,
27+ name = "_llm_runner" ,
28+ srcs = ["pybindings.cpp" ],
29+ visibility = ["PUBLIC" ],
30+ deps = [
31+ ":runner_lib" ,
32+ ":multimodal_runner_lib" ,
33+ ":stats" ,
34+ "//executorch/extension/llm/sampler:sampler" ,
35+ "//executorch/extension/module:module" ,
36+ "//executorch/runtime:runtime" ,
37+ "//pytorch/tokenizers:headers" ,
38+ ],
39+ external_deps = [
40+ "libtorch_python" ,
41+ "pybind11" ,
42+ ],
43+ )
44+
45+ # Python library that exposes the runner module
46+ python_library (
47+ name = "runner" ,
48+ srcs = ["__init__.py" ],
49+ base_module = "executorch.extension.llm.runner" ,
50+ visibility = ["PUBLIC" ],
51+ deps = [
52+ ":_llm_runner" ,
53+ "fbsource//third-party/pypi/transformers:transformers" ,
54+ "fbcode//caffe2:torch" ,
55+ ],
56+ )
0 commit comments