diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml new file mode 100644 index 00000000..e731b583 --- /dev/null +++ b/.github/workflows/ios.yml @@ -0,0 +1,29 @@ +name: ios +on: + push: + branches: + - master + - 'feature/**' + paths: + - 'src/**' + - 'ios/**' + - '.github/workflows/ios.yml' + pull_request: + branches: [master] + paths: + - 'src/**' + - 'ios/**' + - '.github/workflows/ios.yml' + +jobs: + build: + name: ios-build + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: build + run: ./script/ios_build.sh \ No newline at end of file diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 76a1baeb..6fd0a585 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -17,7 +17,7 @@ on: jobs: build: - name: linux-build + name: python-build runs-on: ubuntu-latest steps: diff --git a/resource/models/download_models.ps1 b/resource/models/download_models.ps1 deleted file mode 100644 index 0661a50f..00000000 --- a/resource/models/download_models.ps1 +++ /dev/null @@ -1,96 +0,0 @@ -function help { - Write-Host "model download script" - Write-Host "Usage: ./download_model.ps1 [OPTIONS]" - Write-Host "" - Write-Host "Options:" - Write-Host " -h,--help Print this help message and exit" - Write-Host " fp16,int8,int4 Chose different models" - Write-Host " proxy Use https://ghproxy.com to proxy github when download file" -} - -function fp16_model { - mkdir fp16 - for ($i = 0; $i -le 27; $i++) { - Invoke-WebRequest -Uri "$($args[0])https://github.com/wangzhaode/ChatGLM-MNN/releases/download/v0.1/glm_block_$i.mnn" -OutFile "fp16\glm_block_$i.mnn" - } - - Invoke-WebRequest -Uri "$($args[0])https://github.com/wangzhaode/ChatGLM-MNN/releases/download/v0.1/lm.mnn" -OutFile "fp16\lm.mnn" - Invoke-WebRequest -Uri "$($args[0])https://github.com/wangzhaode/ChatGLM-MNN/releases/download/v0.1/slim_word_embeddings.bin" -OutFile "fp16\slim_word_embeddings.bin" -} - -function int8_model { - mkdir int8 - for ($i = 0; $i -le 27; $i++) { - Invoke-WebRequest -Uri "$($args[0])https://github.com/wangzhaode/ChatGLM-MNN/releases/download/v0.2/glm_block_$i.mnn" -OutFile "int8\glm_block_$i.mnn" - } - - Invoke-WebRequest -Uri "$($args[0])https://github.com/wangzhaode/ChatGLM-MNN/releases/download/v0.1/lm.mnn" -OutFile "int8\lm.mnn" - Invoke-WebRequest -Uri "$($args[0])https://github.com/wangzhaode/ChatGLM-MNN/releases/download/v0.1/slim_word_embeddings.bin" -OutFile "int8\slim_word_embeddings.bin" -} - -function int4_model { - mkdir int4 - for ($i = 0; $i -le 27; $i++) { - Invoke-WebRequest -Uri "$($args[0])https://github.com/wangzhaode/ChatGLM-MNN/releases/download/v0.3/glm_block_$i.mnn" -OutFile "int4\glm_block_$i.mnn" - } - - Invoke-WebRequest -Uri "$($args[0])https://github.com/wangzhaode/ChatGLM-MNN/releases/download/v0.1/lm.mnn" -OutFile "int4\lm.mnn" - Invoke-WebRequest -Uri "$($args[0])https://github.com/wangzhaode/ChatGLM-MNN/releases/download/v0.1/slim_word_embeddings.bin" -OutFile "int4\slim_word_embeddings.bin" -} - -if ($args.Length -eq 0) { - help - exit 1 -} - -$proxy = $false - -foreach ($arg in $args) { - switch ($arg) { - "--help" { - help - } - "-h" { - help - } - "proxy" { - $proxy = $true - } - } -} - -if ($proxy) { - foreach ($arg in $args) { - switch ($arg) { - "fp16" { - fp16_model "https://ghproxy.com/" - } - "int8" { - int8_model "https://ghproxy.com/" - } - "int4" { - int4_model "https://ghproxy.com/" - } - default { - help - } - } - } -} else { - foreach ($arg in $args) { - switch ($arg) { - "fp16" { - fp16_model "" - } - "int8" { - int8_model "" - } - "int4" { - int4_model "" - } - default { - help - } - } - } -} \ No newline at end of file diff --git a/script/ios_build.sh b/script/ios_build.sh new file mode 100755 index 00000000..bad21029 --- /dev/null +++ b/script/ios_build.sh @@ -0,0 +1,6 @@ +xcodebuild build \ +-project ios/mnn-llm/mnn-llm.xcodeproj \ +-target mnn-llm \ +-destination "platform=iOS,id=dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder,name=Any iOS Device" \ +CODE_SIGN_IDENTITY="" \ +CODE_SIGNING_REQUIRED=NO