@fugood/llama.node 0.3.12 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/bin/darwin/arm64/llama-node.node +0 -0
  2. package/bin/darwin/x64/llama-node.node +0 -0
  3. package/bin/linux/arm64/llama-node.node +0 -0
  4. package/bin/linux/x64/llama-node.node +0 -0
  5. package/bin/linux-cuda/arm64/llama-node.node +0 -0
  6. package/bin/linux-cuda/x64/llama-node.node +0 -0
  7. package/bin/linux-vulkan/arm64/llama-node.node +0 -0
  8. package/bin/linux-vulkan/x64/llama-node.node +0 -0
  9. package/bin/win32/arm64/llama-node.node +0 -0
  10. package/bin/win32/arm64/node.lib +0 -0
  11. package/bin/win32/x64/llama-node.node +0 -0
  12. package/bin/win32/x64/node.lib +0 -0
  13. package/bin/win32-vulkan/arm64/llama-node.node +0 -0
  14. package/bin/win32-vulkan/arm64/node.lib +0 -0
  15. package/bin/win32-vulkan/x64/llama-node.node +0 -0
  16. package/bin/win32-vulkan/x64/node.lib +0 -0
  17. package/lib/binding.ts +2 -1
  18. package/package.json +1 -1
  19. package/src/LlamaCompletionWorker.cpp +14 -0
  20. package/src/LlamaContext.cpp +110 -79
  21. package/src/LlamaContext.h +1 -1
  22. package/src/common.hpp +1 -2
  23. package/src/llama.cpp/.github/workflows/build.yml +95 -13
  24. package/src/llama.cpp/.github/workflows/docker.yml +2 -0
  25. package/src/llama.cpp/.github/workflows/labeler.yml +1 -1
  26. package/src/llama.cpp/.github/workflows/server.yml +2 -0
  27. package/src/llama.cpp/common/CMakeLists.txt +23 -6
  28. package/src/llama.cpp/common/arg.cpp +292 -14
  29. package/src/llama.cpp/common/chat.cpp +1128 -315
  30. package/src/llama.cpp/common/chat.h +135 -0
  31. package/src/llama.cpp/common/common.cpp +27 -171
  32. package/src/llama.cpp/common/common.h +41 -73
  33. package/src/llama.cpp/common/json-schema-to-grammar.cpp +4 -5
  34. package/src/llama.cpp/common/json-schema-to-grammar.h +0 -1
  35. package/src/llama.cpp/common/llguidance.cpp +3 -3
  36. package/src/llama.cpp/common/log.cpp +1 -0
  37. package/src/llama.cpp/common/log.h +2 -1
  38. package/src/llama.cpp/common/{chat-template.hpp → minja/chat-template.hpp} +21 -7
  39. package/src/llama.cpp/common/{minja.hpp → minja/minja.hpp} +61 -14
  40. package/src/llama.cpp/common/ngram-cache.cpp +1 -0
  41. package/src/llama.cpp/common/sampling.cpp +93 -49
  42. package/src/llama.cpp/common/speculative.cpp +6 -5
  43. package/src/llama.cpp/common/speculative.h +1 -1
  44. package/src/llama.cpp/docs/build.md +47 -9
  45. package/src/llama.cpp/examples/cvector-generator/cvector-generator.cpp +3 -1
  46. package/src/llama.cpp/examples/embedding/embedding.cpp +1 -0
  47. package/src/llama.cpp/examples/export-lora/export-lora.cpp +4 -2
  48. package/src/llama.cpp/examples/imatrix/imatrix.cpp +4 -4
  49. package/src/llama.cpp/examples/llama-bench/llama-bench.cpp +6 -5
  50. package/src/llama.cpp/examples/llama.android/llama/src/main/cpp/CMakeLists.txt +1 -1
  51. package/src/llama.cpp/examples/llama.android/llama/src/main/cpp/llama-android.cpp +1 -1
  52. package/src/llama.cpp/examples/llava/CMakeLists.txt +7 -0
  53. package/src/llama.cpp/examples/llava/clip.cpp +373 -107
  54. package/src/llama.cpp/examples/llava/clip.h +19 -3
  55. package/src/llama.cpp/examples/llava/gemma3-cli.cpp +341 -0
  56. package/src/llama.cpp/examples/llava/llava.cpp +4 -2
  57. package/src/llama.cpp/examples/llava/minicpmv-cli.cpp +30 -11
  58. package/src/llama.cpp/examples/lookahead/lookahead.cpp +1 -0
  59. package/src/llama.cpp/examples/main/main.cpp +73 -28
  60. package/src/llama.cpp/examples/parallel/parallel.cpp +1 -0
  61. package/src/llama.cpp/examples/passkey/passkey.cpp +1 -0
  62. package/src/llama.cpp/examples/perplexity/perplexity.cpp +1 -0
  63. package/src/llama.cpp/examples/quantize/quantize.cpp +1 -0
  64. package/src/llama.cpp/examples/run/linenoise.cpp/linenoise.cpp +882 -237
  65. package/src/llama.cpp/examples/run/linenoise.cpp/linenoise.h +35 -26
  66. package/src/llama.cpp/examples/run/run.cpp +115 -79
  67. package/src/llama.cpp/examples/server/CMakeLists.txt +1 -1
  68. package/src/llama.cpp/examples/server/httplib.h +381 -292
  69. package/src/llama.cpp/examples/server/server.cpp +134 -128
  70. package/src/llama.cpp/examples/server/utils.hpp +95 -106
  71. package/src/llama.cpp/examples/sycl/run-llama2.sh +2 -2
  72. package/src/llama.cpp/examples/tts/tts.cpp +251 -142
  73. package/src/llama.cpp/ggml/CMakeLists.txt +13 -1
  74. package/src/llama.cpp/ggml/include/ggml-alloc.h +1 -1
  75. package/src/llama.cpp/ggml/include/ggml-backend.h +3 -3
  76. package/src/llama.cpp/ggml/include/ggml-cpu.h +4 -1
  77. package/src/llama.cpp/ggml/include/ggml-metal.h +1 -1
  78. package/src/llama.cpp/ggml/include/ggml-vulkan.h +0 -2
  79. package/src/llama.cpp/ggml/include/ggml.h +6 -2
  80. package/src/llama.cpp/ggml/src/CMakeLists.txt +10 -7
  81. package/src/llama.cpp/ggml/src/ggml-alloc.c +24 -15
  82. package/src/llama.cpp/ggml/src/ggml-backend-impl.h +1 -1
  83. package/src/llama.cpp/ggml/src/ggml-backend-reg.cpp +58 -54
  84. package/src/llama.cpp/ggml/src/ggml-backend.cpp +10 -8
  85. package/src/llama.cpp/ggml/src/ggml-cann/ggml-cann.cpp +3 -2
  86. package/src/llama.cpp/ggml/src/ggml-cann/kernels/dup.cpp +3 -5
  87. package/src/llama.cpp/ggml/src/ggml-common.h +0 -2
  88. package/src/llama.cpp/ggml/src/ggml-cpu/CMakeLists.txt +132 -17
  89. package/src/llama.cpp/ggml/src/ggml-cpu/amx/amx.cpp +2 -1
  90. package/src/llama.cpp/ggml/src/ggml-cpu/cpu-feats-x86.cpp +4 -0
  91. package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-aarch64.cpp +2 -1
  92. package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-impl.h +156 -11
  93. package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu-quants.c +2235 -641
  94. package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu.c +1572 -198
  95. package/src/llama.cpp/ggml/src/ggml-cpu/ggml-cpu.cpp +24 -5
  96. package/src/llama.cpp/ggml/src/ggml-cpu/kleidiai/kernels.cpp +259 -0
  97. package/src/llama.cpp/ggml/src/ggml-cpu/kleidiai/kernels.h +61 -0
  98. package/src/llama.cpp/ggml/src/ggml-cpu/kleidiai/kleidiai.cpp +288 -0
  99. package/src/llama.cpp/ggml/src/ggml-cpu/kleidiai/kleidiai.h +17 -0
  100. package/src/llama.cpp/ggml/src/ggml-cpu/llamafile/sgemm.cpp +9 -8
  101. package/src/llama.cpp/ggml/src/ggml-cuda/CMakeLists.txt +16 -3
  102. package/src/llama.cpp/ggml/src/ggml-hip/CMakeLists.txt +14 -0
  103. package/src/llama.cpp/ggml/src/ggml-impl.h +1 -1
  104. package/src/llama.cpp/ggml/src/ggml-metal/CMakeLists.txt +4 -5
  105. package/src/llama.cpp/ggml/src/ggml-metal/ggml-metal-impl.h +235 -0
  106. package/src/llama.cpp/ggml/src/ggml-musa/CMakeLists.txt +6 -2
  107. package/src/llama.cpp/ggml/src/ggml-opencl/CMakeLists.txt +1 -0
  108. package/src/llama.cpp/ggml/src/ggml-opencl/ggml-opencl.cpp +246 -120
  109. package/src/llama.cpp/ggml/src/ggml-quants.c +114 -114
  110. package/src/llama.cpp/ggml/src/ggml-rpc/ggml-rpc.cpp +2 -1
  111. package/src/llama.cpp/ggml/src/ggml-sycl/CMakeLists.txt +2 -0
  112. package/src/llama.cpp/ggml/src/ggml-sycl/backend.hpp +1 -0
  113. package/src/llama.cpp/ggml/src/ggml-sycl/common.cpp +17 -0
  114. package/src/llama.cpp/ggml/src/ggml-sycl/common.hpp +51 -10
  115. package/src/llama.cpp/ggml/src/ggml-sycl/convert.cpp +33 -4
  116. package/src/llama.cpp/ggml/src/ggml-sycl/convert.hpp +2 -2
  117. package/src/llama.cpp/ggml/src/ggml-sycl/cpy.cpp +701 -0
  118. package/src/llama.cpp/ggml/src/ggml-sycl/cpy.hpp +11 -0
  119. package/src/llama.cpp/ggml/src/ggml-sycl/dequantize.hpp +55 -0
  120. package/src/llama.cpp/ggml/src/ggml-sycl/dmmv.cpp +136 -4
  121. package/src/llama.cpp/ggml/src/ggml-sycl/getrows.cpp +308 -0
  122. package/src/llama.cpp/ggml/src/ggml-sycl/getrows.hpp +23 -0
  123. package/src/llama.cpp/ggml/src/ggml-sycl/ggml-sycl.cpp +174 -728
  124. package/src/llama.cpp/ggml/src/ggml-sycl/mmvq.cpp +75 -77
  125. package/src/llama.cpp/ggml/src/ggml-sycl/softmax.cpp +3 -0
  126. package/src/llama.cpp/ggml/src/ggml-sycl/sycl_hw.cpp +13 -0
  127. package/src/llama.cpp/ggml/src/ggml-sycl/sycl_hw.hpp +23 -0
  128. package/src/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan.cpp +949 -602
  129. package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +37 -3
  130. package/src/llama.cpp/ggml/src/ggml.c +9 -4
  131. package/src/llama.cpp/include/llama.h +32 -14
  132. package/src/llama.cpp/models/ggml-vocab-gpt-4o.gguf.inp +112 -0
  133. package/src/llama.cpp/models/ggml-vocab-gpt-4o.gguf.out +46 -0
  134. package/src/llama.cpp/requirements/requirements-all.txt +1 -0
  135. package/src/llama.cpp/requirements/requirements-tool_bench.txt +12 -0
  136. package/src/llama.cpp/requirements.txt +1 -0
  137. package/src/llama.cpp/src/llama-arch.cpp +21 -0
  138. package/src/llama.cpp/src/llama-arch.h +1 -0
  139. package/src/llama.cpp/src/llama-chat.cpp +1 -0
  140. package/src/llama.cpp/src/llama-grammar.cpp +183 -183
  141. package/src/llama.cpp/src/llama-grammar.h +13 -4
  142. package/src/llama.cpp/src/llama-impl.h +6 -6
  143. package/src/llama.cpp/src/llama-kv-cache.h +2 -1
  144. package/src/llama.cpp/src/llama-mmap.cpp +11 -1
  145. package/src/llama.cpp/src/llama-mmap.h +1 -0
  146. package/src/llama.cpp/src/llama-model.cpp +70 -6
  147. package/src/llama.cpp/src/llama-sampling.cpp +174 -67
  148. package/src/llama.cpp/src/llama-vocab.cpp +12 -0
  149. package/src/llama.cpp/src/llama.cpp +154 -5
  150. package/src/llama.cpp/src/unicode.cpp +9 -2
  151. package/src/llama.cpp/tests/test-backend-ops.cpp +171 -115
  152. package/src/llama.cpp/tests/test-chat-template.cpp +32 -22
  153. package/src/llama.cpp/tests/test-chat.cpp +691 -325
  154. package/src/llama.cpp/tests/test-gguf.cpp +4 -4
  155. package/src/llama.cpp/tests/test-json-schema-to-grammar.cpp +63 -63
  156. package/src/llama.cpp/tests/test-quantize-fns.cpp +1 -9
  157. package/src/llama.cpp/tests/test-sampling.cpp +15 -0
  158. package/src/llama.cpp/Sources/llama/llama.h +0 -4
  159. package/src/llama.cpp/common/chat.hpp +0 -52
