Skip to content

Commit

Permalink
Create a new LLaMAPerfBenchmark app
Browse files Browse the repository at this point in the history
  • Loading branch information
huydhn committed Aug 29, 2024
1 parent 4c17665 commit 1cf1cc8
Show file tree
Hide file tree
Showing 7 changed files with 419 additions and 62 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/apple-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,6 @@ jobs:
curl "https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/${{ matrix.model }}_${{ matrix.delegate }}/model.zip" -o model.zip
unzip model.zip
# DEBUG: TO BE REMOVED
ls -lah
${CONDA_RUN} --no-capture-output \
build/build_apple_llm_demo.sh ${{ matrix.tokenizer }} ${ARTIFACTS_DIR_NAME}
Expand Down
6 changes: 3 additions & 3 deletions build/build_apple_llm_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cp *.pte *.bin "${TEST_RESOURCE_PATH}/"
if [[ "${TOKENIZER}" = "bpe" ]]; then
xcodebuild build-for-testing \
-project "${APP_PATH}.xcodeproj" \
-scheme LLaMA \
-scheme LLaMAPerfBenchmark \
-destination platform="iOS" \
-allowProvisioningUpdates \
DEVELOPMENT_TEAM=78E7V7QP35 \
Expand All @@ -33,7 +33,7 @@ if [[ "${TOKENIZER}" = "bpe" ]]; then
else
xcodebuild build-for-testing \
-project "${APP_PATH}.xcodeproj" \
-scheme LLaMA \
-scheme LLaMAPerfBenchmark \
-destination platform="iOS" \
-allowProvisioningUpdates \
DEVELOPMENT_TEAM=78E7V7QP35 \
Expand All @@ -53,7 +53,7 @@ PLATFORM="iphoneos"
pushd "${BUILD_DIR}/${MODE}-${PLATFORM}"

rm -rf Payload && mkdir Payload
APP_NAME=LLaMA
APP_NAME=LLaMAPerfBenchmark

ls -lah
cp -r "${APP_NAME}.app" Payload && zip -vr "${APP_NAME}.ipa" Payload
Expand Down
439 changes: 384 additions & 55 deletions examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.kernel.increased-memory-limit</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* 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 { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import XCTest
import LLaMARunner

final class LLaMATests: XCTestCase {
final class LLaMAPerfBenchmarkTests: XCTestCase {
func testLlama2() throws {
guard
let modelPath = Bundle(for: type(of: self))
Expand All @@ -34,5 +34,12 @@ final class LLaMATests: XCTestCase {
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)
}
}
}

0 comments on commit 1cf1cc8

Please sign in to comment.