diff --git a/examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj/project.pbxproj b/examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj/project.pbxproj index e5cf007168..53f974d794 100644 --- a/examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj/project.pbxproj +++ b/examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj/project.pbxproj @@ -57,24 +57,6 @@ 03D03DAC2C7823830088D6A7 /* text_decoder_runner.h in Headers */ = {isa = PBXBuildFile; fileRef = 03D03DAA2C7823830088D6A7 /* text_decoder_runner.h */; }; 03DDA0FB2BD6368100D234B3 /* base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 03DDA0FA2BD6368100D234B3 /* base64.h */; }; 26A6A4282C8A3769005A761E /* ImagePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26A6A4272C8A3769005A761E /* ImagePicker.swift */; }; - 84DD94742C8105EB00C765A6 /* LLaMAPerfBenchmarkApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DD94732C8105EB00C765A6 /* LLaMAPerfBenchmarkApp.swift */; }; - 84DD94812C81060E00C765A6 /* backend_coreml in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD94802C81060E00C765A6 /* backend_coreml */; }; - 84DD94832C81060E00C765A6 /* backend_coreml_debug in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD94822C81060E00C765A6 /* backend_coreml_debug */; }; - 84DD94852C81060E00C765A6 /* backend_mps in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD94842C81060E00C765A6 /* backend_mps */; }; - 84DD94872C81060E00C765A6 /* backend_mps_debug in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD94862C81060E00C765A6 /* backend_mps_debug */; }; - 84DD94892C81060E00C765A6 /* backend_xnnpack in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD94882C81060E00C765A6 /* backend_xnnpack */; }; - 84DD948B2C81060E00C765A6 /* backend_xnnpack_debug in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD948A2C81060E00C765A6 /* backend_xnnpack_debug */; }; - 84DD94912C81060E00C765A6 /* kernels_custom in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD94902C81060E00C765A6 /* kernels_custom */; }; - 84DD94932C81060E00C765A6 /* kernels_custom_debug in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD94922C81060E00C765A6 /* kernels_custom_debug */; }; - 84DD94952C81060E00C765A6 /* kernels_optimized in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD94942C81060E00C765A6 /* kernels_optimized */; }; - 84DD94972C81060E00C765A6 /* kernels_optimized_debug in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD94962C81060E00C765A6 /* kernels_optimized_debug */; }; - 84DD94992C81060E00C765A6 /* kernels_portable in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD94982C81060E00C765A6 /* kernels_portable */; }; - 84DD949B2C81060E00C765A6 /* kernels_portable_debug in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD949A2C81060E00C765A6 /* kernels_portable_debug */; }; - 84DD949D2C81060E00C765A6 /* kernels_quantized in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD949C2C81060E00C765A6 /* kernels_quantized */; }; - 84DD949F2C81060E00C765A6 /* kernels_quantized_debug in Frameworks */ = {isa = PBXBuildFile; productRef = 84DD949E2C81060E00C765A6 /* kernels_quantized_debug */; }; - 84DD94A02C81061100C765A6 /* LLaMARunner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03729ED52BB1F8DE00152F2E /* LLaMARunner.framework */; }; - 84DD94A12C81061100C765A6 /* LLaMARunner.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 03729ED52BB1F8DE00152F2E /* LLaMARunner.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 84DD94AF2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DD94AE2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -85,20 +67,6 @@ remoteGlobalIDString = 03729ED42BB1F8DE00152F2E; remoteInfo = LLaMARunner; }; - 84DD94A22C81061100C765A6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 032C01672AC228E5002955E1 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 03729ED42BB1F8DE00152F2E; - remoteInfo = LLaMARunner; - }; - 84DD94B02C811E3E00C765A6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 032C01672AC228E5002955E1 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 84DD94702C8105EB00C765A6; - remoteInfo = LLaMAPerfBenchmark; - }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -113,17 +81,6 @@ name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; - 84DD94A42C81061100C765A6 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 84DD94A12C81061100C765A6 /* LLaMARunner.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -150,7 +107,6 @@ 03729F112BB2042B00152F2E /* sampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sampler.cpp; sourceTree = ""; }; 03729F142BB2043600152F2E /* bpe_tokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = bpe_tokenizer.cpp; path = ../../../../extension/llm/tokenizer/bpe_tokenizer.cpp; sourceTree = ""; }; 03729F152BB2043600152F2E /* tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tokenizer.h; path = ../../../../extension/llm/tokenizer/tokenizer.h; sourceTree = ""; }; - 0372C3102C893FE900CD942A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 0372C3122C89418E00CD942A /* llava_runner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = llava_runner.h; path = ../../../examples/models/llava/runner/llava_runner.h; sourceTree = ""; }; 0372C3132C89418E00CD942A /* llava_runner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = llava_runner.cpp; path = ../../../examples/models/llava/runner/llava_runner.cpp; sourceTree = ""; }; 038D678A2C482C1D00B88CF2 /* llama_tiktoken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = llama_tiktoken.cpp; sourceTree = ""; }; @@ -164,11 +120,6 @@ 03D03DAA2C7823830088D6A7 /* text_decoder_runner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = text_decoder_runner.h; sourceTree = ""; }; 03DDA0FA2BD6368100D234B3 /* base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = base64.h; path = ../../../../extension/llm/tokenizer/base64.h; sourceTree = ""; }; 26A6A4272C8A3769005A761E /* ImagePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagePicker.swift; sourceTree = ""; }; - 84DD94712C8105EB00C765A6 /* LLaMAPerfBenchmark.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LLaMAPerfBenchmark.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 84DD94732C8105EB00C765A6 /* LLaMAPerfBenchmarkApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LLaMAPerfBenchmarkApp.swift; sourceTree = ""; }; - 84DD94A72C8107AB00C765A6 /* LLaMAPerfBenchmark.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = LLaMAPerfBenchmark.entitlements; sourceTree = ""; }; - 84DD94AC2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LLaMAPerfBenchmarkTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 84DD94AE2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LLaMAPerfBenchmarkTests.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -203,35 +154,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 84DD946E2C8105EB00C765A6 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 84DD94932C81060E00C765A6 /* kernels_custom_debug in Frameworks */, - 84DD94972C81060E00C765A6 /* kernels_optimized_debug in Frameworks */, - 84DD94892C81060E00C765A6 /* backend_xnnpack in Frameworks */, - 84DD949B2C81060E00C765A6 /* kernels_portable_debug in Frameworks */, - 84DD949F2C81060E00C765A6 /* kernels_quantized_debug in Frameworks */, - 84DD94812C81060E00C765A6 /* backend_coreml in Frameworks */, - 84DD94912C81060E00C765A6 /* kernels_custom in Frameworks */, - 84DD94852C81060E00C765A6 /* backend_mps in Frameworks */, - 84DD94992C81060E00C765A6 /* kernels_portable in Frameworks */, - 84DD94A02C81061100C765A6 /* LLaMARunner.framework in Frameworks */, - 84DD94952C81060E00C765A6 /* kernels_optimized in Frameworks */, - 84DD948B2C81060E00C765A6 /* backend_xnnpack_debug in Frameworks */, - 84DD94872C81060E00C765A6 /* backend_mps_debug in Frameworks */, - 84DD949D2C81060E00C765A6 /* kernels_quantized in Frameworks */, - 84DD94832C81060E00C765A6 /* backend_coreml_debug in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 84DD94A92C811E3E00C765A6 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -314,11 +236,6 @@ 0324D69F2BAACB7C00DEF36F /* LLaMARunner */, 036CAF9D2BB1444500D6C2D5 /* LLaMA.app */, 03729ED52BB1F8DE00152F2E /* LLaMARunner.framework */, - 84DD94712C8105EB00C765A6 /* LLaMAPerfBenchmark.app */, - 84DD94722C8105EB00C765A6 /* LLaMAPerfBenchmark */, - 84DD94AD2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests */, - 84DD947F2C81060E00C765A6 /* Frameworks */, - 84DD94AC2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests.xctest */, ); sourceTree = ""; }; @@ -373,31 +290,6 @@ path = ../../../../../../extension/llm/sampler; sourceTree = ""; }; - 84DD94722C8105EB00C765A6 /* LLaMAPerfBenchmark */ = { - isa = PBXGroup; - children = ( - 84DD94A72C8107AB00C765A6 /* LLaMAPerfBenchmark.entitlements */, - 84DD94732C8105EB00C765A6 /* LLaMAPerfBenchmarkApp.swift */, - ); - path = LLaMAPerfBenchmark; - sourceTree = ""; - }; - 84DD947F2C81060E00C765A6 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 0372C3102C893FE900CD942A /* CoreGraphics.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 84DD94AD2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests */ = { - isa = PBXGroup; - children = ( - 84DD94AE2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests.swift */, - ); - path = LLaMAPerfBenchmarkTests; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -480,59 +372,6 @@ productReference = 03729ED52BB1F8DE00152F2E /* LLaMARunner.framework */; productType = "com.apple.product-type.framework"; }; - 84DD94702C8105EB00C765A6 /* LLaMAPerfBenchmark */ = { - isa = PBXNativeTarget; - buildConfigurationList = 84DD947C2C8105EC00C765A6 /* Build configuration list for PBXNativeTarget "LLaMAPerfBenchmark" */; - buildPhases = ( - 84DD946D2C8105EB00C765A6 /* Sources */, - 84DD946E2C8105EB00C765A6 /* Frameworks */, - 84DD946F2C8105EB00C765A6 /* Resources */, - 84DD94A42C81061100C765A6 /* Embed Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 84DD94A32C81061100C765A6 /* PBXTargetDependency */, - ); - name = LLaMAPerfBenchmark; - packageProductDependencies = ( - 84DD94802C81060E00C765A6 /* backend_coreml */, - 84DD94822C81060E00C765A6 /* backend_coreml_debug */, - 84DD94842C81060E00C765A6 /* backend_mps */, - 84DD94862C81060E00C765A6 /* backend_mps_debug */, - 84DD94882C81060E00C765A6 /* backend_xnnpack */, - 84DD948A2C81060E00C765A6 /* backend_xnnpack_debug */, - 84DD94902C81060E00C765A6 /* kernels_custom */, - 84DD94922C81060E00C765A6 /* kernels_custom_debug */, - 84DD94942C81060E00C765A6 /* kernels_optimized */, - 84DD94962C81060E00C765A6 /* kernels_optimized_debug */, - 84DD94982C81060E00C765A6 /* kernels_portable */, - 84DD949A2C81060E00C765A6 /* kernels_portable_debug */, - 84DD949C2C81060E00C765A6 /* kernels_quantized */, - 84DD949E2C81060E00C765A6 /* kernels_quantized_debug */, - ); - productName = LLaMAPerfBenchmark; - productReference = 84DD94712C8105EB00C765A6 /* LLaMAPerfBenchmark.app */; - productType = "com.apple.product-type.application"; - }; - 84DD94AB2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 84DD94B22C811E3E00C765A6 /* Build configuration list for PBXNativeTarget "LLaMAPerfBenchmarkTests" */; - buildPhases = ( - 84DD94A82C811E3E00C765A6 /* Sources */, - 84DD94A92C811E3E00C765A6 /* Frameworks */, - 84DD94AA2C811E3E00C765A6 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 84DD94B12C811E3E00C765A6 /* PBXTargetDependency */, - ); - name = LLaMAPerfBenchmarkTests; - productName = LLaMAPerfBenchmarkTests; - productReference = 84DD94AC2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -549,13 +388,6 @@ 03729ED42BB1F8DE00152F2E = { CreatedOnToolsVersion = 15.3; }; - 84DD94702C8105EB00C765A6 = { - CreatedOnToolsVersion = 15.4; - }; - 84DD94AB2C811E3E00C765A6 = { - CreatedOnToolsVersion = 15.4; - TestTargetID = 84DD94702C8105EB00C765A6; - }; }; }; buildConfigurationList = 032C016A2AC228E5002955E1 /* Build configuration list for PBXProject "LLaMA" */; @@ -576,8 +408,6 @@ targets = ( 032C016E2AC228E6002955E1 /* LLaMA */, 03729ED42BB1F8DE00152F2E /* LLaMARunner */, - 84DD94702C8105EB00C765A6 /* LLaMAPerfBenchmark */, - 84DD94AB2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests */, ); }; /* End PBXProject section */ @@ -598,20 +428,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 84DD946F2C8105EB00C765A6 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 84DD94AA2C811E3E00C765A6 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -670,22 +486,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 84DD946D2C8105EB00C765A6 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 84DD94742C8105EB00C765A6 /* LLaMAPerfBenchmarkApp.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 84DD94A82C811E3E00C765A6 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 84DD94AF2C811E3E00C765A6 /* LLaMAPerfBenchmarkTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -694,16 +494,6 @@ target = 03729ED42BB1F8DE00152F2E /* LLaMARunner */; targetProxy = 03729ED92BB1F8DE00152F2E /* PBXContainerItemProxy */; }; - 84DD94A32C81061100C765A6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 03729ED42BB1F8DE00152F2E /* LLaMARunner */; - targetProxy = 84DD94A22C81061100C765A6 /* PBXContainerItemProxy */; - }; - 84DD94B12C811E3E00C765A6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 84DD94702C8105EB00C765A6 /* LLaMAPerfBenchmark */; - targetProxy = 84DD94B02C811E3E00C765A6 /* PBXContainerItemProxy */; - }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ @@ -1071,168 +861,6 @@ }; name = Release; }; - 84DD947D2C8105EC00C765A6 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CODE_SIGN_ENTITLEMENTS = LLaMAPerfBenchmark/LLaMAPerfBenchmark.entitlements; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = ""; - ENABLE_PREVIEWS = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; - INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchScreen_Generation = YES; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - MARKETING_VERSION = 1.0; - "OTHER_LDFLAGS[sdk=iphoneos*]" = ( - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_optimized-ios-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_portable-ios-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_custom-ios-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_quantized-ios-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_xnnpack-ios-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_coreml-ios-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_mps-ios-debug.a", - ); - "OTHER_LDFLAGS[sdk=iphonesimulator*]" = ( - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_optimized-simulator-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_portable-simulator-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_custom-simulator-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_quantized-simulator-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_xnnpack-simulator-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_coreml-simulator-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_mps-simulator-debug.a", - ); - PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.illama; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 84DD947E2C8105EC00C765A6 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CODE_SIGN_ENTITLEMENTS = LLaMAPerfBenchmark/LLaMAPerfBenchmark.entitlements; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = ""; - ENABLE_PREVIEWS = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; - INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchScreen_Generation = YES; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - MARKETING_VERSION = 1.0; - "OTHER_LDFLAGS[sdk=iphoneos*]" = ( - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_portable-ios-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_custom-ios-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_quantized-ios-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_xnnpack-ios-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_coreml-ios-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_mps-ios-debug.a", - ); - "OTHER_LDFLAGS[sdk=iphonesimulator*]" = ( - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_portable-simulator-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_custom-simulator-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libkernels_quantized-simulator-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_xnnpack-simulator-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_coreml-simulator-debug.a", - "-force_load", - "$(BUILT_PRODUCTS_DIR)/libbackend_mps-simulator-debug.a", - ); - PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.illama; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - 84DD94B32C811E3E00C765A6 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GCC_C_LANGUAGE_STANDARD = gnu17; - GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.illama; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LLaMAPerfBenchmark.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/LLaMAPerfBenchmark"; - }; - name = Debug; - }; - 84DD94B42C811E3E00C765A6 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - GCC_C_LANGUAGE_STANDARD = gnu17; - GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.illama; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LLaMAPerfBenchmark.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/LLaMAPerfBenchmark"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -1263,24 +891,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 84DD947C2C8105EC00C765A6 /* Build configuration list for PBXNativeTarget "LLaMAPerfBenchmark" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 84DD947D2C8105EC00C765A6 /* Debug */, - 84DD947E2C8105EC00C765A6 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 84DD94B22C811E3E00C765A6 /* Build configuration list for PBXNativeTarget "LLaMAPerfBenchmarkTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 84DD94B32C811E3E00C765A6 /* Debug */, - 84DD94B42C811E3E00C765A6 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ @@ -1370,76 +980,6 @@ package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; productName = executorch_debug; }; - 84DD94802C81060E00C765A6 /* backend_coreml */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_coreml; - }; - 84DD94822C81060E00C765A6 /* backend_coreml_debug */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_coreml_debug; - }; - 84DD94842C81060E00C765A6 /* backend_mps */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_mps; - }; - 84DD94862C81060E00C765A6 /* backend_mps_debug */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_mps_debug; - }; - 84DD94882C81060E00C765A6 /* backend_xnnpack */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_xnnpack; - }; - 84DD948A2C81060E00C765A6 /* backend_xnnpack_debug */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_xnnpack_debug; - }; - 84DD94902C81060E00C765A6 /* kernels_custom */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = kernels_custom; - }; - 84DD94922C81060E00C765A6 /* kernels_custom_debug */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = kernels_custom_debug; - }; - 84DD94942C81060E00C765A6 /* kernels_optimized */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = kernels_optimized; - }; - 84DD94962C81060E00C765A6 /* kernels_optimized_debug */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = kernels_optimized_debug; - }; - 84DD94982C81060E00C765A6 /* kernels_portable */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = kernels_portable; - }; - 84DD949A2C81060E00C765A6 /* kernels_portable_debug */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = kernels_portable_debug; - }; - 84DD949C2C81060E00C765A6 /* kernels_quantized */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = kernels_quantized; - }; - 84DD949E2C81060E00C765A6 /* kernels_quantized_debug */ = { - isa = XCSwiftPackageProductDependency; - package = 03312C172BBFC940002106EF /* XCRemoteSwiftPackageReference "executorch" */; - productName = kernels_quantized_debug; - }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 032C01672AC228E5002955E1 /* Project object */; diff --git a/examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj/xcshareddata/xcschemes/LLaMA.xcscheme b/examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj/xcshareddata/xcschemes/LLaMA.xcscheme index e02694c9f0..84fa8d5280 100644 --- a/examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj/xcshareddata/xcschemes/LLaMA.xcscheme +++ b/examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj/xcshareddata/xcschemes/LLaMA.xcscheme @@ -23,14 +23,14 @@ [UInt8]? { @@ -177,36 +176,38 @@ struct ContentView: View { .padding([.leading, .trailing, .bottom], 10) .sheet(isPresented: $isImagePickerPresented, onDismiss: addSelectedImageMessage) { ImagePicker(selectedImage: $selectedImage, sourceType: imagePickerSourceType) + .id(imagePickerSourceType.rawValue) } } .navigationBarTitle(title, displayMode: .inline) - .navigationBarItems(leading: - Button(action: { - showingSettings.toggle() - }) { - Image(systemName: "gearshape") - .imageScale(.large) - }) - .navigationBarItems(trailing: - HStack { - Menu { - Section(header: Text("Memory")) { - Text("Used: \(resourceMonitor.usedMemory) Mb") - Text("Available: \(resourceMonitor.availableMemory) Mb") - } - } label: { - Text("\(resourceMonitor.usedMemory) Mb") - } - .onAppear { - resourceMonitor.start() - } - .onDisappear { - resourceMonitor.stop() - } - Button(action: { showingLogs = true }) { - Image(systemName: "list.bullet.rectangle") - } - } + .navigationBarItems( + leading: + Button(action: { + showingSettings.toggle() + }) { + Image(systemName: "gearshape") + .imageScale(.large) + }, + trailing: + HStack { + Menu { + Section(header: Text("Memory")) { + Text("Used: \(resourceMonitor.usedMemory) Mb") + Text("Available: \(resourceMonitor.usedMemory) Mb") + } + } label: { + Text("\(resourceMonitor.usedMemory) Mb") + } + .onAppear { + resourceMonitor.start() + } + .onDisappear { + resourceMonitor.stop() + } + Button(action: { showingLogs = true }) { + Image(systemName: "list.bullet.rectangle") + } + } ) .sheet(isPresented: $showingLogs) { NavigationView { @@ -247,20 +248,24 @@ struct ContentView: View { isGenerating = true shouldStopGenerating = false shouldStopShowingToken = false - let text = prompt + let text = prompt.trimmingCharacters(in: .whitespacesAndNewlines) let seq_len = 768 // text: 256, vision: 768 let modelPath = resourceManager.modelPath let tokenizerPath = resourceManager.tokenizerPath - let useLlama = modelPath.range(of: "llama", options: .caseInsensitive) != nil + let useLlama = modelPath.lowercased().contains("llama") prompt = "" hideKeyboard() showingSettings = false + messages.append(Message(text: text)) + messages.append(Message(type: useLlama ? .llamagenerated : .llavagenerated)) + runnerQueue.async { defer { DispatchQueue.main.async { isGenerating = false + selectedImage = nil } } @@ -272,10 +277,7 @@ struct ContentView: View { guard !shouldStopGenerating else { return } if useLlama { - messages.append(Message(text: text)) - messages.append(Message(type: .llamagenerated)) - - if let runner = runnerHolder.runner, !runner.isloaded() { + if let runner = runnerHolder.runner, !runner.isLoaded() { var error: Error? let startLoadTime = Date() do { @@ -305,10 +307,7 @@ struct ContentView: View { } } } else { - messages.append(Message(text: text)) - messages.append(Message(type: .llavagenerated)) - - if let runner = runnerHolder.llavaRunner, !runner.isloaded() { + if let runner = runnerHolder.llavaRunner, !runner.isLoaded() { var error: Error? let startLoadTime = Date() do { @@ -367,7 +366,7 @@ struct ContentView: View { if token != llava_prompt { if token == "" { shouldStopGenerating = true - runnerHolder.runner?.stop() + runnerHolder.llavaRunner?.stop() } else { tokens.append(token) if tokens.count > 2 { @@ -383,7 +382,7 @@ struct ContentView: View { } } if shouldStopGenerating { - runnerHolder.runner?.stop() + runnerHolder.llavaRunner?.stop() } } } @@ -394,7 +393,7 @@ struct ContentView: View { try runnerHolder.runner?.generate(llama3_prompt, sequenceLength: seq_len) { token in NSLog(">>> token={\(token)}") - if token != llama3_prompt && !shouldStopShowingToken { + if token != llama3_prompt { // hack to fix the issue that extension/llm/runner/text_token_generator.h // keeps generating after <|eot_id|> if token == "<|eot_id|>" { @@ -458,6 +457,7 @@ struct ContentView: View { } runnerQueue.async { runnerHolder.runner = nil + runnerHolder.llavaRunner = nil } switch pickerType { case .model: diff --git a/examples/demo-apps/apple_ios/LLaMA/LLaMAPerfBenchmark/LLaMAPerfBenchmark.entitlements b/examples/demo-apps/apple_ios/LLaMA/LLaMAPerfBenchmark/LLaMAPerfBenchmark.entitlements deleted file mode 100644 index 99f471672d..0000000000 --- a/examples/demo-apps/apple_ios/LLaMA/LLaMAPerfBenchmark/LLaMAPerfBenchmark.entitlements +++ /dev/null @@ -1,8 +0,0 @@ - - - - - com.apple.developer.kernel.increased-memory-limit - - - diff --git a/examples/demo-apps/apple_ios/LLaMA/LLaMAPerfBenchmark/LLaMAPerfBenchmarkApp.swift b/examples/demo-apps/apple_ios/LLaMA/LLaMAPerfBenchmark/LLaMAPerfBenchmarkApp.swift deleted file mode 100644 index b09321f155..0000000000 --- a/examples/demo-apps/apple_ios/LLaMA/LLaMAPerfBenchmark/LLaMAPerfBenchmarkApp.swift +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import SwiftUI - -@main -struct LLaMAPerfBenchmarkApp: SwiftUI.App { - var body: some Scene { - WindowGroup { } - } -} diff --git a/examples/demo-apps/apple_ios/LLaMA/LLaMAPerfBenchmarkTests/LLaMAPerfBenchmarkTests.swift b/examples/demo-apps/apple_ios/LLaMA/LLaMAPerfBenchmarkTests/LLaMAPerfBenchmarkTests.swift deleted file mode 100644 index fa798f019d..0000000000 --- a/examples/demo-apps/apple_ios/LLaMA/LLaMAPerfBenchmarkTests/LLaMAPerfBenchmarkTests.swift +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import LLaMARunner -import XCTest - -final class LLaMAPerfBenchmarkTests: XCTestCase { - func testLlama2() throws { - guard - let modelPath = Bundle.main.path( - forResource: "llama2", - ofType: "pte", - inDirectory: "aatp/data" - ) - else { - XCTFail("Failed to get model path") - return - } - - guard - let tokenizerPath = Bundle.main.path( - forResource: "tokenizer", - ofType: "bin", - inDirectory: "aatp/data" - ) - else { - XCTFail("Failed to get tokenizer path") - return - } - - let runner = Runner(modelPath: modelPath, tokenizerPath: tokenizerPath) - do { - try runner.load() - } catch let loadError { - XCTFail("Failed to load the model: \(loadError)") - } - XCTAssertTrue(runner.isloaded()) - - let seq_len = 128 - var tokens: [String] = [] - try runner.generate("How do you do! I'm testing llama2 on mobile device", sequenceLength: seq_len) { token in - tokens.append(token) - } - } -} diff --git a/examples/demo-apps/apple_ios/LLaMA/LLaMARunner/LLaMARunner/Exported/LLaMARunner.h b/examples/demo-apps/apple_ios/LLaMA/LLaMARunner/LLaMARunner/Exported/LLaMARunner.h index c4edea2af9..1290a75d97 100644 --- a/examples/demo-apps/apple_ios/LLaMA/LLaMARunner/LLaMARunner/Exported/LLaMARunner.h +++ b/examples/demo-apps/apple_ios/LLaMA/LLaMARunner/LLaMARunner/Exported/LLaMARunner.h @@ -18,7 +18,7 @@ NS_SWIFT_NAME(Runner) - (instancetype)initWithModelPath:(NSString*)filePath tokenizerPath:(NSString*)tokenizerPath; -- (BOOL)isloaded; +- (BOOL)isLoaded; - (BOOL)loadWithError:(NSError**)error; - (BOOL)generate:(NSString*)prompt sequenceLength:(NSInteger)seq_len @@ -36,7 +36,7 @@ NS_SWIFT_NAME(LLaVARunner) - (instancetype)initWithModelPath:(NSString*)filePath tokenizerPath:(NSString*)tokenizerPath; -- (BOOL)isloaded; +- (BOOL)isLoaded; - (BOOL)loadWithError:(NSError**)error; - (BOOL)generate:(void*)imageBuffer width:(CGFloat)width diff --git a/examples/demo-apps/apple_ios/LLaMA/LLaMARunner/LLaMARunner/Exported/LLaMARunner.mm b/examples/demo-apps/apple_ios/LLaMA/LLaMARunner/LLaMARunner/Exported/LLaMARunner.mm index 3136d2745f..e6a4722ddb 100644 --- a/examples/demo-apps/apple_ios/LLaMA/LLaMARunner/LLaMARunner/Exported/LLaMARunner.mm +++ b/examples/demo-apps/apple_ios/LLaMA/LLaMARunner/LLaMARunner/Exported/LLaMARunner.mm @@ -40,7 +40,7 @@ - (void)dealloc { [ExecuTorchLog.sharedLog removeSink:self]; } -- (BOOL)isloaded { +- (BOOL)isLoaded { return _runner->is_loaded(); } @@ -128,7 +128,7 @@ - (void)dealloc { [ExecuTorchLog.sharedLog removeSink:self]; } -- (BOOL)isloaded { +- (BOOL)isLoaded { return _runner->is_loaded(); } diff --git a/extension/llm/runner/text_token_generator.h b/extension/llm/runner/text_token_generator.h index 0392e340c6..62b924a57d 100644 --- a/extension/llm/runner/text_token_generator.h +++ b/extension/llm/runner/text_token_generator.h @@ -18,7 +18,7 @@ namespace executorch { namespace extension { namespace llm { -class TextTokenGenerator { +class ET_EXPERIMENTAL TextTokenGenerator { public: TextTokenGenerator( Tokenizer* tokenizer, @@ -72,10 +72,11 @@ class TextTokenGenerator { // initialize tensor wrappers auto tokens_managed = from_blob( token_data.data(), token_shape, executorch::aten::ScalarType::Long); - auto start_pos_managed = from_blob(&pos, {1}, executorch::aten::ScalarType::Long); + should_stop_ = false; + // Generate our tokens while (pos < seq_len - 1) { // Run the model