diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml new file mode 100644 index 0000000..dcedd83 --- /dev/null +++ b/.github/workflows/build-ci.yml @@ -0,0 +1,338 @@ +name: CI + +on: + # push: + # branches: + # - main + # tags: + # - "*" + # pull_request: + workflow_dispatch: + +permissions: + contents: write + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} + TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} + + ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }} + APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} + APPLE_PROVIDER_SHORT_NAME: ${{ secrets.APPLE_PROVIDER_SHORT_NAME }} + +jobs: + linux: + strategy: + fail-fast: false + matrix: + accelerator: ["cublas", "clblast"] + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: "./apps/desktop/src-tauri -> target" + + - name: Install Node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: "latest" + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Install CLBlast on linux + if: matrix.accelerator == 'clblast' + run: sudo apt install libclblast-dev + + - uses: Jimver/cuda-toolkit@v0.2.11 + name: Install CUDA toolkit on Linux + if: matrix.accelerator == 'cublas' + id: cuda-toolkit-linux + with: + cuda: "12.2.0" + method: "network" + #See e.g. https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ + non-cuda-sub-packages: '["libcublas","libcublas-dev"]' + sub-packages: '["nvcc","compiler","libraries","libraries-dev","cudart","cudart-dev"]' + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: run pnpm + run: | + pnpm i + pnpm build:sdk + + - name: Change directory to tauri path + run: | + cd apps + cd desktop + + - name: Build the app + id: tauri_action + uses: tauri-apps/tauri-action@dev + with: + args: "--features ${{ matrix.accelerator }}" + + - name: List Artifacts + shell: bash + run: | + echo ${{steps.tauri_action.outputs.artifactPaths}} + + - name: List files in deb directory + shell: bash + run: ls -l /home/runner/work/local.ai/local.ai/apps/desktop/src-tauri/target/release/bundle/deb + + - name: List files in appimage directory + run: ls -l /home/runner/work/local.ai/local.ai/apps/desktop/src-tauri/target/release/bundle/appimage + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: "linux-${{ matrix.accelerator }}" + if-no-files-found: error + path: | + /home/runner/work/local.ai/local.ai/apps/desktop/src-tauri/target/release/bundle/deb/*.deb + /home/runner/work/local.ai/local.ai/apps/desktop/src-tauri/target/release/bundle/appimage/*.AppImage* + + windows: + strategy: + fail-fast: false + matrix: + accelerator: ["cublas", "clblast"] + runs-on: windows-latest + steps: + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: "./apps/desktop/src-tauri -> target" + + - name: Install Node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: "latest" + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install vcpkg on windows + if: matrix.accelerator == 'clblast' + run: | + git clone https://github.com/microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh + ls -la + shell: bash + + - name: Install OpenCL on windows + if: matrix.accelerator == 'clblast' + run: | + ${{ github.workspace }}\vcpkg\vcpkg.exe install opencl:x64-windows + shell: pwsh + + - name: Install CLBlast on windows + if: matrix.accelerator == 'clblast' + run: | + ${{ github.workspace }}\vcpkg\vcpkg.exe install clblast:x64-windows + shell: pwsh + + - name: Set Windows OpenCL Environment Variables + if: matrix.accelerator == 'clblast' + run: | + echo "RUSTFLAGS=-Ctarget-feature=+crt-static" >> $GITHUB_ENV + echo "CLBLAST_PATH=${{ github.workspace }}\vcpkg\packages\clblast_x64-windows" >> $GITHUB_ENV + echo "OPENCL_PATH=${{ github.workspace }}\vcpkg\packages\opencl_x64-windows" >> $GITHUB_ENV + echo "${{ github.workspace }}\vcpkg\packages\clblast_x64-windows\bin" >> $GITHUB_PATH + echo "${{ github.workspace }}\vcpkg\packages\opencl_x64-windows\bin" >> $GITHUB_PATH + shell: bash + + - uses: Jimver/cuda-toolkit@v0.2.11 + name: Install CUDA toolkit on Windows + if: matrix.accelerator == 'cublas' + id: cuda-toolkit-windows + with: + cuda: "12.2.0" + #See https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#install-the-cuda-software + method: "local" + + - name: import windows certificate + env: + WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }} + WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} + run: | + New-Item -ItemType directory -Path certificate + Set-Content -Path certificate/tempCert.txt -Value $env:WINDOWS_CERTIFICATE + certutil -decode certificate/tempCert.txt certificate/certificate.pfx + Remove-Item -path certificate -include tempCert.txt + Import-PfxCertificate -FilePath certificate/certificate.pfx -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText) + + - name: run pnpm + run: | + pnpm i + pnpm build:sdk + + - name: Change directory to tauri path + run: | + cd apps + cd desktop + + - name: Build the app + id: tauri_action + uses: tauri-apps/tauri-action@dev + with: + args: "--features ${{ matrix.accelerator }}" + + - name: List Artifacts + shell: bash + run: | + echo ${{steps.tauri_action.outputs.artifactPaths}} + + - name: List files in msi directory + shell: bash + run: ls -l D:/a/local.ai/local.ai/apps/desktop/src-tauri/target/release/bundle/msi + + - name: List files in nsis directory + shell: bash + run: ls -l D:/a/local.ai/local.ai/apps/desktop/src-tauri/target/release/bundle/nsis + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: "windows-${{ matrix.accelerator }}" + if-no-files-found: error + path: | + D:\a\local.ai\local.ai\apps\desktop\src-tauri\target\release\bundle\msi\ + D:\a\local.ai\local.ai\apps\desktop\src-tauri\target\release\bundle\nsis\ + + macos: + strategy: + fail-fast: false + matrix: + platform: [macos-latest, self-hosted] + target: [x86_64, aarch64] + + runs-on: ${{ matrix.platform }} + steps: + - name: Rust setup + if: matrix.platform != 'self-hosted' + uses: dtolnay/rust-toolchain@stable + + - name: Rust cache + if: matrix.platform != 'self-hosted' + uses: swatinem/rust-cache@v2 + with: + workspaces: "./apps/desktop/src-tauri -> target" + + - name: Install Node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: "latest" + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: run pnpm + run: | + pnpm i + pnpm build:sdk + + - name: Change directory to tauri path + run: | + cd apps + cd desktop + + - name: Build the app + id: tauri_action + uses: tauri-apps/tauri-action@dev + + env: + # Needed to make the build run on Apple Silicon + CC: clang + CXX: clang++ + MACOSX_DEPLOYMENT_TARGET: 10.9 + + with: + args: "--target ${{matrix.target}}-apple-darwin" + + - name: List Artifacts + shell: bash + run: | + echo ${{steps.tauri_action.outputs.artifactPaths}} + + - name: List files in dmg directory + shell: bash + run: ls -l /Users/runner/work/local.ai/local.ai/apps/desktop/src-tauri/target/${{matrix.target}}-apple-darwin/release/bundle/dmg + + - name: List files in macos directory + shell: bash + run: ls -l /Users/runner/work/local.ai/local.ai/apps/desktop/src-tauri/target/${{matrix.target}}-apple-darwin/release/bundle/macos + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: "macos-${{ matrix.target }}" + if-no-files-found: error + path: | + /Users/runner/work/local.ai/local.ai/apps/desktop/src-tauri/target/${{matrix.target}}-apple-darwin/release/bundle/dmg/ + /Users/runner/work/local.ai/local.ai/apps/desktop/src-tauri/target/${{matrix.target}}-apple-darwin/release/bundle/macos/ diff --git a/.github/workflows/tauri.yml b/.github/workflows/tauri.yml index 8a3114f..de85914 100644 --- a/.github/workflows/tauri.yml +++ b/.github/workflows/tauri.yml @@ -13,6 +13,9 @@ jobs: fail-fast: false matrix: platform: [macos-latest, ubuntu-latest, windows-latest, self-hosted] + # include: + # - platform: windows-latest + # args: --config tauri.windows.conf.json runs-on: ${{ matrix.platform }} @@ -113,3 +116,4 @@ jobs: releaseBody: ${{ github.event.release.body }} releaseId: ${{ github.event.release.id }} tagName: ${{ github.event.release.tag_name }} + # args: "${{ matrix.args }}" diff --git a/apps/desktop/src-tauri/Cargo.lock b/apps/desktop/src-tauri/Cargo.lock index 8596106..768789e 100644 --- a/apps/desktop/src-tauri/Cargo.lock +++ b/apps/desktop/src-tauri/Cargo.lock @@ -58,7 +58,7 @@ dependencies = [ "http", "httparse", "httpdate", - "itoa 1.0.6", + "itoa 1.0.9", "language-tags", "local-channel", "mime", @@ -70,17 +70,17 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "zstd 0.12.3+zstd.1.5.2", + "zstd 0.12.4", ] [[package]] name = "actix-macros" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" +checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 1.0.109", + "syn 2.0.28", ] [[package]] @@ -170,7 +170,7 @@ dependencies = [ "futures-core", "futures-util", "http", - "itoa 1.0.6", + "itoa 1.0.9", "language-tags", "log", "mime", @@ -182,7 +182,7 @@ dependencies = [ "serde_urlencoded", "smallvec", "socket2", - "time 0.3.22", + "time 0.3.24", "url", ] @@ -282,9 +282,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56fc6cf8dc8c4158eed8649f9b8b0ea1518eb62b544fe9490d66fa0b349eafe9" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "android-tzdata" @@ -301,60 +301,11 @@ dependencies = [ "libc", ] -[[package]] -name = "anstream" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is-terminal", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" - -[[package]] -name = "anstyle-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "anstyle-wincon" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" -dependencies = [ - "anstyle", - "windows-sys 0.48.0", -] - [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "arrayref" @@ -460,15 +411,15 @@ checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" [[package]] name = "blake3" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" +checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if", - "constant_time_eq 0.2.6", + "constant_time_eq 0.3.0", "digest", ] @@ -510,9 +461,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", "serde", @@ -584,7 +535,7 @@ dependencies = [ "flate2", "fs2", "glob", - "indicatif 0.16.2", + "indicatif", "log", "rand 0.8.5", "reqwest", @@ -628,16 +579,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "599aa35200ffff8f04c1925aa1acc92fa2e08874379ef42e210a80e527e60838" dependencies = [ "serde", - "toml 0.7.5", + "toml 0.7.6", ] [[package]] name = "cc" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "51f1226cd9da55587234753d1245dd5b132343ea240f26b6a9003d68706141ba" dependencies = [ "jobserver", + "libc", ] [[package]] @@ -668,9 +620,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.15.3" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "215c0072ecc28f92eeb0eea38ba63ddfcb65c2828c46311d646f1a3ff5f9841c" +checksum = "b40ccee03b5175c18cde8f37e7d2a33bcef6f8ec8f7cc0d81090d1bb380949c9" dependencies = [ "smallvec", "target-lexicon", @@ -708,48 +660,6 @@ dependencies = [ "inout", ] -[[package]] -name = "clap" -version = "4.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bba77a07e4489fb41bd90e8d4201c3eb246b3c2c9ea2ba0bddd6c1d1df87db7d" -dependencies = [ - "clap_builder", - "clap_derive", - "once_cell", -] - -[[package]] -name = "clap_builder" -version = "4.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9b4a88bb4bc35d3d6f65a21b0f0bafe9c894fa00978de242c555ec28bea1c0" -dependencies = [ - "anstream", - "anstyle", - "bitflags 1.3.2", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "syn 2.0.22", -] - -[[package]] -name = "clap_lex" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" - [[package]] name = "cocoa" version = "0.24.1" @@ -787,12 +697,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - [[package]] name = "combine" version = "4.6.6" @@ -812,7 +716,6 @@ dependencies = [ "encode_unicode", "lazy_static", "libc", - "unicode-width", "windows-sys 0.45.0", ] @@ -830,9 +733,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "constant_time_eq" -version = "0.2.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" [[package]] name = "convert_case" @@ -856,7 +759,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", - "time 0.3.22", + "time 0.3.24", "version_check", ] @@ -902,9 +805,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -1001,7 +904,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -1026,12 +929,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0558d22a7b463ed0241e993f76f09f30b126687447751a8638587b864e4b3944" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" dependencies = [ - "darling_core 0.20.1", - "darling_macro 0.20.1", + "darling_core 0.20.3", + "darling_macro 0.20.3", ] [[package]] @@ -1050,16 +953,16 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8bfa2e259f8ee1ce5e97824a3c55ec4404a0d772ca7fa96bf19f0752a046eb" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -1075,13 +978,22 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ - "darling_core 0.20.1", + "darling_core 0.20.3", "quote", - "syn 2.0.22", + "syn 2.0.28", +] + +[[package]] +name = "deranged" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8810e7e2cf385b1e9b50d68264908ec367ba642c96d02edfe61c39e88e2a3c01" +dependencies = [ + "serde", ] [[package]] @@ -1136,7 +1048,7 @@ checksum = "f7a532c1f99a0f596f6960a60d1e119e91582b24b39e2d83a190e61262c3ef0c" dependencies = [ "diesel_derives", "libsqlite3-sys", - "time 0.3.22", + "time 0.3.24", ] [[package]] @@ -1148,7 +1060,7 @@ dependencies = [ "diesel_table_macro_syntax", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -1157,7 +1069,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" dependencies = [ - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -1226,9 +1138,9 @@ checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" [[package]] name = "dtoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65d09067bfacaa79114679b279d7f5885b53295b1e2cfb4e79c8e4bd3d633169" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "dtoa-short" @@ -1247,19 +1159,19 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "embed-resource" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80663502655af01a2902dff3f06869330782267924bf1788410b74edcd93770a" +checksum = "f7f1e82a60222fc67bfd50d752a9c89da5cce4c39ed39decc84a443b07bbd69a" dependencies = [ "cc", "rustc_version 0.4.0", - "toml 0.7.5", + "toml 0.7.6", "vswhom", "winreg 0.11.0", ] @@ -1287,15 +1199,15 @@ dependencies = [ [[package]] name = "equivalent" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" dependencies = [ "errno-dragonfly", "libc", @@ -1317,9 +1229,6 @@ name = "esaxx-rs" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f748b253ceca9fed5f42f8b5ceb3851e93102199bc25b64b65369f76e5c0a35" -dependencies = [ - "cc", -] [[package]] name = "fallible-iterator" @@ -1335,12 +1244,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "1.9.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "fdeflate" @@ -1502,7 +1408,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -1680,7 +1586,7 @@ dependencies = [ [[package]] name = "ggml" version = "0.2.0-dev" -source = "git+https://github.com/rustformers/llm?branch=main#9a222690cd0a9e3322bb6a926d54e90d08fb2c0f" +source = "git+https://github.com/rustformers/llm?branch=main#39eb341aeda6a3ff0240421e54df2707ae8743fc" dependencies = [ "ggml-sys", "memmap2", @@ -1690,7 +1596,7 @@ dependencies = [ [[package]] name = "ggml-sys" version = "0.2.0-dev" -source = "git+https://github.com/rustformers/llm?branch=main#9a222690cd0a9e3322bb6a926d54e90d08fb2c0f" +source = "git+https://github.com/rustformers/llm?branch=main#39eb341aeda6a3ff0240421e54df2707ae8743fc" dependencies = [ "cc", ] @@ -1784,11 +1690,11 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +checksum = "aca8bbd8e0707c1887a8bbb7e6b40e228f251ff5d62c8220a4a7a53c73aff006" dependencies = [ - "aho-corasick 0.7.20", + "aho-corasick 1.0.2", "bstr", "fnv", "log", @@ -1882,11 +1788,10 @@ dependencies = [ [[package]] name = "half" -version = "2.3.1" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" +checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0" dependencies = [ - "cfg-if", "crunchy", ] @@ -1932,9 +1837,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "hex" @@ -1973,7 +1878,7 @@ checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", - "itoa 1.0.6", + "itoa 1.0.9", ] [[package]] @@ -2020,7 +1925,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.6", + "itoa 1.0.9", "pin-project-lite", "socket2", "tokio", @@ -2142,18 +2047,6 @@ dependencies = [ "hashbrown 0.14.0", ] -[[package]] -name = "indicatif" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7baab56125e25686df467fe470785512329883aab42696d661247aca2a2896e4" -dependencies = [ - "console", - "lazy_static", - "number_prefix 0.3.0", - "regex", -] - [[package]] name = "indicatif" version = "0.16.2" @@ -2162,7 +2055,7 @@ checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" dependencies = [ "console", "lazy_static", - "number_prefix 0.4.0", + "number_prefix", "regex", ] @@ -2193,34 +2086,12 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ipnet" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" -[[package]] -name = "is-terminal" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" -dependencies = [ - "hermit-abi", - "rustix 0.38.1", - "windows-sys 0.48.0", -] - [[package]] name = "itertools" version = "0.8.2" @@ -2247,9 +2118,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "javascriptcore-rs" @@ -2390,20 +2261,14 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" [[package]] name = "llm" version = "0.2.0-dev" -source = "git+https://github.com/rustformers/llm?branch=main#9a222690cd0a9e3322bb6a926d54e90d08fb2c0f" +source = "git+https://github.com/rustformers/llm?branch=main#39eb341aeda6a3ff0240421e54df2707ae8743fc" dependencies = [ "llm-base", "llm-bloom", @@ -2413,12 +2278,13 @@ dependencies = [ "llm-llama", "llm-mpt", "serde", + "tracing", ] [[package]] name = "llm-base" version = "0.2.0-dev" -source = "git+https://github.com/rustformers/llm?branch=main#9a222690cd0a9e3322bb6a926d54e90d08fb2c0f" +source = "git+https://github.com/rustformers/llm?branch=main#39eb341aeda6a3ff0240421e54df2707ae8743fc" dependencies = [ "bytemuck", "ggml", @@ -2431,12 +2297,13 @@ dependencies = [ "serde_bytes", "thiserror", "tokenizers", + "tracing", ] [[package]] name = "llm-bloom" version = "0.2.0-dev" -source = "git+https://github.com/rustformers/llm?branch=main#9a222690cd0a9e3322bb6a926d54e90d08fb2c0f" +source = "git+https://github.com/rustformers/llm?branch=main#39eb341aeda6a3ff0240421e54df2707ae8743fc" dependencies = [ "llm-base", ] @@ -2444,7 +2311,7 @@ dependencies = [ [[package]] name = "llm-gpt2" version = "0.2.0-dev" -source = "git+https://github.com/rustformers/llm?branch=main#9a222690cd0a9e3322bb6a926d54e90d08fb2c0f" +source = "git+https://github.com/rustformers/llm?branch=main#39eb341aeda6a3ff0240421e54df2707ae8743fc" dependencies = [ "bytemuck", "llm-base", @@ -2453,7 +2320,7 @@ dependencies = [ [[package]] name = "llm-gptj" version = "0.2.0-dev" -source = "git+https://github.com/rustformers/llm?branch=main#9a222690cd0a9e3322bb6a926d54e90d08fb2c0f" +source = "git+https://github.com/rustformers/llm?branch=main#39eb341aeda6a3ff0240421e54df2707ae8743fc" dependencies = [ "llm-base", ] @@ -2461,7 +2328,7 @@ dependencies = [ [[package]] name = "llm-gptneox" version = "0.2.0-dev" -source = "git+https://github.com/rustformers/llm?branch=main#9a222690cd0a9e3322bb6a926d54e90d08fb2c0f" +source = "git+https://github.com/rustformers/llm?branch=main#39eb341aeda6a3ff0240421e54df2707ae8743fc" dependencies = [ "llm-base", ] @@ -2469,15 +2336,16 @@ dependencies = [ [[package]] name = "llm-llama" version = "0.2.0-dev" -source = "git+https://github.com/rustformers/llm?branch=main#9a222690cd0a9e3322bb6a926d54e90d08fb2c0f" +source = "git+https://github.com/rustformers/llm?branch=main#39eb341aeda6a3ff0240421e54df2707ae8743fc" dependencies = [ "llm-base", + "tracing", ] [[package]] name = "llm-mpt" version = "0.2.0-dev" -source = "git+https://github.com/rustformers/llm?branch=main#9a222690cd0a9e3322bb6a926d54e90d08fb2c0f" +source = "git+https://github.com/rustformers/llm?branch=main#39eb341aeda6a3ff0240421e54df2707ae8743fc" dependencies = [ "llm-base", ] @@ -2497,6 +2365,7 @@ dependencies = [ "digest", "flume", "futures", + "glob", "kv", "libsqlite3-sys", "llm", @@ -2631,7 +2500,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] @@ -2706,9 +2575,9 @@ dependencies = [ [[package]] name = "monostate" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0230b703f1ac35df1e24f6d0d2255472bcccaf657ecdfa4f1fcbcad1ad5bb98a" +checksum = "15f370ae88093ec6b11a710dec51321a61d420fafd1bad6e30d01bd9c920e8ee" dependencies = [ "monostate-impl", "serde", @@ -2716,13 +2585,13 @@ dependencies = [ [[package]] name = "monostate-impl" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8795add3e14028f11f8e848bd3294898a8294767b3776b6f733560d33bd2530b" +checksum = "371717c0a5543d6a800cac822eac735aa7d2d2fbb41002e9856a4089532dbdce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -2835,9 +2704,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", ] @@ -2873,12 +2742,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "number_prefix" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" - [[package]] name = "number_prefix" version = "0.4.0" @@ -2984,7 +2847,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -3114,9 +2977,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pbkdf2" @@ -3236,29 +3099,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e138fdd8263907a2b0e1b4e80b7e58c721126479b6e6eedfb1b402acea7b9bd" +checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1fef411b303e3e12d534fb6e7852de82da56edd937d895125821fb7c09436c7" +checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" [[package]] name = "pin-utils" @@ -3274,16 +3137,16 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "plist" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" +checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" dependencies = [ "base64 0.21.2", "indexmap 1.9.3", "line-wrap", "quick-xml", "serde", - "time 0.3.22", + "time 0.3.24", ] [[package]] @@ -3353,27 +3216,27 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] [[package]] name = "quick-xml" -version = "0.28.2" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.29" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] @@ -3529,13 +3392,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.4" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ "aho-corasick 1.0.2", "memchr", - "regex-syntax 0.7.2", + "regex-automata 0.3.4", + "regex-syntax 0.7.4", ] [[package]] @@ -3547,6 +3411,17 @@ dependencies = [ "regex-syntax 0.6.29", ] +[[package]] +name = "regex-automata" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7b6d6190b7594385f61bd3911cd1be99dfddcfc365a4160cc2ab5bff4aed294" +dependencies = [ + "aho-corasick 1.0.2", + "memchr", + "regex-syntax 0.7.4", +] + [[package]] name = "regex-syntax" version = "0.6.29" @@ -3555,9 +3430,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "reqwest" @@ -3657,47 +3532,33 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.17", + "semver 1.0.18", ] [[package]] name = "rustix" -version = "0.37.21" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25693a73057a1b4cb56179dd3c7ea21a7c6c5ee7d85781f5749b46f34b79c" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustix" -version = "0.38.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc6396159432b5c8490d4e301d8c705f61860b8b6c863bf79942ce5401968f3" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" dependencies = [ "bitflags 2.3.3", "errno", "libc", - "linux-raw-sys 0.4.3", + "linux-raw-sys", "windows-sys 0.48.0", ] [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "safemem" @@ -3716,11 +3577,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -3731,15 +3592,15 @@ checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -3750,9 +3611,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -3789,9 +3650,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" dependencies = [ "serde", ] @@ -3804,53 +3665,53 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.164" +version = "1.0.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "0ea67f183f058fe88a4e3ec6e2788e003840893b91bac4559cabedd00863b3ed" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.9" +version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416bda436f9aab92e02c8e10d49a15ddd339cea90b6e340fe51ed97abb548294" +checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "24e744d7782b686ab3b73267ef05697159cc0e5abbed3f47f9933165e5219036" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] name = "serde_json" -version = "1.0.99" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" +checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" dependencies = [ - "itoa 1.0.6", + "itoa 1.0.9", "ryu", "serde", ] [[package]] name = "serde_repr" -version = "0.1.12" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" +checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -3869,16 +3730,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.6", + "itoa 1.0.9", "ryu", "serde", ] [[package]] name = "serde_with" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02d8aa6e3c385bf084924f660ce2a3a6bd333ba55b35e8590b321f35d88513" +checksum = "21e47d95bc83ed33b2ecf84f4187ad1ab9685d18ff28db000c99deac8ce180e3" dependencies = [ "base64 0.21.2", "chrono", @@ -3887,19 +3748,19 @@ dependencies = [ "serde", "serde_json", "serde_with_macros", - "time 0.3.22", + "time 0.3.24", ] [[package]] name = "serde_with_macros" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc7d5d3932fb12ce722ee5e64dd38c504efba37567f0c402f6ca728c3b8b070" +checksum = "ea3cee93715c2e266b9338b7544da68a9f24e227722ba482bd1c024367c77c65" dependencies = [ - "darling 0.20.1", + "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -3991,9 +3852,9 @@ dependencies = [ [[package]] name = "simd-adler32" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238abfbb77c1915110ad968465608b68e869e0772622c9656714e73e5a1a522f" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "siphasher" @@ -4028,9 +3889,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "socket2" @@ -4215,7 +4076,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -4237,9 +4098,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.22" +version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ "proc-macro2", "quote", @@ -4288,10 +4149,10 @@ version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30c2de8a4d8f4b823d634affc9cd2a74ec98c53a756f317e529a48046cbf71f3" dependencies = [ - "cfg-expr 0.15.3", + "cfg-expr 0.15.4", "heck 0.4.1", "pkg-config", - "toml 0.7.5", + "toml 0.7.6", "version-compare 0.1.1", ] @@ -4355,9 +4216,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" +checksum = "ec96d2ffad078296368d46ff1cb309be1c23c513b4ab0e22a45de0185275ac96" dependencies = [ "filetime", "libc", @@ -4366,9 +4227,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.8" +version = "0.12.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac" +checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" [[package]] name = "tauri" @@ -4400,7 +4261,7 @@ dependencies = [ "raw-window-handle", "reqwest", "rfd", - "semver 1.0.17", + "semver 1.0.18", "serde", "serde_json", "serde_repr", @@ -4414,7 +4275,7 @@ dependencies = [ "tauri-utils", "tempfile", "thiserror", - "time 0.3.22", + "time 0.3.24", "tokio", "url", "uuid", @@ -4434,7 +4295,7 @@ dependencies = [ "cargo_toml", "heck 0.4.1", "json-patch", - "semver 1.0.17", + "semver 1.0.18", "serde", "serde_json", "tauri-utils", @@ -4455,13 +4316,13 @@ dependencies = [ "png", "proc-macro2", "quote", - "semver 1.0.17", + "semver 1.0.18", "serde", "serde_json", "sha2", "tauri-utils", "thiserror", - "time 0.3.22", + "time 0.3.24", "uuid", "walkdir", ] @@ -4482,9 +4343,9 @@ dependencies = [ [[package]] name = "tauri-plugin-persisted-scope" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d055034da82e3abd8d8727e71a4e5748a1d434d3f1d4fdbc517ab8dceb51d6f5" +checksum = "e667f1dd4e34e6e8a7ba12a4bacbe35ae9b688bb68445bd2a20749de8a703897" dependencies = [ "aho-corasick 1.0.2", "bincode", @@ -4555,7 +4416,7 @@ dependencies = [ "phf 0.10.1", "proc-macro2", "quote", - "semver 1.0.17", + "semver 1.0.18", "serde", "serde_json", "serde_with", @@ -4572,20 +4433,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5993dc129e544393574288923d1ec447c857f3f644187f4fbf7d9a875fbfc4fb" dependencies = [ "embed-resource", - "toml 0.7.5", + "toml 0.7.6", ] [[package]] name = "tempfile" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" dependencies = [ - "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.21", + "rustix", "windows-sys 0.48.0", ] @@ -4608,22 +4468,22 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -4664,14 +4524,15 @@ dependencies = [ [[package]] name = "time" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" +checksum = "b79eabcd964882a646b3584543ccabeae7869e9ac32a46f6f22b7a5bd405308b" dependencies = [ - "itoa 1.0.6", + "deranged", + "itoa 1.0.9", "serde", "time-core", - "time-macros 0.2.9", + "time-macros 0.2.11", ] [[package]] @@ -4692,9 +4553,9 @@ dependencies = [ [[package]] name = "time-macros" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" +checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" dependencies = [ "time-core", ] @@ -4735,12 +4596,10 @@ checksum = "5cf49017523bf0bc01c9966f172c5f120bbb7b96cccd1708772dd42e767fb9f5" dependencies = [ "aho-corasick 0.7.20", "cached-path", - "clap", "derive_builder", "dirs", "esaxx-rs", "getrandom 0.2.10", - "indicatif 0.15.0", "itertools 0.9.0", "lazy_static", "log", @@ -4791,7 +4650,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -4840,9 +4699,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebafdf5ad1220cb59e7d17cf4d2c72015297b75b19a10472f99b89225089240" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" dependencies = [ "serde", "serde_spanned", @@ -4861,9 +4720,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.11" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ "indexmap 2.0.0", "serde", @@ -4899,7 +4758,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", ] [[package]] @@ -4970,9 +4829,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -4998,12 +4857,6 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - [[package]] name = "unicode_categories" version = "0.1.1" @@ -5028,17 +4881,11 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - [[package]] name = "uuid" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ "getrandom 0.2.10", ] @@ -5151,7 +4998,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", "wasm-bindgen-shared", ] @@ -5185,7 +5032,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.22", + "syn 2.0.28", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5397,21 +5244,6 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278" -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -5612,9 +5444,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.7" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" +checksum = "f46aab759304e4d7b2075a9aecba26228bb073ee8c50db796b2c72c676b5d807" dependencies = [ "memchr", ] @@ -5722,7 +5554,7 @@ dependencies = [ "hmac", "pbkdf2", "sha1 0.10.5", - "time 0.3.22", + "time 0.3.24", "zstd 0.11.2+zstd.1.5.2", ] @@ -5737,11 +5569,11 @@ dependencies = [ [[package]] name = "zstd" -version = "0.12.3+zstd.1.5.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" dependencies = [ - "zstd-safe 6.0.5+zstd.1.5.4", + "zstd-safe 6.0.6", ] [[package]] @@ -5756,9 +5588,9 @@ dependencies = [ [[package]] name = "zstd-safe" -version = "6.0.5+zstd.1.5.4" +version = "6.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" dependencies = [ "libc", "zstd-sys", diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml index 0ac7a2b..88bea7f 100644 --- a/apps/desktop/src-tauri/Cargo.toml +++ b/apps/desktop/src-tauri/Cargo.toml @@ -11,15 +11,14 @@ edition = "2021" [build-dependencies] tauri-build = { version = "1.4.0", features = [] } +glob = "0.3" [dependencies] +# Peg the llm version here to prevent unwanted breaking changes llm = { git = "https://github.com/rustformers/llm", branch = "main", package = "llm", features = [ "default", - # "cublas", ] } -# llm = { git = "https://github.com/RedBoxing/llm.git", branch = "hf-tokenizer", package = "llm" } - tauri = { version = "1.4.0", features = [ "reqwest-client", "dialog-confirm", @@ -76,15 +75,10 @@ blake3 = "1.3.3" cocoa = "0.24.1" objc = "0.2.7" -[target.aarch64-apple-darwin.dependencies] -llm = { git = "https://github.com/rustformers/llm", branch = "main", package = "llm", features = [ - "default", - "metal", -] } - [target."cfg(target_os = \"linux\")".dependencies] webkit2gtk = "0.18.2" + [target."cfg(target_os = \"windows\")".dependencies] webview2-com = "0.19.1" windows = "0.39.0" @@ -102,6 +96,10 @@ default = ["custom-protocol"] # DO NOT remove this custom-protocol = ["tauri/custom-protocol"] +cublas = ["llm/cublas"] +clblast = ["llm/clblast"] +metal = ["llm/metal"] + [profile.dev.package."*"] opt-level = 3 diff --git a/apps/desktop/src-tauri/build.rs b/apps/desktop/src-tauri/build.rs index 2a3e93a..bc74c0d 100644 --- a/apps/desktop/src-tauri/build.rs +++ b/apps/desktop/src-tauri/build.rs @@ -1,25 +1,117 @@ -// #[cfg(any(target_os = "macos", target_os = "linux"))] +use std::{ + env, + path::{Path, PathBuf}, +}; + fn main() { - tauri_build::build() + #[cfg(feature = "cublas")] + copy_cuda_dlls(); + + #[cfg(feature = "clblast")] + copy_opencl_dlls(); + + tauri_build::build(); +} + +#[allow(dead_code)] +fn get_build_dir() -> PathBuf { + let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); + let mut build_dir = Path::new(&manifest_dir).join("target"); + build_dir.push(env::var("PROFILE").unwrap()); + build_dir +} + +#[cfg(feature = "cublas")] +fn copy_cuda_dlls() { + use glob::glob; + use std::fs; + + // Get the directory of the output executable. + let out_dir = get_build_dir(); + + // Get the CUDA path from the environment variable. + let cude_env = env::var("CUDA_PATH").expect("CUDA_PATH not found"); + let cuda_path = Path::new(&cude_env); + + // Patterns to search for the DLL files. + #[cfg(target_os = "windows")] + let patterns = ["cublas64_*.dll", "cublasLt64_*.dll", "cudart64_*.dll"]; + #[cfg(target_os = "windows")] + let binary_path = cuda_path.join("bin"); + + #[cfg(target_os = "linux")] + let patterns = ["libcudart.so", "libcublasLt.so", "libcublas.so"]; + #[cfg(target_os = "linux")] + let binary_path = cuda_path.join("lib64"); + + for pattern in &patterns { + // Construct the full glob pattern. + let full_pattern = format!("{}/{}", binary_path.to_str().unwrap(), pattern); + + // Use glob to find the DLL files. + for entry in glob(&full_pattern).expect("Failed to read glob pattern") { + match entry { + Ok(dll_path) => { + // Copy the DLL file to the output directory. + let dll_file_name = dll_path.file_name().unwrap(); + let destination = Path::new(&out_dir).join(dll_file_name); + if !destination.exists() { + fs::copy(&dll_path, &destination).expect("Failed to copy DLL"); + println!( + "Moved {} to {}", + dll_file_name.to_string_lossy(), + destination.to_string_lossy() + ); + } + } + Err(e) => panic!("{}", e), + } + } + } } -// #[cfg(target_os = "windows")] -// fn main() { -// let mut windows = tauri_build::WindowsAttributes::new(); -// windows = windows.app_manifest( -// r#" -// -// -// -// -// -// -// -// -// -// "#, -// ); - -// tauri_build::try_build(tauri_build::Attributes::new().windows_attributes(windows)) -// .expect("failed to run build script") -// } +#[cfg(feature = "clblast")] +fn copy_opencl_dlls() { + use std::fs; + + // Get the directory of the output executable. + let out_dir = get_build_dir(); + + let copy_dll = |source: PathBuf| { + let dll_file_name = source.file_name().unwrap(); + let destination = Path::new(&out_dir).join(dll_file_name); + if !destination.exists() { + fs::copy(&source, &destination).expect( + format!("Failed to copy DLL {}", dll_file_name.to_string_lossy()) + .as_str(), + ); + println!( + "Moved {} to {}", + dll_file_name.to_string_lossy(), + destination.to_string_lossy() + ); + } + }; + + let clblast_dll; + let opencl_dll; + #[cfg(target_os = "windows")] + { + let clblast_dir = + env::var("CLBLAST_PATH").expect("CLBLAST_PATH not found!"); + clblast_dll = Path::new(&clblast_dir).join("bin").join("clblast.dll"); + + let opencl_dir = env::var("OPENCL_PATH").expect("OPENCL_PATH not found!"); + opencl_dll = Path::new(&opencl_dir).join("bin").join("OpenCL.dll"); + } + + #[cfg(target_os = "linux")] + { + let lib_path = Path::new("/usr/lib/x86_64-linux-gnu"); + clblast_dll = lib_path.join("libclblast.so"); + opencl_dll = lib_path.join("libOpenCL.so"); + } + + copy_dll(clblast_dll); + copy_dll(opencl_dll); +} diff --git a/apps/desktop/src-tauri/src/inference/gpu.rs b/apps/desktop/src-tauri/src/inference/gpu.rs index be9046b..a2954f6 100644 --- a/apps/desktop/src-tauri/src/inference/gpu.rs +++ b/apps/desktop/src-tauri/src/inference/gpu.rs @@ -1,7 +1,6 @@ #[tauri::command] pub async fn check_gpu() -> Result { - // TODO: actually check if Metal is available in the future (?) - if cfg!(all(target_os = "macos", target_arch = "aarch64")) { + if llm::ggml_get_accelerator() != llm::GgmlAccelerator::None { Ok(true) } else { Ok(false) diff --git a/apps/desktop/src-tauri/src/inference/process.rs b/apps/desktop/src-tauri/src/inference/process.rs index 0450057..5dfd3fb 100644 --- a/apps/desktop/src-tauri/src/inference/process.rs +++ b/apps/desktop/src-tauri/src/inference/process.rs @@ -65,13 +65,7 @@ impl InferenceThreadRequest { fn get_inference_params( completion_request: &CompletionRequest, ) -> InferenceParameters { - let n_threads = model::pool::get_n_threads(); - - let n_batch = if get_use_gpu() { 240 } else { n_threads }; - InferenceParameters { - n_threads, - n_batch, sampler: Arc::new(completion_request.to_top_p_top_k()), } } @@ -95,7 +89,23 @@ pub fn start(req: InferenceThreadRequest) -> JoinHandle<()> { } }; - let mut session = model.start_session(Default::default()); + let n_threads = model::pool::get_n_threads(); + + // set the batch_size according to the accelerator + let backend = llm::ggml_get_accelerator(); + let n_batch = match backend{ + llm::GgmlAccelerator::Metal => if get_use_gpu() {1} else {n_threads}, // 1 is the only supported batch size for Metal + llm::GgmlAccelerator::None => n_threads, + _ => if get_use_gpu() {512} else {n_threads} + }; + + let session_config = llm::InferenceSessionConfig { + n_batch: n_batch, + n_threads: n_threads, + ..Default::default() + }; + + let mut session = model.start_session(session_config); let mut output_request = OutputRequest::default(); @@ -109,7 +119,6 @@ pub fn start(req: InferenceThreadRequest) -> JoinHandle<()> { match session.feed_prompt::( model.as_ref(), - &inference_params, req.completion_request.prompt.as_str().into(), &mut output_request, |t| { diff --git a/apps/desktop/src/providers/thread.ts b/apps/desktop/src/providers/thread.ts index 1fb257d..c690a07 100644 --- a/apps/desktop/src/providers/thread.ts +++ b/apps/desktop/src/providers/thread.ts @@ -158,7 +158,7 @@ const useThreadProvider = ({ thread }: { thread: FileInfo }) => { { async onComment(comment) { setStatusMessage(comment) - await wait(42) + await wait(serverConfig.data.useGpu ? 3 : 42) }, async onData(data) { const resp = JSON.parse(data) as StreamResponse