@fugood/llama.node 0.6.3 → 1.0.0-beta.2
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.
- package/CMakeLists.txt +40 -30
- package/README.md +4 -1
- package/lib/binding.js +41 -29
- package/lib/binding.ts +26 -25
- package/package.json +40 -7
- package/scripts/build.js +47 -0
- package/scripts/llama.cpp.patch +109 -0
- package/src/anyascii.c +22223 -0
- package/src/anyascii.h +42 -0
- package/src/tts_utils.cpp +20 -7
- package/src/tts_utils.h +2 -0
- package/bin/darwin/arm64/llama-node.node +0 -0
- package/bin/darwin/x64/llama-node.node +0 -0
- package/bin/linux/arm64/llama-node.node +0 -0
- package/bin/linux/x64/llama-node.node +0 -0
- package/bin/linux-cuda/arm64/llama-node.node +0 -0
- package/bin/linux-cuda/x64/llama-node.node +0 -0
- package/bin/linux-vulkan/arm64/llama-node.node +0 -0
- package/bin/linux-vulkan/x64/llama-node.node +0 -0
- package/bin/win32/x64/llama-node.node +0 -0
- package/bin/win32/x64/node.lib +0 -0
- package/bin/win32-vulkan/arm64/llama-node.node +0 -0
- package/bin/win32-vulkan/arm64/node.lib +0 -0
- package/bin/win32-vulkan/x64/llama-node.node +0 -0
- package/bin/win32-vulkan/x64/node.lib +0 -0
- package/src/llama.cpp/.github/workflows/build-linux-cross.yml +0 -233
- package/src/llama.cpp/.github/workflows/build.yml +0 -1078
- package/src/llama.cpp/.github/workflows/close-issue.yml +0 -28
- package/src/llama.cpp/.github/workflows/docker.yml +0 -178
- package/src/llama.cpp/.github/workflows/editorconfig.yml +0 -29
- package/src/llama.cpp/.github/workflows/gguf-publish.yml +0 -44
- package/src/llama.cpp/.github/workflows/labeler.yml +0 -17
- package/src/llama.cpp/.github/workflows/python-check-requirements.yml +0 -33
- package/src/llama.cpp/.github/workflows/python-lint.yml +0 -30
- package/src/llama.cpp/.github/workflows/python-type-check.yml +0 -40
- package/src/llama.cpp/.github/workflows/release.yml +0 -739
- package/src/llama.cpp/.github/workflows/server.yml +0 -237
- package/src/llama.cpp/.github/workflows/winget.yml +0 -42
- package/src/llama.cpp/cmake/arm64-apple-clang.cmake +0 -16
- package/src/llama.cpp/cmake/arm64-windows-llvm.cmake +0 -16
- package/src/llama.cpp/cmake/build-info.cmake +0 -64
- package/src/llama.cpp/cmake/common.cmake +0 -35
- package/src/llama.cpp/cmake/git-vars.cmake +0 -22
- package/src/llama.cpp/cmake/x64-windows-llvm.cmake +0 -5
- package/src/llama.cpp/common/build-info.cpp.in +0 -4
- package/src/llama.cpp/docs/build.md +0 -561
- package/src/llama.cpp/examples/CMakeLists.txt +0 -43
- package/src/llama.cpp/examples/batched/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/batched/batched.cpp +0 -246
- package/src/llama.cpp/examples/chat-13B.bat +0 -57
- package/src/llama.cpp/examples/convert-llama2c-to-ggml/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp +0 -941
- package/src/llama.cpp/examples/deprecation-warning/deprecation-warning.cpp +0 -35
- package/src/llama.cpp/examples/embedding/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/embedding/embedding.cpp +0 -323
- package/src/llama.cpp/examples/eval-callback/CMakeLists.txt +0 -10
- package/src/llama.cpp/examples/eval-callback/eval-callback.cpp +0 -194
- package/src/llama.cpp/examples/gen-docs/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/gen-docs/gen-docs.cpp +0 -83
- package/src/llama.cpp/examples/gguf/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/gguf/gguf.cpp +0 -265
- package/src/llama.cpp/examples/gguf-hash/CMakeLists.txt +0 -22
- package/src/llama.cpp/examples/gguf-hash/deps/rotate-bits/rotate-bits.h +0 -46
- package/src/llama.cpp/examples/gguf-hash/deps/sha1/sha1.c +0 -295
- package/src/llama.cpp/examples/gguf-hash/deps/sha1/sha1.h +0 -52
- package/src/llama.cpp/examples/gguf-hash/deps/sha256/sha256.c +0 -221
- package/src/llama.cpp/examples/gguf-hash/deps/sha256/sha256.h +0 -24
- package/src/llama.cpp/examples/gguf-hash/deps/xxhash/xxhash.c +0 -42
- package/src/llama.cpp/examples/gguf-hash/deps/xxhash/xxhash.h +0 -7093
- package/src/llama.cpp/examples/gguf-hash/gguf-hash.cpp +0 -694
- package/src/llama.cpp/examples/gritlm/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/gritlm/gritlm.cpp +0 -229
- package/src/llama.cpp/examples/jeopardy/questions.txt +0 -100
- package/src/llama.cpp/examples/llama.android/app/build.gradle.kts +0 -65
- package/src/llama.cpp/examples/llama.android/build.gradle.kts +0 -6
- package/src/llama.cpp/examples/llama.android/llama/build.gradle.kts +0 -71
- package/src/llama.cpp/examples/llama.android/llama/src/main/cpp/CMakeLists.txt +0 -53
- package/src/llama.cpp/examples/llama.android/llama/src/main/cpp/llama-android.cpp +0 -452
- package/src/llama.cpp/examples/llama.android/settings.gradle.kts +0 -18
- package/src/llama.cpp/examples/lookahead/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/lookahead/lookahead.cpp +0 -472
- package/src/llama.cpp/examples/lookup/CMakeLists.txt +0 -23
- package/src/llama.cpp/examples/lookup/lookup-create.cpp +0 -40
- package/src/llama.cpp/examples/lookup/lookup-merge.cpp +0 -47
- package/src/llama.cpp/examples/lookup/lookup-stats.cpp +0 -157
- package/src/llama.cpp/examples/lookup/lookup.cpp +0 -242
- package/src/llama.cpp/examples/parallel/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/parallel/parallel.cpp +0 -492
- package/src/llama.cpp/examples/passkey/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/passkey/passkey.cpp +0 -277
- package/src/llama.cpp/examples/retrieval/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/retrieval/retrieval.cpp +0 -304
- package/src/llama.cpp/examples/save-load-state/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/save-load-state/save-load-state.cpp +0 -246
- package/src/llama.cpp/examples/simple/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/simple/simple.cpp +0 -206
- package/src/llama.cpp/examples/simple-chat/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/simple-chat/simple-chat.cpp +0 -206
- package/src/llama.cpp/examples/simple-cmake-pkg/CMakeLists.txt +0 -11
- package/src/llama.cpp/examples/speculative/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/speculative/speculative.cpp +0 -644
- package/src/llama.cpp/examples/speculative-simple/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/speculative-simple/speculative-simple.cpp +0 -261
- package/src/llama.cpp/examples/sycl/CMakeLists.txt +0 -9
- package/src/llama.cpp/examples/sycl/build.sh +0 -23
- package/src/llama.cpp/examples/sycl/ls-sycl-device.cpp +0 -13
- package/src/llama.cpp/examples/sycl/run-llama2.sh +0 -27
- package/src/llama.cpp/examples/sycl/run-llama3.sh +0 -28
- package/src/llama.cpp/examples/sycl/win-build-sycl.bat +0 -33
- package/src/llama.cpp/examples/sycl/win-run-llama2.bat +0 -9
- package/src/llama.cpp/examples/sycl/win-run-llama3.bat +0 -9
- package/src/llama.cpp/examples/training/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/training/finetune.cpp +0 -96
- package/src/llama.cpp/ggml/cmake/GitVars.cmake +0 -22
- package/src/llama.cpp/ggml/cmake/common.cmake +0 -26
- package/src/llama.cpp/ggml/src/ggml-alloc.c +0 -1042
- package/src/llama.cpp/ggml/src/ggml-backend-impl.h +0 -255
- package/src/llama.cpp/ggml/src/ggml-backend-reg.cpp +0 -586
- package/src/llama.cpp/ggml/src/ggml-backend.cpp +0 -2008
- package/src/llama.cpp/ggml/src/ggml-blas/CMakeLists.txt +0 -87
- package/src/llama.cpp/ggml/src/ggml-blas/ggml-blas.cpp +0 -517
- package/src/llama.cpp/ggml/src/ggml-cann/CMakeLists.txt +0 -74
- package/src/llama.cpp/ggml/src/ggml-cann/acl_tensor.cpp +0 -179
- package/src/llama.cpp/ggml/src/ggml-cann/acl_tensor.h +0 -258
- package/src/llama.cpp/ggml/src/ggml-cann/aclnn_ops.cpp +0 -2863
- package/src/llama.cpp/ggml/src/ggml-cann/aclnn_ops.h +0 -1110
- package/src/llama.cpp/ggml/src/ggml-cann/common.h +0 -420
- package/src/llama.cpp/ggml/src/ggml-cann/ggml-cann.cpp +0 -2570
- package/src/llama.cpp/ggml/src/ggml-common.h +0 -1857
- package/src/llama.cpp/ggml/src/ggml-cpu/cmake/FindSIMD.cmake +0 -100
- package/src/llama.cpp/ggml/src/ggml-cuda/CMakeLists.txt +0 -184
- package/src/llama.cpp/ggml/src/ggml-cuda/vendors/cuda.h +0 -15
- package/src/llama.cpp/ggml/src/ggml-cuda/vendors/hip.h +0 -243
- package/src/llama.cpp/ggml/src/ggml-cuda/vendors/musa.h +0 -140
- package/src/llama.cpp/ggml/src/ggml-hip/CMakeLists.txt +0 -131
- package/src/llama.cpp/ggml/src/ggml-impl.h +0 -601
- package/src/llama.cpp/ggml/src/ggml-kompute/CMakeLists.txt +0 -166
- package/src/llama.cpp/ggml/src/ggml-kompute/ggml-kompute.cpp +0 -2251
- package/src/llama.cpp/ggml/src/ggml-metal/CMakeLists.txt +0 -120
- package/src/llama.cpp/ggml/src/ggml-metal/ggml-metal-impl.h +0 -622
- package/src/llama.cpp/ggml/src/ggml-musa/CMakeLists.txt +0 -113
- package/src/llama.cpp/ggml/src/ggml-opencl/CMakeLists.txt +0 -96
- package/src/llama.cpp/ggml/src/ggml-opencl/ggml-opencl.cpp +0 -5124
- package/src/llama.cpp/ggml/src/ggml-opt.cpp +0 -1037
- package/src/llama.cpp/ggml/src/ggml-quants.c +0 -5232
- package/src/llama.cpp/ggml/src/ggml-quants.h +0 -100
- package/src/llama.cpp/ggml/src/ggml-rpc/CMakeLists.txt +0 -9
- package/src/llama.cpp/ggml/src/ggml-rpc/ggml-rpc.cpp +0 -1813
- package/src/llama.cpp/ggml/src/ggml-sycl/CMakeLists.txt +0 -189
- package/src/llama.cpp/ggml/src/ggml-sycl/backend.hpp +0 -37
- package/src/llama.cpp/ggml/src/ggml-sycl/binbcast.cpp +0 -239
- package/src/llama.cpp/ggml/src/ggml-sycl/binbcast.hpp +0 -39
- package/src/llama.cpp/ggml/src/ggml-sycl/common.cpp +0 -83
- package/src/llama.cpp/ggml/src/ggml-sycl/common.hpp +0 -493
- package/src/llama.cpp/ggml/src/ggml-sycl/concat.cpp +0 -197
- package/src/llama.cpp/ggml/src/ggml-sycl/concat.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/conv.cpp +0 -100
- package/src/llama.cpp/ggml/src/ggml-sycl/conv.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/convert.cpp +0 -623
- package/src/llama.cpp/ggml/src/ggml-sycl/convert.hpp +0 -34
- package/src/llama.cpp/ggml/src/ggml-sycl/cpy.cpp +0 -701
- package/src/llama.cpp/ggml/src/ggml-sycl/cpy.hpp +0 -11
- package/src/llama.cpp/ggml/src/ggml-sycl/dequantize.hpp +0 -791
- package/src/llama.cpp/ggml/src/ggml-sycl/dmmv.cpp +0 -1160
- package/src/llama.cpp/ggml/src/ggml-sycl/dmmv.hpp +0 -27
- package/src/llama.cpp/ggml/src/ggml-sycl/dpct/helper.hpp +0 -2957
- package/src/llama.cpp/ggml/src/ggml-sycl/element_wise.cpp +0 -1536
- package/src/llama.cpp/ggml/src/ggml-sycl/element_wise.hpp +0 -75
- package/src/llama.cpp/ggml/src/ggml-sycl/gemm.hpp +0 -99
- package/src/llama.cpp/ggml/src/ggml-sycl/getrows.cpp +0 -311
- package/src/llama.cpp/ggml/src/ggml-sycl/getrows.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/ggml-sycl.cpp +0 -4443
- package/src/llama.cpp/ggml/src/ggml-sycl/gla.cpp +0 -105
- package/src/llama.cpp/ggml/src/ggml-sycl/gla.hpp +0 -8
- package/src/llama.cpp/ggml/src/ggml-sycl/im2col.cpp +0 -136
- package/src/llama.cpp/ggml/src/ggml-sycl/im2col.hpp +0 -21
- package/src/llama.cpp/ggml/src/ggml-sycl/mmq.cpp +0 -3030
- package/src/llama.cpp/ggml/src/ggml-sycl/mmq.hpp +0 -33
- package/src/llama.cpp/ggml/src/ggml-sycl/mmvq.cpp +0 -1108
- package/src/llama.cpp/ggml/src/ggml-sycl/mmvq.hpp +0 -27
- package/src/llama.cpp/ggml/src/ggml-sycl/norm.cpp +0 -474
- package/src/llama.cpp/ggml/src/ggml-sycl/norm.hpp +0 -26
- package/src/llama.cpp/ggml/src/ggml-sycl/outprod.cpp +0 -46
- package/src/llama.cpp/ggml/src/ggml-sycl/outprod.hpp +0 -10
- package/src/llama.cpp/ggml/src/ggml-sycl/presets.hpp +0 -74
- package/src/llama.cpp/ggml/src/ggml-sycl/quants.hpp +0 -83
- package/src/llama.cpp/ggml/src/ggml-sycl/rope.cpp +0 -362
- package/src/llama.cpp/ggml/src/ggml-sycl/rope.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/softmax.cpp +0 -264
- package/src/llama.cpp/ggml/src/ggml-sycl/softmax.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/sycl_hw.cpp +0 -13
- package/src/llama.cpp/ggml/src/ggml-sycl/sycl_hw.hpp +0 -23
- package/src/llama.cpp/ggml/src/ggml-sycl/tsembd.cpp +0 -73
- package/src/llama.cpp/ggml/src/ggml-sycl/tsembd.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/vecdotq.hpp +0 -1215
- package/src/llama.cpp/ggml/src/ggml-sycl/wkv.cpp +0 -305
- package/src/llama.cpp/ggml/src/ggml-sycl/wkv.hpp +0 -10
- package/src/llama.cpp/ggml/src/ggml-threading.cpp +0 -12
- package/src/llama.cpp/ggml/src/ggml-threading.h +0 -14
- package/src/llama.cpp/ggml/src/ggml-vulkan/CMakeLists.txt +0 -196
- package/src/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan.cpp +0 -10699
- package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/CMakeLists.txt +0 -39
- package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +0 -751
- package/src/llama.cpp/ggml/src/ggml.c +0 -6550
- package/src/llama.cpp/ggml/src/gguf.cpp +0 -1330
- package/src/llama.cpp/models/.editorconfig +0 -1
- package/src/llama.cpp/models/ggml-vocab-aquila.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-baichuan.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-chameleon.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-chameleon.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-command-r.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-command-r.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-command-r.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-deepseek-r1-qwen.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-deepseek-r1-qwen.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-falcon.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-falcon.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-falcon.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-gpt-4o.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-gpt-4o.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-gpt-neox.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-llama4.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-llama4.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-mpt.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-mpt.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-mpt.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-phi-3.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-phi-3.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-phi-3.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-pixtral.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-pixtral.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-qwen2.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-qwen2.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-qwen2.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-refact.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-refact.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-refact.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-roberta-bpe.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-roberta-bpe.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-starcoder.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-starcoder.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-starcoder.gguf.out +0 -46
- package/src/llama.cpp/pocs/CMakeLists.txt +0 -14
- package/src/llama.cpp/pocs/vdot/CMakeLists.txt +0 -9
- package/src/llama.cpp/pocs/vdot/q8dot.cpp +0 -173
- package/src/llama.cpp/pocs/vdot/vdot.cpp +0 -311
- package/src/llama.cpp/prompts/LLM-questions.txt +0 -49
- package/src/llama.cpp/prompts/alpaca.txt +0 -1
- package/src/llama.cpp/prompts/assistant.txt +0 -31
- package/src/llama.cpp/prompts/chat-with-baichuan.txt +0 -4
- package/src/llama.cpp/prompts/chat-with-bob.txt +0 -7
- package/src/llama.cpp/prompts/chat-with-qwen.txt +0 -1
- package/src/llama.cpp/prompts/chat-with-vicuna-v0.txt +0 -7
- package/src/llama.cpp/prompts/chat-with-vicuna-v1.txt +0 -7
- package/src/llama.cpp/prompts/chat.txt +0 -28
- package/src/llama.cpp/prompts/dan-modified.txt +0 -1
- package/src/llama.cpp/prompts/dan.txt +0 -1
- package/src/llama.cpp/prompts/mnemonics.txt +0 -93
- package/src/llama.cpp/prompts/parallel-questions.txt +0 -43
- package/src/llama.cpp/prompts/reason-act.txt +0 -18
- package/src/llama.cpp/requirements/requirements-all.txt +0 -15
- package/src/llama.cpp/requirements/requirements-compare-llama-bench.txt +0 -2
- package/src/llama.cpp/requirements/requirements-convert_hf_to_gguf.txt +0 -7
- package/src/llama.cpp/requirements/requirements-convert_hf_to_gguf_update.txt +0 -7
- package/src/llama.cpp/requirements/requirements-convert_legacy_llama.txt +0 -5
- package/src/llama.cpp/requirements/requirements-convert_llama_ggml_to_gguf.txt +0 -1
- package/src/llama.cpp/requirements/requirements-convert_lora_to_gguf.txt +0 -4
- package/src/llama.cpp/requirements/requirements-gguf_editor_gui.txt +0 -3
- package/src/llama.cpp/requirements/requirements-pydantic.txt +0 -3
- package/src/llama.cpp/requirements/requirements-test-tokenizer-random.txt +0 -1
- package/src/llama.cpp/requirements/requirements-tool_bench.txt +0 -12
- package/src/llama.cpp/requirements.txt +0 -13
- package/src/llama.cpp/scripts/build-info.sh +0 -30
- package/src/llama.cpp/scripts/install-oneapi.bat +0 -19
- package/src/llama.cpp/scripts/xxd.cmake +0 -16
- package/src/llama.cpp/tests/CMakeLists.txt +0 -177
- package/src/llama.cpp/tests/get-model.cpp +0 -21
- package/src/llama.cpp/tests/get-model.h +0 -2
- package/src/llama.cpp/tests/test-arg-parser.cpp +0 -178
- package/src/llama.cpp/tests/test-autorelease.cpp +0 -24
- package/src/llama.cpp/tests/test-backend-ops.cpp +0 -4793
- package/src/llama.cpp/tests/test-barrier.cpp +0 -94
- package/src/llama.cpp/tests/test-c.c +0 -7
- package/src/llama.cpp/tests/test-chat-template.cpp +0 -417
- package/src/llama.cpp/tests/test-chat.cpp +0 -985
- package/src/llama.cpp/tests/test-double-float.cpp +0 -57
- package/src/llama.cpp/tests/test-gbnf-validator.cpp +0 -109
- package/src/llama.cpp/tests/test-gguf.cpp +0 -1338
- package/src/llama.cpp/tests/test-grammar-integration.cpp +0 -1308
- package/src/llama.cpp/tests/test-grammar-llguidance.cpp +0 -1201
- package/src/llama.cpp/tests/test-grammar-parser.cpp +0 -519
- package/src/llama.cpp/tests/test-json-schema-to-grammar.cpp +0 -1304
- package/src/llama.cpp/tests/test-llama-grammar.cpp +0 -408
- package/src/llama.cpp/tests/test-log.cpp +0 -39
- package/src/llama.cpp/tests/test-model-load-cancel.cpp +0 -27
- package/src/llama.cpp/tests/test-mtmd-c-api.c +0 -63
- package/src/llama.cpp/tests/test-opt.cpp +0 -904
- package/src/llama.cpp/tests/test-quantize-fns.cpp +0 -186
- package/src/llama.cpp/tests/test-quantize-perf.cpp +0 -365
- package/src/llama.cpp/tests/test-quantize-stats.cpp +0 -424
- package/src/llama.cpp/tests/test-regex-partial.cpp +0 -288
- package/src/llama.cpp/tests/test-rope.cpp +0 -262
- package/src/llama.cpp/tests/test-sampling.cpp +0 -399
- package/src/llama.cpp/tests/test-tokenizer-0.cpp +0 -312
- package/src/llama.cpp/tests/test-tokenizer-1-bpe.cpp +0 -155
- package/src/llama.cpp/tests/test-tokenizer-1-spm.cpp +0 -125
- package/src/llama.cpp/tools/CMakeLists.txt +0 -39
- package/src/llama.cpp/tools/batched-bench/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/batched-bench/batched-bench.cpp +0 -204
- package/src/llama.cpp/tools/cvector-generator/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/cvector-generator/completions.txt +0 -582
- package/src/llama.cpp/tools/cvector-generator/cvector-generator.cpp +0 -508
- package/src/llama.cpp/tools/cvector-generator/mean.hpp +0 -48
- package/src/llama.cpp/tools/cvector-generator/negative.txt +0 -4
- package/src/llama.cpp/tools/cvector-generator/pca.hpp +0 -315
- package/src/llama.cpp/tools/cvector-generator/positive.txt +0 -4
- package/src/llama.cpp/tools/export-lora/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/export-lora/export-lora.cpp +0 -434
- package/src/llama.cpp/tools/gguf-split/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/gguf-split/gguf-split.cpp +0 -583
- package/src/llama.cpp/tools/imatrix/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/imatrix/imatrix.cpp +0 -667
- package/src/llama.cpp/tools/llama-bench/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/llama-bench/llama-bench.cpp +0 -2024
- package/src/llama.cpp/tools/main/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/main/main.cpp +0 -977
- package/src/llama.cpp/tools/mtmd/CMakeLists.txt +0 -58
- package/src/llama.cpp/tools/mtmd/clip-impl.h +0 -462
- package/src/llama.cpp/tools/mtmd/clip.cpp +0 -4024
- package/src/llama.cpp/tools/mtmd/clip.h +0 -101
- package/src/llama.cpp/tools/mtmd/deprecation-warning.cpp +0 -22
- package/src/llama.cpp/tools/mtmd/miniaudio.h +0 -93468
- package/src/llama.cpp/tools/mtmd/mtmd-audio.cpp +0 -855
- package/src/llama.cpp/tools/mtmd/mtmd-audio.h +0 -62
- package/src/llama.cpp/tools/mtmd/mtmd-cli.cpp +0 -377
- package/src/llama.cpp/tools/mtmd/mtmd-helper.cpp +0 -297
- package/src/llama.cpp/tools/mtmd/mtmd.cpp +0 -942
- package/src/llama.cpp/tools/mtmd/mtmd.h +0 -362
- package/src/llama.cpp/tools/mtmd/requirements.txt +0 -5
- package/src/llama.cpp/tools/perplexity/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/perplexity/perplexity.cpp +0 -2063
- package/src/llama.cpp/tools/quantize/CMakeLists.txt +0 -6
- package/src/llama.cpp/tools/quantize/quantize.cpp +0 -519
- package/src/llama.cpp/tools/rpc/CMakeLists.txt +0 -4
- package/src/llama.cpp/tools/rpc/rpc-server.cpp +0 -322
- package/src/llama.cpp/tools/run/CMakeLists.txt +0 -16
- package/src/llama.cpp/tools/run/linenoise.cpp/linenoise.cpp +0 -1995
- package/src/llama.cpp/tools/run/linenoise.cpp/linenoise.h +0 -137
- package/src/llama.cpp/tools/run/run.cpp +0 -1261
- package/src/llama.cpp/tools/server/CMakeLists.txt +0 -51
- package/src/llama.cpp/tools/server/bench/requirements.txt +0 -2
- package/src/llama.cpp/tools/server/httplib.h +0 -10506
- package/src/llama.cpp/tools/server/server.cpp +0 -4966
- package/src/llama.cpp/tools/server/tests/requirements.txt +0 -8
- package/src/llama.cpp/tools/server/utils.hpp +0 -1337
- package/src/llama.cpp/tools/tokenize/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/tokenize/tokenize.cpp +0 -416
- package/src/llama.cpp/tools/tts/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/tts/tts.cpp +0 -1092
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
#ifdef NDEBUG
|
|
2
|
-
#undef NDEBUG
|
|
3
|
-
#endif
|
|
4
|
-
|
|
5
|
-
#include "llama.h"
|
|
6
|
-
|
|
7
|
-
#include "../src/llama-grammar.h"
|
|
8
|
-
|
|
9
|
-
#include <cassert>
|
|
10
|
-
#include <stdexcept>
|
|
11
|
-
|
|
12
|
-
int main()
|
|
13
|
-
{
|
|
14
|
-
llama_grammar_parser parsed_grammar;
|
|
15
|
-
|
|
16
|
-
std::vector<std::pair<std::string, uint32_t>> expected = {
|
|
17
|
-
{"expr", 2},
|
|
18
|
-
{"expr_6", 6},
|
|
19
|
-
{"expr_7", 7},
|
|
20
|
-
{"ident", 8},
|
|
21
|
-
{"ident_10", 10},
|
|
22
|
-
{"num", 9},
|
|
23
|
-
{"num_11", 11},
|
|
24
|
-
{"root", 0},
|
|
25
|
-
{"root_1", 1},
|
|
26
|
-
{"root_5", 5},
|
|
27
|
-
{"term", 4},
|
|
28
|
-
{"ws", 3},
|
|
29
|
-
{"ws_12", 12},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
std::vector<std::vector<llama_grammar_element>> expected_rules = {
|
|
33
|
-
{{LLAMA_GRETYPE_RULE_REF, 5}, {LLAMA_GRETYPE_END, 0}},
|
|
34
|
-
{
|
|
35
|
-
{LLAMA_GRETYPE_RULE_REF, 2},
|
|
36
|
-
{LLAMA_GRETYPE_CHAR, 61},
|
|
37
|
-
{LLAMA_GRETYPE_RULE_REF, 3},
|
|
38
|
-
{LLAMA_GRETYPE_RULE_REF, 4},
|
|
39
|
-
{LLAMA_GRETYPE_CHAR, 10},
|
|
40
|
-
{LLAMA_GRETYPE_END, 0},
|
|
41
|
-
},
|
|
42
|
-
{{LLAMA_GRETYPE_RULE_REF, 4}, {LLAMA_GRETYPE_RULE_REF, 7}, {LLAMA_GRETYPE_END, 0}},
|
|
43
|
-
{{LLAMA_GRETYPE_RULE_REF, 12}, {LLAMA_GRETYPE_END, 0}},
|
|
44
|
-
{
|
|
45
|
-
{LLAMA_GRETYPE_RULE_REF, 8},
|
|
46
|
-
{LLAMA_GRETYPE_ALT, 0},
|
|
47
|
-
{LLAMA_GRETYPE_RULE_REF, 9},
|
|
48
|
-
{LLAMA_GRETYPE_ALT, 0},
|
|
49
|
-
{LLAMA_GRETYPE_CHAR, 40},
|
|
50
|
-
{LLAMA_GRETYPE_RULE_REF, 3},
|
|
51
|
-
{LLAMA_GRETYPE_RULE_REF, 2},
|
|
52
|
-
{LLAMA_GRETYPE_CHAR, 41},
|
|
53
|
-
{LLAMA_GRETYPE_RULE_REF, 3},
|
|
54
|
-
{LLAMA_GRETYPE_END, 0},
|
|
55
|
-
},
|
|
56
|
-
{{LLAMA_GRETYPE_RULE_REF, 1}, {LLAMA_GRETYPE_RULE_REF, 5}, {LLAMA_GRETYPE_ALT, 0}, {LLAMA_GRETYPE_RULE_REF, 1}, {LLAMA_GRETYPE_END, 0}},
|
|
57
|
-
{
|
|
58
|
-
{LLAMA_GRETYPE_CHAR, 45},
|
|
59
|
-
{LLAMA_GRETYPE_CHAR_ALT, 43},
|
|
60
|
-
{LLAMA_GRETYPE_CHAR_ALT, 42},
|
|
61
|
-
{LLAMA_GRETYPE_CHAR_ALT, 47},
|
|
62
|
-
{LLAMA_GRETYPE_RULE_REF, 4},
|
|
63
|
-
{LLAMA_GRETYPE_END, 0},
|
|
64
|
-
},
|
|
65
|
-
{{LLAMA_GRETYPE_RULE_REF, 6}, {LLAMA_GRETYPE_RULE_REF, 7}, {LLAMA_GRETYPE_ALT, 0}, {LLAMA_GRETYPE_END, 0}},
|
|
66
|
-
{
|
|
67
|
-
{LLAMA_GRETYPE_CHAR, 97},
|
|
68
|
-
{LLAMA_GRETYPE_CHAR_RNG_UPPER, 122},
|
|
69
|
-
{LLAMA_GRETYPE_RULE_REF, 10},
|
|
70
|
-
{LLAMA_GRETYPE_RULE_REF, 3},
|
|
71
|
-
{LLAMA_GRETYPE_END, 0},
|
|
72
|
-
},
|
|
73
|
-
{{LLAMA_GRETYPE_RULE_REF, 11}, {LLAMA_GRETYPE_RULE_REF, 3}, {LLAMA_GRETYPE_END, 0}},
|
|
74
|
-
{
|
|
75
|
-
{LLAMA_GRETYPE_CHAR, 97},
|
|
76
|
-
{LLAMA_GRETYPE_CHAR_RNG_UPPER, 122},
|
|
77
|
-
{LLAMA_GRETYPE_CHAR_ALT, 48},
|
|
78
|
-
{LLAMA_GRETYPE_CHAR_RNG_UPPER, 57},
|
|
79
|
-
{LLAMA_GRETYPE_CHAR_ALT, 95},
|
|
80
|
-
{LLAMA_GRETYPE_RULE_REF, 10},
|
|
81
|
-
{LLAMA_GRETYPE_ALT, 0},
|
|
82
|
-
{LLAMA_GRETYPE_END, 0},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
{LLAMA_GRETYPE_CHAR, 48},
|
|
86
|
-
{LLAMA_GRETYPE_CHAR_RNG_UPPER, 57},
|
|
87
|
-
{LLAMA_GRETYPE_RULE_REF, 11},
|
|
88
|
-
{LLAMA_GRETYPE_ALT, 0},
|
|
89
|
-
{LLAMA_GRETYPE_CHAR, 48},
|
|
90
|
-
{LLAMA_GRETYPE_CHAR_RNG_UPPER, 57},
|
|
91
|
-
{LLAMA_GRETYPE_END, 0},
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
{LLAMA_GRETYPE_CHAR, 32},
|
|
95
|
-
{LLAMA_GRETYPE_CHAR_ALT, 9},
|
|
96
|
-
{LLAMA_GRETYPE_CHAR_ALT, 10},
|
|
97
|
-
{LLAMA_GRETYPE_RULE_REF, 12},
|
|
98
|
-
{LLAMA_GRETYPE_ALT, 0},
|
|
99
|
-
{LLAMA_GRETYPE_END, 0},
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
for (auto pair : expected)
|
|
104
|
-
{
|
|
105
|
-
parsed_grammar.symbol_ids[pair.first] = pair.second;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
for (auto rule : expected_rules)
|
|
109
|
-
{
|
|
110
|
-
parsed_grammar.rules.emplace_back();
|
|
111
|
-
for (auto element : rule)
|
|
112
|
-
{
|
|
113
|
-
parsed_grammar.rules.back().push_back(element);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
std::vector<const llama_grammar_element *> grammar_rules(parsed_grammar.c_rules());
|
|
118
|
-
|
|
119
|
-
llama_grammar * grammar = llama_grammar_init_impl(nullptr, grammar_rules.data(), grammar_rules.size(), parsed_grammar.symbol_ids.at("root"));
|
|
120
|
-
if (grammar == nullptr) {
|
|
121
|
-
throw std::runtime_error("Failed to initialize llama_grammar");
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
std::vector<std::vector<llama_grammar_element>> expected_stacks = {
|
|
125
|
-
{
|
|
126
|
-
{LLAMA_GRETYPE_RULE_REF, 5},
|
|
127
|
-
{LLAMA_GRETYPE_CHAR, 61},
|
|
128
|
-
{LLAMA_GRETYPE_RULE_REF, 7},
|
|
129
|
-
{LLAMA_GRETYPE_CHAR, 97},
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
{LLAMA_GRETYPE_RULE_REF, 5},
|
|
133
|
-
{LLAMA_GRETYPE_CHAR, 61},
|
|
134
|
-
{LLAMA_GRETYPE_RULE_REF, 7},
|
|
135
|
-
{LLAMA_GRETYPE_RULE_REF, 3},
|
|
136
|
-
{LLAMA_GRETYPE_CHAR, 48},
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
{LLAMA_GRETYPE_RULE_REF, 5},
|
|
140
|
-
{LLAMA_GRETYPE_CHAR, 61},
|
|
141
|
-
{LLAMA_GRETYPE_RULE_REF, 7},
|
|
142
|
-
{LLAMA_GRETYPE_RULE_REF, 3},
|
|
143
|
-
{LLAMA_GRETYPE_CHAR, 48},
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
{LLAMA_GRETYPE_RULE_REF, 5},
|
|
147
|
-
{LLAMA_GRETYPE_CHAR, 61},
|
|
148
|
-
{LLAMA_GRETYPE_RULE_REF, 7},
|
|
149
|
-
{LLAMA_GRETYPE_CHAR, 40},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
{LLAMA_GRETYPE_CHAR, 61},
|
|
153
|
-
{LLAMA_GRETYPE_RULE_REF, 7},
|
|
154
|
-
{LLAMA_GRETYPE_CHAR, 97},
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
{LLAMA_GRETYPE_CHAR, 61},
|
|
158
|
-
{LLAMA_GRETYPE_RULE_REF, 7},
|
|
159
|
-
{LLAMA_GRETYPE_RULE_REF, 3},
|
|
160
|
-
{LLAMA_GRETYPE_CHAR, 48},
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
{LLAMA_GRETYPE_CHAR, 61},
|
|
164
|
-
{LLAMA_GRETYPE_RULE_REF, 7},
|
|
165
|
-
{LLAMA_GRETYPE_RULE_REF, 3},
|
|
166
|
-
{LLAMA_GRETYPE_CHAR, 48},
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
{LLAMA_GRETYPE_CHAR, 61},
|
|
170
|
-
{LLAMA_GRETYPE_RULE_REF, 7},
|
|
171
|
-
{LLAMA_GRETYPE_CHAR, 40},
|
|
172
|
-
}};
|
|
173
|
-
|
|
174
|
-
auto index = 0;
|
|
175
|
-
for (const llama_grammar_stack & stack : llama_grammar_get_stacks(grammar))
|
|
176
|
-
{
|
|
177
|
-
// compare stack to expected_stack
|
|
178
|
-
for (uint32_t i = 0; i < stack.size(); i++)
|
|
179
|
-
{
|
|
180
|
-
const llama_grammar_element * element = stack[i];
|
|
181
|
-
const llama_grammar_element & expected_element = expected_stacks[index][i];
|
|
182
|
-
|
|
183
|
-
// pretty print error message before asserting
|
|
184
|
-
if (expected_element.type != element->type || expected_element.value != element->value)
|
|
185
|
-
{
|
|
186
|
-
fprintf(stderr, "index: %d\n", index);
|
|
187
|
-
fprintf(stderr, "expected_element: %d, %u\n", expected_element.type, expected_element.value);
|
|
188
|
-
fprintf(stderr, "actual_element: %d, %u\n", element->type, element->value);
|
|
189
|
-
fprintf(stderr, "expected_element != actual_element\n");
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
assert(expected_element.type == element->type && expected_element.value == element->value);
|
|
193
|
-
}
|
|
194
|
-
index++;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
std::vector<llama_grammar_candidate> next_candidates;
|
|
198
|
-
next_candidates.resize(24);
|
|
199
|
-
|
|
200
|
-
for (size_t i = 0; i < 24; ++i)
|
|
201
|
-
{
|
|
202
|
-
uint32_t *cp = new uint32_t[2]; // dynamically allocate memory for code_point
|
|
203
|
-
cp[0] = 37 + i;
|
|
204
|
-
cp[1] = 0;
|
|
205
|
-
next_candidates[i] = {i, cp, {}};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
std::vector<std::vector<std::pair<uint32_t, uint16_t>>> expected_reject = {
|
|
209
|
-
{
|
|
210
|
-
{0, 37},
|
|
211
|
-
{1, 38},
|
|
212
|
-
{2, 39},
|
|
213
|
-
{3, 40},
|
|
214
|
-
{4, 41},
|
|
215
|
-
{5, 42},
|
|
216
|
-
{6, 43},
|
|
217
|
-
{7, 44},
|
|
218
|
-
{8, 45},
|
|
219
|
-
{9, 46},
|
|
220
|
-
{10, 47},
|
|
221
|
-
{11, 48},
|
|
222
|
-
{12, 49},
|
|
223
|
-
{13, 50},
|
|
224
|
-
{14, 51},
|
|
225
|
-
{15, 52},
|
|
226
|
-
{16, 53},
|
|
227
|
-
{17, 54},
|
|
228
|
-
{18, 55},
|
|
229
|
-
{19, 56},
|
|
230
|
-
{20, 57},
|
|
231
|
-
{21, 58},
|
|
232
|
-
{22, 59},
|
|
233
|
-
{23, 60},
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
{0, 37},
|
|
237
|
-
{1, 38},
|
|
238
|
-
{2, 39},
|
|
239
|
-
{3, 40},
|
|
240
|
-
{4, 41},
|
|
241
|
-
{5, 42},
|
|
242
|
-
{6, 43},
|
|
243
|
-
{7, 44},
|
|
244
|
-
{8, 45},
|
|
245
|
-
{9, 46},
|
|
246
|
-
{10, 47},
|
|
247
|
-
{21, 58},
|
|
248
|
-
{22, 59},
|
|
249
|
-
{23, 60},
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
{0, 37},
|
|
253
|
-
{1, 38},
|
|
254
|
-
{2, 39},
|
|
255
|
-
{3, 40},
|
|
256
|
-
{4, 41},
|
|
257
|
-
{5, 42},
|
|
258
|
-
{6, 43},
|
|
259
|
-
{7, 44},
|
|
260
|
-
{8, 45},
|
|
261
|
-
{9, 46},
|
|
262
|
-
{10, 47},
|
|
263
|
-
{21, 58},
|
|
264
|
-
{22, 59},
|
|
265
|
-
{23, 60},
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
{0, 37},
|
|
269
|
-
{1, 38},
|
|
270
|
-
{2, 39},
|
|
271
|
-
{4, 41},
|
|
272
|
-
{5, 42},
|
|
273
|
-
{6, 43},
|
|
274
|
-
{7, 44},
|
|
275
|
-
{8, 45},
|
|
276
|
-
{9, 46},
|
|
277
|
-
{10, 47},
|
|
278
|
-
{11, 48},
|
|
279
|
-
{12, 49},
|
|
280
|
-
{13, 50},
|
|
281
|
-
{14, 51},
|
|
282
|
-
{15, 52},
|
|
283
|
-
{16, 53},
|
|
284
|
-
{17, 54},
|
|
285
|
-
{18, 55},
|
|
286
|
-
{19, 56},
|
|
287
|
-
{20, 57},
|
|
288
|
-
{21, 58},
|
|
289
|
-
{22, 59},
|
|
290
|
-
{23, 60},
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
{0, 37},
|
|
294
|
-
{1, 38},
|
|
295
|
-
{2, 39},
|
|
296
|
-
{3, 40},
|
|
297
|
-
{4, 41},
|
|
298
|
-
{5, 42},
|
|
299
|
-
{6, 43},
|
|
300
|
-
{7, 44},
|
|
301
|
-
{8, 45},
|
|
302
|
-
{9, 46},
|
|
303
|
-
{10, 47},
|
|
304
|
-
{11, 48},
|
|
305
|
-
{12, 49},
|
|
306
|
-
{13, 50},
|
|
307
|
-
{14, 51},
|
|
308
|
-
{15, 52},
|
|
309
|
-
{16, 53},
|
|
310
|
-
{17, 54},
|
|
311
|
-
{18, 55},
|
|
312
|
-
{19, 56},
|
|
313
|
-
{20, 57},
|
|
314
|
-
{21, 58},
|
|
315
|
-
{22, 59},
|
|
316
|
-
{23, 60},
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
{0, 37},
|
|
320
|
-
{1, 38},
|
|
321
|
-
{2, 39},
|
|
322
|
-
{3, 40},
|
|
323
|
-
{4, 41},
|
|
324
|
-
{5, 42},
|
|
325
|
-
{6, 43},
|
|
326
|
-
{7, 44},
|
|
327
|
-
{8, 45},
|
|
328
|
-
{9, 46},
|
|
329
|
-
{10, 47},
|
|
330
|
-
{21, 58},
|
|
331
|
-
{22, 59},
|
|
332
|
-
{23, 60},
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
{0, 37},
|
|
336
|
-
{1, 38},
|
|
337
|
-
{2, 39},
|
|
338
|
-
{3, 40},
|
|
339
|
-
{4, 41},
|
|
340
|
-
{5, 42},
|
|
341
|
-
{6, 43},
|
|
342
|
-
{7, 44},
|
|
343
|
-
{8, 45},
|
|
344
|
-
{9, 46},
|
|
345
|
-
{10, 47},
|
|
346
|
-
{21, 58},
|
|
347
|
-
{22, 59},
|
|
348
|
-
{23, 60},
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
{0, 37},
|
|
352
|
-
{1, 38},
|
|
353
|
-
{2, 39},
|
|
354
|
-
{4, 41},
|
|
355
|
-
{5, 42},
|
|
356
|
-
{6, 43},
|
|
357
|
-
{7, 44},
|
|
358
|
-
{8, 45},
|
|
359
|
-
{9, 46},
|
|
360
|
-
{10, 47},
|
|
361
|
-
{11, 48},
|
|
362
|
-
{12, 49},
|
|
363
|
-
{13, 50},
|
|
364
|
-
{14, 51},
|
|
365
|
-
{15, 52},
|
|
366
|
-
{16, 53},
|
|
367
|
-
{17, 54},
|
|
368
|
-
{18, 55},
|
|
369
|
-
{19, 56},
|
|
370
|
-
{20, 57},
|
|
371
|
-
{21, 58},
|
|
372
|
-
{22, 59},
|
|
373
|
-
{23, 60},
|
|
374
|
-
},
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
std::vector<llama_grammar_candidate> rejects = llama_grammar_reject_candidates_for_stack(llama_grammar_get_rules(grammar), llama_grammar_get_stacks(grammar)[0], next_candidates);
|
|
378
|
-
|
|
379
|
-
std::vector<std::vector<llama_grammar_candidate>> all_rejects;
|
|
380
|
-
|
|
381
|
-
for (std::size_t count = 0; count < llama_grammar_get_stacks(grammar).size(); ++count)
|
|
382
|
-
{
|
|
383
|
-
rejects = llama_grammar_reject_candidates_for_stack(llama_grammar_get_rules(grammar), llama_grammar_get_stacks(grammar)[count], next_candidates);
|
|
384
|
-
all_rejects.push_back(rejects);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
index = 0;
|
|
388
|
-
for (auto rej : all_rejects)
|
|
389
|
-
{
|
|
390
|
-
for (uint32_t i = 0; i < rej.size(); i++)
|
|
391
|
-
{
|
|
392
|
-
auto element = rej[i];
|
|
393
|
-
auto expected_element = expected_reject[index][i];
|
|
394
|
-
assert(element.index == expected_element.first && *element.code_points == expected_element.second);
|
|
395
|
-
}
|
|
396
|
-
index++;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
for (auto &candidate : next_candidates)
|
|
400
|
-
{
|
|
401
|
-
delete[] candidate.code_points;
|
|
402
|
-
candidate.code_points = nullptr;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
llama_grammar_free_impl(grammar);
|
|
406
|
-
|
|
407
|
-
return 0;
|
|
408
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
#include "log.h"
|
|
2
|
-
|
|
3
|
-
#include <cstdlib>
|
|
4
|
-
#include <thread>
|
|
5
|
-
|
|
6
|
-
int main() {
|
|
7
|
-
const int n_thread = 8;
|
|
8
|
-
|
|
9
|
-
std::thread threads[n_thread];
|
|
10
|
-
for (int i = 0; i < n_thread; i++) {
|
|
11
|
-
threads[i] = std::thread([i]() {
|
|
12
|
-
const int n_msg = 1000;
|
|
13
|
-
|
|
14
|
-
for (int j = 0; j < n_msg; j++) {
|
|
15
|
-
const int log_type = std::rand() % 4;
|
|
16
|
-
|
|
17
|
-
switch (log_type) {
|
|
18
|
-
case 0: LOG_INF("Thread %d: %d\n", i, j); break;
|
|
19
|
-
case 1: LOG_WRN("Thread %d: %d\n", i, j); break;
|
|
20
|
-
case 2: LOG_ERR("Thread %d: %d\n", i, j); break;
|
|
21
|
-
case 3: LOG_DBG("Thread %d: %d\n", i, j); break;
|
|
22
|
-
default:
|
|
23
|
-
break;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (rand () % 10 < 5) {
|
|
27
|
-
common_log_set_timestamps(common_log_main(), rand() % 2);
|
|
28
|
-
common_log_set_prefix (common_log_main(), rand() % 2);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
for (int i = 0; i < n_thread; i++) {
|
|
35
|
-
threads[i].join();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return 0;
|
|
39
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#include "llama.h"
|
|
2
|
-
#include "get-model.h"
|
|
3
|
-
|
|
4
|
-
#include <cstdlib>
|
|
5
|
-
|
|
6
|
-
int main(int argc, char *argv[] ) {
|
|
7
|
-
auto * model_path = get_model_or_exit(argc, argv);
|
|
8
|
-
auto * file = fopen(model_path, "r");
|
|
9
|
-
if (file == nullptr) {
|
|
10
|
-
fprintf(stderr, "no model at '%s' found\n", model_path);
|
|
11
|
-
return EXIT_FAILURE;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
fprintf(stderr, "using '%s'\n", model_path);
|
|
15
|
-
fclose(file);
|
|
16
|
-
|
|
17
|
-
llama_backend_init();
|
|
18
|
-
auto params = llama_model_params{};
|
|
19
|
-
params.use_mmap = false;
|
|
20
|
-
params.progress_callback = [](float progress, void * ctx){
|
|
21
|
-
(void) ctx;
|
|
22
|
-
return progress > 0.50;
|
|
23
|
-
};
|
|
24
|
-
auto * model = llama_model_load_from_file(model_path, params);
|
|
25
|
-
llama_backend_free();
|
|
26
|
-
return model == nullptr ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
27
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#include <stdio.h>
|
|
2
|
-
#include <assert.h>
|
|
3
|
-
|
|
4
|
-
#include "mtmd.h"
|
|
5
|
-
|
|
6
|
-
int main(void) {
|
|
7
|
-
printf("\n\nTesting libmtmd C API...\n");
|
|
8
|
-
printf("--------\n\n");
|
|
9
|
-
|
|
10
|
-
struct mtmd_context_params params = mtmd_context_params_default();
|
|
11
|
-
printf("Default image marker: %s\n", params.image_marker);
|
|
12
|
-
|
|
13
|
-
mtmd_input_chunks * chunks = mtmd_test_create_input_chunks();
|
|
14
|
-
|
|
15
|
-
if (!chunks) {
|
|
16
|
-
fprintf(stderr, "Failed to create input chunks\n");
|
|
17
|
-
return 1;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
size_t n_chunks = mtmd_input_chunks_size(chunks);
|
|
21
|
-
printf("Number of chunks: %zu\n", n_chunks);
|
|
22
|
-
assert(n_chunks > 0);
|
|
23
|
-
|
|
24
|
-
for (size_t i = 0; i < n_chunks; i++) {
|
|
25
|
-
const mtmd_input_chunk * chunk = mtmd_input_chunks_get(chunks, i);
|
|
26
|
-
assert(chunk != NULL);
|
|
27
|
-
enum mtmd_input_chunk_type type = mtmd_input_chunk_get_type(chunk);
|
|
28
|
-
printf("Chunk %zu type: %d\n", i, type);
|
|
29
|
-
|
|
30
|
-
if (type == MTMD_INPUT_CHUNK_TYPE_TEXT) {
|
|
31
|
-
size_t n_tokens;
|
|
32
|
-
const llama_token * tokens = mtmd_input_chunk_get_tokens_text(chunk, &n_tokens);
|
|
33
|
-
printf(" Text chunk with %zu tokens\n", n_tokens);
|
|
34
|
-
assert(tokens != NULL);
|
|
35
|
-
assert(n_tokens > 0);
|
|
36
|
-
for (size_t j = 0; j < n_tokens; j++) {
|
|
37
|
-
assert(tokens[j] >= 0);
|
|
38
|
-
printf(" > Token %zu: %d\n", j, tokens[j]);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
} else if (type == MTMD_INPUT_CHUNK_TYPE_IMAGE) {
|
|
42
|
-
const mtmd_image_tokens * image_tokens = mtmd_input_chunk_get_tokens_image(chunk);
|
|
43
|
-
size_t n_tokens = mtmd_image_tokens_get_n_tokens(image_tokens);
|
|
44
|
-
size_t nx = mtmd_image_tokens_get_nx(image_tokens);
|
|
45
|
-
size_t ny = mtmd_image_tokens_get_ny(image_tokens);
|
|
46
|
-
const char * id = mtmd_image_tokens_get_id(image_tokens);
|
|
47
|
-
assert(n_tokens > 0);
|
|
48
|
-
assert(nx > 0);
|
|
49
|
-
assert(ny > 0);
|
|
50
|
-
assert(id != NULL);
|
|
51
|
-
printf(" Image chunk with %zu tokens\n", n_tokens);
|
|
52
|
-
printf(" Image size: %zu x %zu\n", nx, ny);
|
|
53
|
-
printf(" Image ID: %s\n", id);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Free the chunks
|
|
58
|
-
mtmd_input_chunks_free(chunks);
|
|
59
|
-
|
|
60
|
-
printf("\n\nDONE: test libmtmd C API...\n");
|
|
61
|
-
|
|
62
|
-
return 0;
|
|
63
|
-
}
|