@@ -129,7 +129,7 @@ jobs:
129
129
  run: |
130
130
  sysctl -a
131
131
  # Metal is disabled due to intermittent failures with Github runners not having a GPU:
132
- # https://github.com/ggerganov/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
132
+ # https://github.com/ggml-org/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
133
133
  cmake -B build \
134
134
  -DCMAKE_BUILD_RPATH="@loader_path" \
135
135
  -DLLAMA_FATAL_WARNINGS=ON \
@@ -173,7 +173,15 @@ jobs:
173
173
  name: llama-bin-macos-x64.zip
174
174
 
175
175
  ubuntu-cpu-cmake:
176
- runs-on: ubuntu-22.04
176
+ strategy:
177
+ matrix:
178
+ include:
179
+ - build: 'x64'
180
+ os: ubuntu-22.04
181
+ - build: 'arm64'
182
+ os: ubuntu-22.04-arm
183
+
184
+ runs-on: ${{ matrix.os }}
177
185
 
178
186
  steps:
179
187
  - name: Clone
@@ -239,14 +247,14 @@ jobs:
239
247
  run: |
240
248
  cp LICENSE ./build/bin/
241
249
  cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp
242
- zip -r llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip ./build/bin/*
250
+ zip -r llama-${{ steps.tag.outputs.name }}-bin-ubuntu-${{ matrix.build }}.zip ./build/bin/*
243
251
 
244
252
  - name: Upload artifacts
245
253
  if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
246
254
  uses: actions/upload-artifact@v4
247
255
  with:
248
- path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip
249
- name: llama-bin-ubuntu-x64.zip
256
+ path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-${{ matrix.build }}.zip
257
+ name: llama-bin-ubuntu-${{ matrix.build }}.zip
250
258
 
251
259
  ubuntu-latest-cmake-sanitizer:
252
260
  runs-on: ubuntu-latest
@@ -374,6 +382,8 @@ jobs:
374
382
  - name: Clone
375
383
  id: checkout
376
384
  uses: actions/checkout@v4
385
+ with:
386
+ fetch-depth: 0
377
387
 
378
388
  - name: ccache
379
389
  uses: hendrikmuhs/ccache-action@v1.2.16
@@ -401,7 +411,35 @@ jobs:
401
411
  run: |
402
412
  cd build
403
413
  # This is using llvmpipe and runs slower than other backends
404
- ctest -L main --verbose --timeout 1800
414
+ ctest -L main --verbose --timeout 2700
415
+
416
+ - name: Determine tag name
417
+ id: tag
418
+ shell: bash
419
+ run: |
420
+ BUILD_NUMBER="$(git rev-list --count HEAD)"
421
+ SHORT_HASH="$(git rev-parse --short=7 HEAD)"
422
+ if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
423
+ echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
424
+ else
425
+ SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
426
+ echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
427
+ fi
428
+
429
+ - name: Pack artifacts
430
+ id: pack_artifacts
431
+ if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
432
+ run: |
433
+ cp LICENSE ./build/bin/
434
+ cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp
435
+ zip -r llama-${{ steps.tag.outputs.name }}-bin-ubuntu-vulkan-x64.zip ./build/bin/*
436
+
437
+ - name: Upload artifacts
438
+ if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
439
+ uses: actions/upload-artifact@v4
440
+ with:
441
+ path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-vulkan-x64.zip
442
+ name: llama-bin-ubuntu-vulkan-x64.zip
405
443
 
406
444
  ubuntu-22-cmake-hip:
407
445
  runs-on: ubuntu-22.04
@@ -429,6 +467,7 @@ jobs:
429
467
  run: |
430
468
  cmake -B build -S . \
431
469
  -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
470
+ -DGGML_HIP_ROCWMMA_FATTN=ON \
432
471
  -DGGML_HIP=ON
433
472
  cmake --build build --config Release -j $(nproc)
434
473
 
@@ -438,12 +477,13 @@ jobs:
438
477
  cmake -B build2 -S . \
439
478
  -DCMAKE_C_COMPILER=hipcc \
440
479
  -DCMAKE_CXX_COMPILER=hipcc \
480
+ -DGGML_HIP_ROCWMMA_FATTN=ON \
441
481
  -DGGML_HIP=ON
442
482
  cmake --build build2 --config Release -j $(nproc)
443
483
 
444
484
  ubuntu-22-cmake-musa:
445
485
  runs-on: ubuntu-22.04
446
- container: mthreads/musa:rc3.1.0-devel-ubuntu22.04
486
+ container: mthreads/musa:rc3.1.1-devel-ubuntu22.04
447
487
 
448
488
  steps:
449
489
  - name: Clone
@@ -672,12 +712,11 @@ jobs:
672
712
  -DLLAMA_BUILD_SERVER=OFF \
673
713
  -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
674
714
  cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
675
- sudo cmake --install build --config Release
676
715
 
677
716
  - name: xcodebuild for swift package
678
717
  id: xcodebuild
679
718
  run: |
680
- xcodebuild -scheme llama-Package -destination "${{ matrix.destination }}"
719
+ ./build-xcframework.sh
681
720
 
682
721
  windows-msys2:
683
722
  runs-on: windows-latest
@@ -735,7 +774,7 @@ jobs:
735
774
  env:
736
775
  OPENBLAS_VERSION: 0.3.23
737
776
  SDE_VERSION: 9.33.0-2024-01-07
738
- VULKAN_VERSION: 1.3.261.1
777
+ VULKAN_VERSION: 1.4.304.1
739
778
 
740
779
  strategy:
741
780
  matrix:
@@ -1165,6 +1204,11 @@ jobs:
1165
1204
  id: checkout
1166
1205
  uses: actions/checkout@v4
1167
1206
 
1207
+ - name: Clone rocWMMA repository
1208
+ id: clone_rocwmma
1209
+ run: |
1210
+ git clone https://github.com/rocm/rocwmma --branch rocm-6.2.4 --depth 1
1211
+
1168
1212
  - name: Install
1169
1213
  id: depends
1170
1214
  run: |
@@ -1194,8 +1238,10 @@ jobs:
1194
1238
  cmake -G "Unix Makefiles" -B build -S . `
1195
1239
  -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
1196
1240
  -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
1241
+ -DCMAKE_CXX_FLAGS="-I$($PWD.Path.Replace('\', '/'))/rocwmma/library/include/" `
1197
1242
  -DCMAKE_BUILD_TYPE=Release `
1198
1243
  -DGGML_HIP=ON `
1244
+ -DGGML_HIP_ROCWMMA_FATTN=ON `
1199
1245
  -DGGML_RPC=ON
1200
1246
  cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
1201
1247
 
@@ -1214,6 +1260,11 @@ jobs:
1214
1260
  with:
1215
1261
  fetch-depth: 0
1216
1262
 
1263
+ - name: Clone rocWMMA repository
1264
+ id: clone_rocwmma
1265
+ run: |
1266
+ git clone https://github.com/rocm/rocwmma --branch rocm-6.2.4 --depth 1
1267
+
1217
1268
  - name: ccache
1218
1269
  uses: hendrikmuhs/ccache-action@v1.2.16
1219
1270
  with:
@@ -1243,8 +1294,10 @@ jobs:
1243
1294
  cmake -G "Unix Makefiles" -B build -S . `
1244
1295
  -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
1245
1296
  -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
1297
+ -DCMAKE_CXX_FLAGS="-I$($PWD.Path.Replace('\', '/'))/rocwmma/library/include/" `
1246
1298
  -DCMAKE_BUILD_TYPE=Release `
1247
1299
  -DAMDGPU_TARGETS=${{ matrix.gpu_target }} `
1300
+ -DGGML_HIP_ROCWMMA_FATTN=ON `
1248
1301
  -DGGML_HIP=ON `
1249
1302
  -DGGML_RPC=ON
1250
1303
  cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
@@ -1283,6 +1336,8 @@ jobs:
1283
1336
  steps:
1284
1337
  - name: Checkout code
1285
1338
  uses: actions/checkout@v4
1339
+ with:
1340
+ fetch-depth: 0
1286
1341
 
1287
1342
  - name: Build
1288
1343
  id: cmake_build
@@ -1298,15 +1353,40 @@ jobs:
1298
1353
  -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
1299
1354
  -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
1300
1355
  cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
1301
- sudo cmake --install build --config Release
1302
1356
 
1303
1357
  - name: xcodebuild for swift package
1304
1358
  id: xcodebuild
1305
1359
  run: |
1306
- xcodebuild -scheme llama-Package -destination 'generic/platform=iOS'
1360
+ ./build-xcframework.sh
1307
1361
 
1308
1362
  - name: Build Xcode project
1309
- run: xcodebuild -project examples/llama.swiftui/llama.swiftui.xcodeproj -scheme llama.swiftui -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' build
1363
+ run: xcodebuild -project examples/llama.swiftui/llama.swiftui.xcodeproj -scheme llama.swiftui -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' FRAMEWORK_FOLDER_PATH=./build-ios build
1364
+
1365
+ - name: Determine tag name
1366
+ id: tag
1367
+ shell: bash
1368
+ run: |
1369
+ BUILD_NUMBER="$(git rev-list --count HEAD)"
1370
+ SHORT_HASH="$(git rev-parse --short=7 HEAD)"
1371
+ if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
1372
+ echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
1373
+ else
1374
+ SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
1375
+ echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
1376
+ fi
1377
+
1378
+ - name: Pack artifacts
1379
+ id: pack_artifacts
1380
+ if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
1381
+ run: |
1382
+ zip -r llama-${{ steps.tag.outputs.name }}-xcframework.zip build-apple/llama.xcframework
1383
+
1384
+ - name: Upload artifacts
1385
+ if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
1386
+ uses: actions/upload-artifact@v4
1387
+ with:
1388
+ path: llama-${{ steps.tag.outputs.name }}-xcframework.zip
1389
+ name: llama-${{ steps.tag.outputs.name }}-xcframework
1310
1390
 
1311
1391
  android-build:
1312
1392
  runs-on: ubuntu-latest
@@ -1345,8 +1425,10 @@ jobs:
1345
1425
 
1346
1426
  needs:
1347
1427
  - ubuntu-cpu-cmake
1428
+ - ubuntu-22-cmake-vulkan
1348
1429
  - windows-latest-cmake
1349
1430
  - windows-2019-cmake-cuda
1431
+ - windows-latest-cmake-sycl
1350
1432
  - windows-latest-cmake-hip-release
1351
1433
  - macOS-latest-cmake-arm64
1352
1434
  - macOS-latest-cmake-x64
@@ -51,6 +51,8 @@ jobs:
51
51
 
52
52
  - name: Set up QEMU
53
53
  uses: docker/setup-qemu-action@v3
54
+ with:
55
+ image: tonistiigi/binfmt:qemu-v7.0.0-28
54
56
 
55
57
  - name: Set up Docker Buildx
56
58
  uses: docker/setup-buildx-action@v3
@@ -11,7 +11,7 @@ jobs:
11
11
  steps:
12
12
  - uses: actions/checkout@v4
13
13
  with:
14
- repository: "ggerganov/llama.cpp"
14
+ repository: "ggml-org/llama.cpp"
15
15
  - uses: actions/labeler@v5
16
16
  with:
17
17
  configuration-path: '.github/labeler.yml'
@@ -161,6 +161,8 @@ jobs:
161
161
  - name: Tests
162
162
  id: server_integration_tests
163
163
  if: ${{ matrix.sanitizer == '' }}
164
+ env:
165
+ GITHUB_ACTIONS: "true"
164
166
  run: |
165
167
  cd examples/server/tests
166
168
  ./tests.sh
@@ -57,8 +57,7 @@ add_library(${TARGET} STATIC
57
57
  arg.h
58
58
  base64.hpp
59
59
  chat.cpp
60
- chat.hpp
61
- chat-template.hpp
60
+ chat.h
62
61
  common.cpp
63
62
  common.h
64
63
  console.cpp
@@ -68,7 +67,8 @@ add_library(${TARGET} STATIC
68
67
  llguidance.cpp
69
68
  log.cpp
70
69
  log.h
71
- minja.hpp
70
+ minja/chat-template.hpp
71
+ minja/minja.hpp
72
72
  ngram-cache.cpp
73
73
  ngram-cache.h
74
74
  sampling.cpp
@@ -96,6 +96,22 @@ if (LLAMA_LLGUIDANCE)
96
96
  include(ExternalProject)
97
97
  set(LLGUIDANCE_SRC ${CMAKE_BINARY_DIR}/llguidance/source)
98
98
  set(LLGUIDANCE_PATH ${LLGUIDANCE_SRC}/target/release)
99
+
100
+ # Set the correct library file extension based on platform
101
+ if (WIN32)
102
+ set(LLGUIDANCE_LIB_NAME "llguidance.lib")
103
+ # Add Windows-specific libraries
104
+ set(LLGUIDANCE_PLATFORM_LIBS
105
+ ws2_32 # Windows Sockets API
106
+ userenv # For GetUserProfileDirectoryW
107
+ ntdll # For NT functions
108
+ bcrypt # For BCryptGenRandom
109
+ )
110
+ else()
111
+ set(LLGUIDANCE_LIB_NAME "libllguidance.a")
112
+ set(LLGUIDANCE_PLATFORM_LIBS "")
113
+ endif()
114
+
99
115
  ExternalProject_Add(llguidance_ext
100
116
  GIT_REPOSITORY https://github.com/guidance-ai/llguidance
101
117
  # v0.6.12:
@@ -106,17 +122,18 @@ if (LLAMA_LLGUIDANCE)
106
122
  CONFIGURE_COMMAND ""
107
123
  BUILD_COMMAND cargo build --release
108
124
  INSTALL_COMMAND ""
109
- BUILD_BYPRODUCTS ${LLGUIDANCE_PATH}/libllguidance.a ${LLGUIDANCE_PATH}/llguidance.h
125
+ BUILD_BYPRODUCTS ${LLGUIDANCE_PATH}/${LLGUIDANCE_LIB_NAME} ${LLGUIDANCE_PATH}/llguidance.h
110
126
  UPDATE_COMMAND ""
111
127
  )
112
128
  target_compile_definitions(${TARGET} PUBLIC LLAMA_USE_LLGUIDANCE)
113
129
 
114
130
  add_library(llguidance STATIC IMPORTED)
115
- set_target_properties(llguidance PROPERTIES IMPORTED_LOCATION ${LLGUIDANCE_PATH}/libllguidance.a)
131
+ set_target_properties(llguidance PROPERTIES IMPORTED_LOCATION ${LLGUIDANCE_PATH}/${LLGUIDANCE_LIB_NAME})
116
132
  add_dependencies(llguidance llguidance_ext)
117
133
 
118
134
  target_include_directories(${TARGET} PRIVATE ${LLGUIDANCE_PATH})
119
- set(LLAMA_COMMON_EXTRA_LIBS ${LLAMA_COMMON_EXTRA_LIBS} llguidance)
135
+ # Add platform libraries to the main target
136
+ set(LLAMA_COMMON_EXTRA_LIBS ${LLAMA_COMMON_EXTRA_LIBS} llguidance ${LLGUIDANCE_PLATFORM_LIBS})
120
137
  endif ()
121
138
 
122
139
  target_include_directories(${TARGET} PUBLIC .)