Skip to content

Commit db8ef6b

Browse files
authored
Introduce TextLLMRunner - sync updates from fbsource (#12094)
1 parent b42dc6d commit db8ef6b

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj/project.pbxproj

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
03D151CF2E0E9ACB007A38BE /* text_prefiller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03D151CE2E0E9ACB007A38BE /* text_prefiller.cpp */; };
4646
03D151D02E0E9ACB007A38BE /* text_llm_runner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03D151CD2E0E9ACB007A38BE /* text_llm_runner.cpp */; };
4747
03D151D12E0E9ACB007A38BE /* text_decoder_runner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03D151CC2E0E9ACB007A38BE /* text_decoder_runner.cpp */; };
48+
03D151D92E0E9E43007A38BE /* ExecuTorchTextLLMRunner.mm in Sources */ = {isa = PBXBuildFile; fileRef = 03D151D42E0E9E43007A38BE /* ExecuTorchTextLLMRunner.mm */; };
49+
03D151DA2E0E9E43007A38BE /* BUCK in Resources */ = {isa = PBXBuildFile; fileRef = 03D151D72E0E9E43007A38BE /* BUCK */; };
50+
03D151DB2E0E9E43007A38BE /* ExecuTorchTextLLMRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 03D151D32E0E9E43007A38BE /* ExecuTorchTextLLMRunner.h */; };
51+
03D151DC2E0E9E43007A38BE /* ExecuTorchLLM.h in Headers */ = {isa = PBXBuildFile; fileRef = 03D151D22E0E9E43007A38BE /* ExecuTorchLLM.h */; };
4852
26A6A4282C8A3769005A761E /* ImagePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26A6A4272C8A3769005A761E /* ImagePicker.swift */; };
4953
306A713D2DC1DC0F00936B1F /* token_decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 306A713C2DC1DC0F00936B1F /* token_decoder.h */; };
5054
306A713E2DC1DC0F00936B1F /* regex.h in Headers */ = {isa = PBXBuildFile; fileRef = 306A71392DC1DC0F00936B1F /* regex.h */; };
@@ -129,6 +133,10 @@
129133
03D151CC2E0E9ACB007A38BE /* text_decoder_runner.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = text_decoder_runner.cpp; sourceTree = "<group>"; };
130134
03D151CD2E0E9ACB007A38BE /* text_llm_runner.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = text_llm_runner.cpp; sourceTree = "<group>"; };
131135
03D151CE2E0E9ACB007A38BE /* text_prefiller.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = text_prefiller.cpp; sourceTree = "<group>"; };
136+
03D151D22E0E9E43007A38BE /* ExecuTorchLLM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExecuTorchLLM.h; sourceTree = "<group>"; };
137+
03D151D32E0E9E43007A38BE /* ExecuTorchTextLLMRunner.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExecuTorchTextLLMRunner.h; sourceTree = "<group>"; };
138+
03D151D42E0E9E43007A38BE /* ExecuTorchTextLLMRunner.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ExecuTorchTextLLMRunner.mm; sourceTree = "<group>"; };
139+
03D151D72E0E9E43007A38BE /* BUCK */ = {isa = PBXFileReference; lastKnownFileType = text; path = BUCK; sourceTree = "<group>"; };
132140
26A6A4272C8A3769005A761E /* ImagePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagePicker.swift; sourceTree = "<group>"; };
133141
306A71352DC1DC0F00936B1F /* hf_tokenizer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hf_tokenizer.h; sourceTree = "<group>"; };
134142
306A71362DC1DC0F00936B1F /* pcre2_regex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pcre2_regex.h; sourceTree = "<group>"; };
@@ -253,6 +261,7 @@
253261
isa = PBXGroup;
254262
children = (
255263
0324D69B2BAACB7C00DEF36F /* Exported */,
264+
03D151D82E0E9E43007A38BE /* apple */,
256265
03729F062BB2035900152F2E /* runner */,
257266
03729F0F2BB203E100152F2E /* sampler */,
258267
03729F0E2BB203D700152F2E /* tokenizers */,
@@ -332,6 +341,34 @@
332341
path = ../../../../../../extension/llm/sampler;
333342
sourceTree = "<group>";
334343
};
344+
03D151D52E0E9E43007A38BE /* Exported */ = {
345+
isa = PBXGroup;
346+
children = (
347+
03D151D22E0E9E43007A38BE /* ExecuTorchLLM.h */,
348+
03D151D32E0E9E43007A38BE /* ExecuTorchTextLLMRunner.h */,
349+
03D151D42E0E9E43007A38BE /* ExecuTorchTextLLMRunner.mm */,
350+
);
351+
path = Exported;
352+
sourceTree = "<group>";
353+
};
354+
03D151D62E0E9E43007A38BE /* ExecuTorchLLM */ = {
355+
isa = PBXGroup;
356+
children = (
357+
03D151D52E0E9E43007A38BE /* Exported */,
358+
);
359+
path = ExecuTorchLLM;
360+
sourceTree = "<group>";
361+
};
362+
03D151D82E0E9E43007A38BE /* apple */ = {
363+
isa = PBXGroup;
364+
children = (
365+
03D151D62E0E9E43007A38BE /* ExecuTorchLLM */,
366+
03D151D72E0E9E43007A38BE /* BUCK */,
367+
);
368+
name = apple;
369+
path = /Users/shoumikhin/executorch/extension/llm/apple;
370+
sourceTree = "<absolute>";
371+
};
335372
F292B0842D88B0D200BE6839 /* tokenizers */ = {
336373
isa = PBXGroup;
337374
children = (
@@ -383,6 +420,8 @@
383420
F292B0892D88B0D200BE6839 /* tokenizer.h in Headers */,
384421
F292B08B2D88B0D200BE6839 /* result.h in Headers */,
385422
F292B08D2D88B0D200BE6839 /* error.h in Headers */,
423+
03D151DB2E0E9E43007A38BE /* ExecuTorchTextLLMRunner.h in Headers */,
424+
03D151DC2E0E9E43007A38BE /* ExecuTorchLLM.h in Headers */,
386425
F292B08E2D88B0D200BE6839 /* bpe_tokenizer_base.h in Headers */,
387426
F292B08F2D88B0D200BE6839 /* log.h in Headers */,
388427
F292B0912D88B0D200BE6839 /* tiktoken.h in Headers */,
@@ -512,6 +551,7 @@
512551
isa = PBXResourcesBuildPhase;
513552
buildActionMask = 2147483647;
514553
files = (
554+
03D151DA2E0E9E43007A38BE /* BUCK in Resources */,
515555
);
516556
runOnlyForDeploymentPostprocessing = 0;
517557
};
@@ -566,6 +606,7 @@
566606
03729EE12BB1F93800152F2E /* LLaMARunner.mm in Sources */,
567607
0372C3152C89418E00CD942A /* llava_runner.cpp in Sources */,
568608
03D151CA2E0E98C4007A38BE /* sentencepiece.cpp in Sources */,
609+
03D151D92E0E9E43007A38BE /* ExecuTorchTextLLMRunner.mm in Sources */,
569610
03D151CB2E0E98C4007A38BE /* regex_lookahead.cpp in Sources */,
570611
03D151CF2E0E9ACB007A38BE /* text_prefiller.cpp in Sources */,
571612
03D151D02E0E9ACB007A38BE /* text_llm_runner.cpp in Sources */,
@@ -814,6 +855,7 @@
814855
"DEBUG=1",
815856
"ET_USE_TIKTOKEN=1",
816857
"SUPPORT_REGEX_LOOKAHEAD=ON",
858+
"BUILD_WITH_XCODE=1",
817859
);
818860
GENERATE_INFOPLIST_FILE = YES;
819861
INFOPLIST_KEY_NSHumanReadableCopyright = "";
@@ -850,7 +892,10 @@
850892
DYLIB_INSTALL_NAME_BASE = "@rpath";
851893
ENABLE_MODULE_VERIFIER = YES;
852894
GCC_C_LANGUAGE_STANDARD = gnu17;
853-
GCC_PREPROCESSOR_DEFINITIONS = "SUPPORT_REGEX_LOOKAHEAD=ON";
895+
GCC_PREPROCESSOR_DEFINITIONS = (
896+
"SUPPORT_REGEX_LOOKAHEAD=ON",
897+
"BUILD_WITH_XCODE=1",
898+
);
854899
GENERATE_INFOPLIST_FILE = YES;
855900
INFOPLIST_KEY_NSHumanReadableCopyright = "";
856901
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";

examples/demo-apps/apple_ios/LLaMA/LLaMARunner/LLaMARunner/Exported/LLaMARunner.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
#import "LLaMARunner.h"
1010

1111
#import <ExecuTorch/ExecuTorchLog.h>
12+
#if BUILD_WITH_XCODE
13+
#import "ExecuTorchTextLLMRunner.h"
14+
#else
1215
#import <ExecuTorchLLM/ExecuTorchLLM.h>
16+
#endif
1317
#import <executorch/examples/models/llama/tokenizer/llama_tiktoken.h>
1418

1519
@interface LLaMARunner ()<ExecuTorchLogSink>

0 commit comments

Comments
 (0)