| @@ -22,13 +22,19 @@ fi | |||||
| mkdir ./temp; | mkdir ./temp; | ||||
| mkdir ./temp/runtimes; | mkdir ./temp/runtimes; | ||||
| cp ./LLama/runtimes/*.* ./temp/runtimes/; | |||||
| # For sure it could be done better but cp -R did not work on osx | |||||
| mkdir ./temp/runtimes/osx-arm64 | |||||
| mkdir ./temp/runtimes/osx-x64 | |||||
| cp ./LLama/runtimes/*.* ./temp/runtimes/; | |||||
| cp ./LLama/runtimes/osx-arm64/*.* ./temp/runtimes/osx-arm64/; | |||||
| cp ./LLama/runtimes/osx-x64/*.* ./temp/runtimes/osx-x64; | |||||
| cp ./LLama/runtimes/build/*.* ./temp/; | cp ./LLama/runtimes/build/*.* ./temp/; | ||||
| # get the current version | # get the current version | ||||
| cd temp; | cd temp; | ||||
| dotnet add package LLamaSharp; | dotnet add package LLamaSharp; | ||||
| version=$(dotnet list temp.csproj package | grep LLamaSharp); | version=$(dotnet list temp.csproj package | grep LLamaSharp); | ||||
| # TODO: This didn´t work on osx...we need a solution | |||||
| read -ra arr <<< "$version" | read -ra arr <<< "$version" | ||||
| version="${arr[-1]}" | version="${arr[-1]}" | ||||
| echo "The latest version: $version"; | echo "The latest version: $version"; | ||||
| @@ -6,9 +6,9 @@ on: | |||||
| cublas: | cublas: | ||||
| type: boolean | type: boolean | ||||
| description: Build CUBLAS binaries | description: Build CUBLAS binaries | ||||
| macos: | |||||
| osx: | |||||
| type: boolean | type: boolean | ||||
| description: Build MacOS binaries | |||||
| description: Build OSX binaries | |||||
| push: | push: | ||||
| branches: [cron_job] | branches: [cron_job] | ||||
| #schedule: | #schedule: | ||||
| @@ -147,7 +147,7 @@ jobs: | |||||
| include: | include: | ||||
| - build: 'arm64' | - build: 'arm64' | ||||
| defines: '-DCMAKE_OSX_ARCHITECTURES=arm64' | defines: '-DCMAKE_OSX_ARCHITECTURES=arm64' | ||||
| - build: 'x86_64' | |||||
| - build: 'x64' | |||||
| defines: '-DLLAMA_METAL=OFF -DCMAKE_OSX_ARCHITECTURES=x86_64' | defines: '-DLLAMA_METAL=OFF -DCMAKE_OSX_ARCHITECTURES=x86_64' | ||||
| runs-on: macos-latest | runs-on: macos-latest | ||||
| steps: | steps: | ||||
| @@ -169,7 +169,7 @@ jobs: | |||||
| uses: actions/upload-artifact@v3 | uses: actions/upload-artifact@v3 | ||||
| with: | with: | ||||
| path: ./build/libllama.dylib | path: ./build/libllama.dylib | ||||
| name: llama-bin-macos-${{ matrix.build }}.dylib | |||||
| name: llama-bin-osx-${{ matrix.build }}.dylib | |||||
| - name: Upload Metal | - name: Upload Metal | ||||
| uses: actions/upload-artifact@v3 | uses: actions/upload-artifact@v3 | ||||
| with: | with: | ||||
| @@ -212,12 +212,12 @@ jobs: | |||||
| - name: Rearrange MacOS files | - name: Rearrange MacOS files | ||||
| if: ${{ github.event.inputs.macos }} | if: ${{ github.event.inputs.macos }} | ||||
| run: | | run: | | ||||
| mkdir deps/macos-arm64 | |||||
| mkdir deps/macos-x86_64 | |||||
| mkdir deps/osx-arm64 | |||||
| mkdir deps/osx-x64 | |||||
| cp artifacts/llama-bin-macos-arm64.dylib/libllama.dylib deps/macos-arm64/libllama.dylib | |||||
| cp artifacts/ggml-metal.metal/ggml-metal.metal deps/macos-arm64/ggml-metal.metal | |||||
| cp artifacts/llama-bin-macos-x86_64.dylib/libllama.dylib deps/macos-x86_64/libllama.dylib | |||||
| cp artifacts/llama-bin-osx-arm64.dylib/libllama.dylib deps/osx-arm64/libllama.dylib | |||||
| cp artifacts/ggml-metal.metal/ggml-metal.metal deps/osx-arm64/ggml-metal.metal | |||||
| cp artifacts/llama-bin-osx-x64.dylib/libllama.dylib deps/osx-x64/libllama.dylib | |||||
| - name: Rearrange CUDA files | - name: Rearrange CUDA files | ||||
| @@ -12,13 +12,13 @@ jobs: | |||||
| strategy: | strategy: | ||||
| fail-fast: false | fail-fast: false | ||||
| matrix: | matrix: | ||||
| build: [linux-release, windows-release, macos-release] | |||||
| build: [linux-release, windows-release, osx-release] | |||||
| include: | include: | ||||
| - build: linux-release | - build: linux-release | ||||
| os: ubuntu-latest | os: ubuntu-latest | ||||
| config: release | config: release | ||||
| - build: macos-release | |||||
| os: macos-latest | |||||
| - build: osx-release | |||||
| os: osx-latest | |||||
| config: release | config: release | ||||
| - build: windows-release | - build: windows-release | ||||
| os: windows-2019 | os: windows-2019 | ||||
| @@ -27,17 +27,17 @@ | |||||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||||
| <Link>libllama-cuda12.so</Link> | <Link>libllama-cuda12.so</Link> | ||||
| </None> | </None> | ||||
| <None Include="$(MSBuildThisFileDirectory)runtimes/macos-arm64/libllama.dylib"> | |||||
| <None Include="$(MSBuildThisFileDirectory)runtimes/osx-arm64/libllama.dylib"> | |||||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||||
| <Link>runtimes/macos-arm64/libllama.dylib</Link> | |||||
| <Link>runtimes/osx-arm64/libllama.dylib</Link> | |||||
| </None> | </None> | ||||
| <None Include="$(MSBuildThisFileDirectory)runtimes/macos-arm64/ggml-metal.metal"> | |||||
| <None Include="$(MSBuildThisFileDirectory)runtimes/osx-arm64/ggml-metal.metal"> | |||||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||||
| <Link>runtimes/macos-arm64/ggml-metal.metal</Link> | |||||
| <Link>runtimes/osx-arm64/ggml-metal.metal</Link> | |||||
| </None> | </None> | ||||
| <None Include="$(MSBuildThisFileDirectory)runtimes/macos-x86_64/libllama.dylib"> | |||||
| <None Include="$(MSBuildThisFileDirectory)runtimes/osx-x64/libllama.dylib"> | |||||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||||
| <Link>runtimes/macos-x86_64/libllama.dylib</Link> | |||||
| <Link>runtimes/osx-x64/libllama.dylib</Link> | |||||
| </None> | </None> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| </Project> | </Project> | ||||
| @@ -79,8 +79,8 @@ namespace LLama.Native | |||||
| if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||||
| { | { | ||||
| return TryLoad("runtimes/macos-arm64/libllama.dylib", System.Runtime.Intrinsics.Arm.ArmBase.Arm64.IsSupported) | |||||
| ?? TryLoad("runtimes/macos-x86_64/libllama.dylib") | |||||
| return TryLoad("runtimes/osx-arm64/libllama.dylib", System.Runtime.Intrinsics.Arm.ArmBase.Arm64.IsSupported) | |||||
| ?? TryLoad("runtimes/osx-x64/libllama.dylib") | |||||
| ?? IntPtr.Zero; | ?? IntPtr.Zero; | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -19,9 +19,9 @@ | |||||
| <file src="LLamaSharpBackend.props" target="build/netstandard2.0/LLamaSharp.Backend.Cpu.props" /> | <file src="LLamaSharpBackend.props" target="build/netstandard2.0/LLamaSharp.Backend.Cpu.props" /> | ||||
| <file src="runtimes/libllama.dll" target="runtimes\win-x64\native\libllama.dll" /> | <file src="runtimes/libllama.dll" target="runtimes\win-x64\native\libllama.dll" /> | ||||
| <file src="runtimes/libllama.so" target="runtimes\linux-x64\native\libllama.so" /> | <file src="runtimes/libllama.so" target="runtimes\linux-x64\native\libllama.so" /> | ||||
| <file src="runtimes/macos-x86_64/libllama.dylib" target="runtimes\osx-x64\native\libllama.dylib" /> | |||||
| <file src="runtimes/macos-arm64/libllama.dylib" target="runtimes\osx-arm64\native\libllama.dylib" /> | |||||
| <file src="runtimes/macos-arm54/ggml-metal.metal" target="runtimes\osx-arm64\native\ggml-metal.metal" /> | |||||
| <file src="runtimes/osx-x64/libllama.dylib" target="runtimes\osx-x64\native\libllama.dylib" /> | |||||
| <file src="runtimes/osx-arm64/libllama.dylib" target="runtimes\osx-arm64\native\libllama.dylib" /> | |||||
| <file src="runtimes/osx-arm64/ggml-metal.metal" target="runtimes\osx-arm64\native\ggml-metal.metal" /> | |||||
| <file src="icon512.png" target="icon512.png" /> | <file src="icon512.png" target="icon512.png" /> | ||||
| </files> | </files> | ||||
| </package> | </package> | ||||