@fugood/llama.node 0.6.3 → 1.0.0-beta.1
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 +45 -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,297 +0,0 @@
|
|
|
1
|
-
#include "mtmd.h"
|
|
2
|
-
#include "llama.h"
|
|
3
|
-
|
|
4
|
-
#include <algorithm>
|
|
5
|
-
#include <cinttypes>
|
|
6
|
-
#include <vector>
|
|
7
|
-
|
|
8
|
-
#define LOG_INF(...) fprintf(stdout, __VA_ARGS__)
|
|
9
|
-
#define LOG_ERR(...) fprintf(stderr, __VA_ARGS__)
|
|
10
|
-
|
|
11
|
-
size_t mtmd_helper_get_n_tokens(const mtmd_input_chunks * chunks) {
|
|
12
|
-
size_t n_tokens = 0;
|
|
13
|
-
for (size_t i = 0; i < mtmd_input_chunks_size(chunks); i++) {
|
|
14
|
-
auto chunk = mtmd_input_chunks_get(chunks, i);
|
|
15
|
-
n_tokens += mtmd_input_chunk_get_n_tokens(chunk);
|
|
16
|
-
}
|
|
17
|
-
return n_tokens;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
llama_pos mtmd_helper_get_n_pos(const mtmd_input_chunks * chunks) {
|
|
21
|
-
llama_pos n_pos = 0;
|
|
22
|
-
for (size_t i = 0; i < mtmd_input_chunks_size(chunks); i++) {
|
|
23
|
-
auto chunk = mtmd_input_chunks_get(chunks, i);
|
|
24
|
-
n_pos += mtmd_input_chunk_get_n_pos(chunk);
|
|
25
|
-
}
|
|
26
|
-
return n_pos;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// helper struct to make working with embd batch easier
|
|
30
|
-
// note: this will be removed after llama_batch_ext refactoring
|
|
31
|
-
struct decode_embd_batch {
|
|
32
|
-
int n_pos_per_embd;
|
|
33
|
-
int n_mmproj_embd;
|
|
34
|
-
std::vector<llama_pos> pos;
|
|
35
|
-
std::vector<llama_pos> pos_view; // used by mrope
|
|
36
|
-
std::vector<int32_t> n_seq_id;
|
|
37
|
-
std::vector<llama_seq_id> seq_id_0;
|
|
38
|
-
std::vector<llama_seq_id *> seq_ids;
|
|
39
|
-
std::vector<int8_t> logits;
|
|
40
|
-
llama_batch batch;
|
|
41
|
-
decode_embd_batch(float * embd, int32_t n_tokens, int n_pos_per_embd, int n_mmproj_embd) : n_pos_per_embd(n_pos_per_embd), n_mmproj_embd(n_mmproj_embd) {
|
|
42
|
-
pos .resize(n_tokens * n_pos_per_embd);
|
|
43
|
-
n_seq_id.resize(n_tokens);
|
|
44
|
-
seq_ids .resize(n_tokens + 1);
|
|
45
|
-
logits .resize(n_tokens);
|
|
46
|
-
seq_id_0.resize(1);
|
|
47
|
-
seq_ids [n_tokens] = nullptr;
|
|
48
|
-
batch = {
|
|
49
|
-
/*n_tokens =*/ n_tokens,
|
|
50
|
-
/*tokens =*/ nullptr,
|
|
51
|
-
/*embd =*/ embd,
|
|
52
|
-
/*pos =*/ pos.data(),
|
|
53
|
-
/*n_seq_id =*/ n_seq_id.data(),
|
|
54
|
-
/*seq_id =*/ seq_ids.data(),
|
|
55
|
-
/*logits =*/ logits.data(),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
void set_position_normal(llama_pos pos_0, llama_seq_id seq_id) {
|
|
60
|
-
seq_id_0[0] = seq_id;
|
|
61
|
-
for (int i = 0; i < batch.n_tokens; i++) {
|
|
62
|
-
batch.pos [i] = pos_0 + i;
|
|
63
|
-
batch.n_seq_id[i] = 1;
|
|
64
|
-
batch.seq_id [i] = seq_id_0.data();
|
|
65
|
-
batch.logits [i] = false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
void set_position_mrope(llama_pos pos_0, int nx, int ny, llama_seq_id seq_id) {
|
|
70
|
-
GGML_ASSERT(n_pos_per_embd == 4);
|
|
71
|
-
seq_id_0[0] = seq_id;
|
|
72
|
-
for (int y = 0; y < ny; y++) {
|
|
73
|
-
for (int x = 0; x < nx; x++) {
|
|
74
|
-
int i = y * nx + x;
|
|
75
|
-
pos[i ] = pos_0;
|
|
76
|
-
pos[i + batch.n_tokens ] = pos_0 + y;
|
|
77
|
-
pos[i + batch.n_tokens * 2] = pos_0 + x;
|
|
78
|
-
pos[i + batch.n_tokens * 3] = 0; // last pos dim is unused
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
for (int i = 0; i < batch.n_tokens; i++) {
|
|
82
|
-
batch.n_seq_id[i] = 1;
|
|
83
|
-
batch.seq_id [i] = seq_id_0.data();
|
|
84
|
-
batch.logits [i] = false;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
llama_batch get_view(int offset, int n_tokens) {
|
|
89
|
-
llama_pos * pos_ptr;
|
|
90
|
-
pos_view.clear();
|
|
91
|
-
pos_view.reserve(n_tokens * n_pos_per_embd);
|
|
92
|
-
if (n_pos_per_embd > 1) {
|
|
93
|
-
// mrope
|
|
94
|
-
// for example, with layout of src: 1234...1234...1234...1234...
|
|
95
|
-
// offset 2 will give us dst: 34...34...34...34...
|
|
96
|
-
for (int i = 0; i < n_pos_per_embd; i++) {
|
|
97
|
-
// assume n_tokens is less than or equal to batch.n_tokens
|
|
98
|
-
// batch.n_tokens is number of **total** tokens
|
|
99
|
-
// n_tokens is number of viewed token
|
|
100
|
-
size_t src_idx = i * batch.n_tokens + offset;
|
|
101
|
-
pos_view.insert(pos_view.end(),
|
|
102
|
-
pos.data() + src_idx,
|
|
103
|
-
pos.data() + src_idx + n_tokens);
|
|
104
|
-
}
|
|
105
|
-
pos_ptr = pos_view.data();
|
|
106
|
-
} else {
|
|
107
|
-
// normal
|
|
108
|
-
pos_ptr = pos.data() + offset;
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
/*n_tokens =*/ n_tokens,
|
|
112
|
-
/*tokens =*/ nullptr,
|
|
113
|
-
/*embd =*/ batch.embd + offset * n_mmproj_embd,
|
|
114
|
-
/*pos =*/ pos_ptr,
|
|
115
|
-
/*n_seq_id =*/ batch.n_seq_id + offset,
|
|
116
|
-
/*seq_id =*/ batch.seq_id + offset,
|
|
117
|
-
/*logits =*/ batch.logits + offset,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// Helper function for decoding an image whose embeddings have already been calculated
|
|
123
|
-
int32_t mtmd_helper_decode_image_chunk(
|
|
124
|
-
mtmd_context * ctx,
|
|
125
|
-
struct llama_context * lctx,
|
|
126
|
-
const mtmd_input_chunk * chunk,
|
|
127
|
-
float * encoded_embd,
|
|
128
|
-
llama_pos n_past,
|
|
129
|
-
llama_seq_id seq_id,
|
|
130
|
-
int32_t n_batch,
|
|
131
|
-
llama_pos * new_n_past) {
|
|
132
|
-
auto chunk_type = mtmd_input_chunk_get_type(chunk);
|
|
133
|
-
const char * name = chunk_type == MTMD_INPUT_CHUNK_TYPE_IMAGE ? "image" : "audio";
|
|
134
|
-
if (chunk_type == MTMD_INPUT_CHUNK_TYPE_TEXT) {
|
|
135
|
-
LOG_ERR("failed to decode chunk: input chunk not of image/audio type\n");
|
|
136
|
-
return -1;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const llama_model * model = llama_get_model(lctx);
|
|
140
|
-
int n_mmproj_embd = llama_model_n_embd(model);
|
|
141
|
-
int n_pos_per_embd = mtmd_decode_use_mrope(ctx) ? 4 : 1;
|
|
142
|
-
|
|
143
|
-
int32_t n_tokens = mtmd_input_chunk_get_n_tokens(chunk);
|
|
144
|
-
int32_t i_batch = 0;
|
|
145
|
-
int32_t n_img_batches = GGML_PAD(n_tokens, n_batch) / n_batch;
|
|
146
|
-
decode_embd_batch batch_embd(encoded_embd, n_tokens, n_pos_per_embd, n_mmproj_embd);
|
|
147
|
-
|
|
148
|
-
if (mtmd_decode_use_mrope(ctx)) {
|
|
149
|
-
const auto image_tokens = mtmd_input_chunk_get_tokens_image(chunk);
|
|
150
|
-
if (chunk_type != MTMD_INPUT_CHUNK_TYPE_IMAGE) {
|
|
151
|
-
LOG_ERR("failed to decode chunk: M-RoPE only accepts image chunk\n");
|
|
152
|
-
return -1;
|
|
153
|
-
}
|
|
154
|
-
if (!image_tokens) {
|
|
155
|
-
LOG_ERR("failed to decode chunk: image tokens are null\n");
|
|
156
|
-
return -1;
|
|
157
|
-
}
|
|
158
|
-
const int nx = mtmd_image_tokens_get_nx(image_tokens);
|
|
159
|
-
const int ny = mtmd_image_tokens_get_ny(image_tokens);
|
|
160
|
-
batch_embd.set_position_mrope(n_past, nx, ny, seq_id);
|
|
161
|
-
} else {
|
|
162
|
-
batch_embd.set_position_normal(n_past, seq_id);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (mtmd_decode_use_non_causal(ctx)) {
|
|
166
|
-
llama_set_causal_attn(lctx, false);
|
|
167
|
-
// TODO @ngxson : need to make sure only one image is processed at a time, and n_ubatch must be enough to hold the image
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
while (i_batch < n_img_batches) { // split into batches
|
|
171
|
-
int pos_offset = i_batch*n_batch;
|
|
172
|
-
int n_tokens_batch = std::min(n_batch, n_tokens - pos_offset);
|
|
173
|
-
llama_batch batch_embd_view = batch_embd.get_view(pos_offset, n_tokens_batch);
|
|
174
|
-
|
|
175
|
-
LOG_INF("decoding %s batch %d/%d, n_tokens_batch = %d\n", name, i_batch+1, n_img_batches, n_tokens_batch);
|
|
176
|
-
|
|
177
|
-
int64_t t1 = ggml_time_ms();
|
|
178
|
-
int32_t ret = llama_decode(lctx, batch_embd_view);
|
|
179
|
-
if (ret != 0) {
|
|
180
|
-
LOG_ERR("failed to decode %s\n", name);
|
|
181
|
-
llama_set_causal_attn(lctx, true); // restore causal attn
|
|
182
|
-
return ret;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
LOG_INF("%s decoded (batch %d/%d) in %" PRId64 " ms\n", name, i_batch+1, n_img_batches, ggml_time_ms() - t1);
|
|
186
|
-
|
|
187
|
-
i_batch++;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
n_past += mtmd_input_chunk_get_n_pos(chunk);
|
|
191
|
-
*new_n_past = n_past;
|
|
192
|
-
|
|
193
|
-
if (mtmd_decode_use_non_causal(ctx)) {
|
|
194
|
-
llama_set_causal_attn(lctx, true);
|
|
195
|
-
}
|
|
196
|
-
return 0;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
int32_t mtmd_helper_eval_chunk_single(mtmd_context * ctx,
|
|
200
|
-
struct llama_context * lctx,
|
|
201
|
-
const mtmd_input_chunk * chunk,
|
|
202
|
-
llama_pos n_past,
|
|
203
|
-
llama_seq_id seq_id,
|
|
204
|
-
int32_t n_batch,
|
|
205
|
-
bool logits_last,
|
|
206
|
-
llama_pos * new_n_past) {
|
|
207
|
-
int32_t ret;
|
|
208
|
-
llama_batch text_batch = llama_batch_init(n_batch, 0, 1);
|
|
209
|
-
auto chunk_type = mtmd_input_chunk_get_type(chunk);
|
|
210
|
-
|
|
211
|
-
if (chunk_type == MTMD_INPUT_CHUNK_TYPE_TEXT) {
|
|
212
|
-
size_t n_tokens;
|
|
213
|
-
const auto tokens = mtmd_input_chunk_get_tokens_text(chunk, &n_tokens);
|
|
214
|
-
// LOG_INF("decoding text chunk, n_tokens = %zu\n", n_tokens);
|
|
215
|
-
size_t i = 0;
|
|
216
|
-
while (i < n_tokens) { // split into batches
|
|
217
|
-
text_batch.n_tokens = 0; // clear the batch
|
|
218
|
-
for (; i < n_tokens && text_batch.n_tokens < n_batch; i++) {
|
|
219
|
-
int32_t j = text_batch.n_tokens;
|
|
220
|
-
text_batch.token [j] = tokens[i];
|
|
221
|
-
text_batch.pos [j] = n_past++;
|
|
222
|
-
text_batch.n_seq_id[j] = 1;
|
|
223
|
-
text_batch.seq_id [j][0] = seq_id;
|
|
224
|
-
text_batch.logits [j] = false;
|
|
225
|
-
|
|
226
|
-
text_batch.n_tokens++;
|
|
227
|
-
}
|
|
228
|
-
bool is_last_token = (i == n_tokens);
|
|
229
|
-
if (logits_last && is_last_token) {
|
|
230
|
-
text_batch.logits[text_batch.n_tokens - 1] = true;
|
|
231
|
-
}
|
|
232
|
-
ret = llama_decode(lctx, text_batch);
|
|
233
|
-
if (ret != 0) {
|
|
234
|
-
LOG_ERR("failed to decode text\n");
|
|
235
|
-
llama_batch_free(text_batch);
|
|
236
|
-
return ret;
|
|
237
|
-
}
|
|
238
|
-
*new_n_past += text_batch.n_tokens;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
} else if (chunk_type == MTMD_INPUT_CHUNK_TYPE_IMAGE || chunk_type == MTMD_INPUT_CHUNK_TYPE_AUDIO) {
|
|
242
|
-
const char * name = chunk_type == MTMD_INPUT_CHUNK_TYPE_IMAGE ? "image" : "audio";
|
|
243
|
-
int64_t t0 = ggml_time_ms();
|
|
244
|
-
|
|
245
|
-
LOG_INF("encoding %s slice...\n", name);
|
|
246
|
-
|
|
247
|
-
ret = mtmd_encode_chunk(ctx, chunk);
|
|
248
|
-
if (ret != 0) {
|
|
249
|
-
LOG_ERR("failed to encode %s slice\n", name);
|
|
250
|
-
llama_batch_free(text_batch);
|
|
251
|
-
return ret;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
LOG_INF("%s slice encoded in %" PRId64 " ms\n", name, ggml_time_ms() - t0);
|
|
255
|
-
|
|
256
|
-
float * embd = mtmd_get_output_embd(ctx);
|
|
257
|
-
ret = mtmd_helper_decode_image_chunk(ctx, lctx, chunk, embd, n_past, seq_id, n_batch, new_n_past);
|
|
258
|
-
if (ret != 0) {
|
|
259
|
-
LOG_ERR("failed to decode %s\n", name);
|
|
260
|
-
llama_batch_free(text_batch);
|
|
261
|
-
return ret;
|
|
262
|
-
}
|
|
263
|
-
} else {
|
|
264
|
-
GGML_ABORT("chunk type not supported");
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return 0;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
int32_t mtmd_helper_eval_chunks(mtmd_context * ctx,
|
|
271
|
-
struct llama_context * lctx,
|
|
272
|
-
const mtmd_input_chunks * chunks,
|
|
273
|
-
llama_pos n_past,
|
|
274
|
-
llama_seq_id seq_id,
|
|
275
|
-
int32_t n_batch,
|
|
276
|
-
bool logits_last,
|
|
277
|
-
llama_pos * new_n_past) {
|
|
278
|
-
size_t n_chunks = mtmd_input_chunks_size(chunks);
|
|
279
|
-
if (n_chunks == 0) {
|
|
280
|
-
LOG_ERR("no chunks to eval\n");
|
|
281
|
-
return 0;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
for (size_t i = 0; i < n_chunks; i++) {
|
|
285
|
-
bool chunk_logits_last = (i == n_chunks - 1) && logits_last;
|
|
286
|
-
auto chunk = mtmd_input_chunks_get(chunks, i);
|
|
287
|
-
|
|
288
|
-
int32_t res = mtmd_helper_eval_chunk_single(ctx, lctx, chunk, n_past, seq_id, n_batch, chunk_logits_last, &n_past);
|
|
289
|
-
if (res != 0) {
|
|
290
|
-
LOG_ERR("failed to eval chunk %zu\n", i);
|
|
291
|
-
return res;
|
|
292
|
-
}
|
|
293
|
-
*new_n_past = n_past;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
return 0;
|
|
297
|
-
}
|