]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/log
pkg/ggml/sources/llama.cpp
2 years agoCUDA: deduplicate FlashAttention code (#7352)
Johannes Gäßler [Sat, 18 May 2024 10:36:25 +0000 (12:36 +0200)]
CUDA: deduplicate FlashAttention code (#7352)

2 years agoserver: correct --threads documentation [no ci] (#7362)
Johannes Gäßler [Sat, 18 May 2024 09:10:47 +0000 (11:10 +0200)]
server: correct --threads documentation [no ci] (#7362)

2 years agocuda : add half2 __shfl_xor() for ROCm 5.5 (#7263)
Engininja2 [Sat, 18 May 2024 08:05:17 +0000 (02:05 -0600)]
cuda : add half2 __shfl_xor() for ROCm 5.5 (#7263)

2 years agollama : add support for larger Granite Code Models (20B, 34B) (#7324)
Steffen Röcker [Sat, 18 May 2024 08:04:55 +0000 (10:04 +0200)]
llama : add support for larger Granite Code Models (20B, 34B) (#7324)

Tie the weights for ARCH_STARCODER to support the larger Granite code models.
Partially addresses ggerganov/issues/7116

There still remains to be a few things to fix.
Currently requires `--override-kv tokenizer.ggml.add_bos_token=bool:false`

2 years agoperplexity : ndot progress and show stats with < 100 tasks (#7348)
strawberrymelonpanda [Sat, 18 May 2024 07:57:08 +0000 (00:57 -0700)]
perplexity : ndot progress and show stats with < 100 tasks (#7348)

Fix floating point error with ndot printing, allow end stats on lower task numbers if multiple-choice tasks.

2 years agoUpdate and fix Vulkan soft_max and argsort implementations (#7237)
0cc4m [Sat, 18 May 2024 06:10:58 +0000 (08:10 +0200)]
Update and fix Vulkan soft_max and argsort implementations (#7237)

* Update and fix Vulkan softmax implementation

* Update and fix Vulkan argsort implementation

2 years agogithub-actions-labeler: initial commit (#7330)
Brian [Sat, 18 May 2024 06:04:23 +0000 (16:04 +1000)]
github-actions-labeler: initial commit (#7330)

* github-actions-labeler: initial commit [no ci]

* github actions: remove priority auto labeling [no ci]

2 years agoconvert : fix set_vocab_sentencepiece (#6866)
Georgi Gerganov [Sat, 18 May 2024 05:46:20 +0000 (08:46 +0300)]
convert : fix set_vocab_sentencepiece (#6866)

* convert : fix set_vocab_sentencepiece

* Update convert-hf-to-gguf.py

2 years agoggml : fix quants nans when all the group weights are very close to zero (#7313)
slaren [Sat, 18 May 2024 00:39:54 +0000 (02:39 +0200)]
ggml : fix quants nans when all the group weights are very close to zero (#7313)

2 years agocmake : fix typo in AMDGPU_TARGETS (#7356)
Engininja2 [Sat, 18 May 2024 00:39:25 +0000 (18:39 -0600)]
cmake : fix typo in AMDGPU_TARGETS (#7356)

2 years agoUnicode codepoint flags for custom regexs (#7245)
jaime-m-p [Fri, 17 May 2024 23:09:13 +0000 (01:09 +0200)]
Unicode codepoint flags for custom regexs (#7245)

* Replace CODEPOINT_TYPE_* with codepoint_flags
* Update and bugfix brute force random test
* Deterministic brute force random test
* Unicode normalization NFD
* Get rid of BOM

2 years agoCUDA: faster large batch FA without tensor cores (#7314)
Johannes Gäßler [Fri, 17 May 2024 16:54:52 +0000 (18:54 +0200)]
CUDA: faster large batch FA without tensor cores (#7314)

2 years agoROCm: use native CMake HIP support (#5966)
Gavin Zhao [Fri, 17 May 2024 15:03:03 +0000 (11:03 -0400)]
ROCm: use native CMake HIP support (#5966)

Supercedes #4024 and #4813.

CMake's native HIP support has become the
recommended way to add HIP code into a project (see
[here](https://rocm.docs.amd.com/en/docs-6.0.0/conceptual/cmake-packages.html#using-hip-in-cmake)).
This PR makes the following changes:

1. The environment variable `HIPCXX` or CMake option
`CMAKE_HIP_COMPILER` should be used to specify the HIP
compiler. Notably this shouldn't be `hipcc`, but ROCm's clang,
which usually resides in `$ROCM_PATH/llvm/bin/clang`. Previously
this was control by `CMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER`.
Note that since native CMake HIP support is not yet available on
Windows, on Windows we fall back to the old behavior.

2. CMake option `CMAKE_HIP_ARCHITECTURES` is used to control the
GPU architectures to build for. Previously this was controled by
`GPU_TARGETS`.

3. Updated the Nix recipe to account for these new changes.

4. The GPU targets to build against in the Nix recipe is now
consistent with the supported GPU targets in nixpkgs.

5. Added CI checks for HIP on both Linux and Windows. On Linux, we test
both the new and old behavior.

The most important part about this PR is the separation of the
HIP compiler and the C/C++ compiler. This allows users to choose
a different C/C++ compiler if desired, compared to the current
situation where when building for ROCm support, everything must be
compiled with ROCm's clang.

~~Makefile is unchanged. Please let me know if we want to be
consistent on variables' naming because Makefile still uses
`GPU_TARGETS` to control architectures to build for, but I feel
like setting `CMAKE_HIP_ARCHITECTURES` is a bit awkward when you're
calling `make`.~~ Makefile used `GPU_TARGETS` but the README says
to use `AMDGPU_TARGETS`. For consistency with CMake, all usage of
`GPU_TARGETS` in Makefile has been updated to `AMDGPU_TARGETS`.

Thanks to the suggestion of @jin-eld, to maintain backwards
compatibility (and not break too many downstream users' builds), if
`CMAKE_CXX_COMPILER` ends with `hipcc`, then we still compile using
the original behavior and emit a warning that recommends switching
to the new HIP support. Similarly, if `AMDGPU_TARGETS` is set but
`CMAKE_HIP_ARCHITECTURES` is not, then we forward `AMDGPU_TARGETS`
to `CMAKE_HIP_ARCHITECTURES` to ease the transition to the new
HIP support.

Signed-off-by: Gavin Zhao <redacted>
2 years agorpc : set SO_REUSEADDR for the server socket (#7320)
Radoslav Gerganov [Fri, 17 May 2024 14:25:44 +0000 (17:25 +0300)]
rpc : set SO_REUSEADDR for the server socket (#7320)

ref: #7293

2 years agoAdded a single test function script and fix debug-test.sh to be more robust (#7279)
Brian [Fri, 17 May 2024 12:40:14 +0000 (22:40 +1000)]
Added a single test function script and fix debug-test.sh to be more robust (#7279)

* run-single-test.sh: added a single test function script and fix debug-test.sh to be more robust

* debug-test.sh: combined execute and gdb test mode via -g flag

* debug-test.sh: refactor

* debug-test: refactor for clarity

* debug-test.sh: comment style changes

* debug-test.sh: fix gdb

2 years agopy : convert-hf-to-gguf-update improvements (#7340)
Aarni Koskela [Fri, 17 May 2024 12:11:45 +0000 (15:11 +0300)]
py : convert-hf-to-gguf-update improvements (#7340)

* convert-hf-to-gguf-update: automate updating

* convert-hf-to-gguf-update: improve download

* share requests session for performance
* create directories only when needed, don't skip downloads when empty directory encountered
* be more graceful about errors

2 years agollama : use n_embd_head_v when reshaping kqv (#7327)
fairydreaming [Fri, 17 May 2024 11:24:38 +0000 (13:24 +0200)]
llama : use n_embd_head_v when reshaping kqv (#7327)

* llama : use n_embd_head_v instead of n_embd_head_k when reshaping kqv

* llama : use n_embd_v_gqa and n_embd_head_v instead of n_embd_k_gqa and n_embd_head_k when making a view of cached value vectors.

---------

Co-authored-by: Stanisław Szymczyk <redacted>
2 years agotokenization: add warning for double BOS (#7332)
Johannes Gäßler [Fri, 17 May 2024 07:59:57 +0000 (09:59 +0200)]
tokenization: add warning for double BOS (#7332)

2 years agoggml-quants, llama : removed excess checks (#7274)
Herman Semenov [Fri, 17 May 2024 07:08:49 +0000 (07:08 +0000)]
ggml-quants, llama : removed excess checks (#7274)

2 years agoconvert : fix Qwen/Qwen-7b conversion (#7308)
amd-lalithnc [Fri, 17 May 2024 07:01:58 +0000 (12:31 +0530)]
convert : fix Qwen/Qwen-7b conversion (#7308)

2 years agoserver : add support for the RPC backend (#7305)
Radoslav Gerganov [Fri, 17 May 2024 07:00:17 +0000 (10:00 +0300)]
server : add support for the RPC backend (#7305)

ref: #7292

2 years agoggml : rewrite silu and softmax for cpu (#7154)
Justine Tunney [Fri, 17 May 2024 06:58:52 +0000 (02:58 -0400)]
ggml : rewrite silu and softmax for cpu (#7154)

This change upstreams llamafile's vectorized expf() functions. This lets
us compute softmax and silu more accurately than the short[65536] lookup
table that GGML previously used to make this operation go faster. We can
support aarch64 and sse2+ with the worst case rounding error of 2ulp. It
makes make -j8 tests && ./tests/test-backend-ops -o SOFT_MAX -b CPU perf
go 1.5x faster for SSE2+FMA, 1.9x faster for AVX2+FMA and 2.1x on AVX512

2 years ago[Server] Added --verbose option to README [no ci] (#7335)
Leon Knauer [Fri, 17 May 2024 00:11:03 +0000 (02:11 +0200)]
[Server] Added --verbose option to README [no ci] (#7335)

2 years agoRevert "server bench: fix bench not waiting for model load (#7284)" (#7334)
Pierrick Hymbert [Thu, 16 May 2024 18:43:45 +0000 (20:43 +0200)]
Revert "server bench: fix bench not waiting for model load (#7284)" (#7334)

This reverts commit 583fd6b000ec9ad1b465b5c98524f4a0ae388077.

2 years agorpc : get available mem for the CPU backend
Radoslav Gerganov [Wed, 15 May 2024 13:04:40 +0000 (16:04 +0300)]
rpc : get available mem for the CPU backend

This can be overridden with the -m command line option

ref: #7293

2 years agorpc : add command line arg for specifying backend memory
Radoslav Gerganov [Wed, 15 May 2024 12:29:07 +0000 (15:29 +0300)]
rpc : add command line arg for specifying backend memory

ref: #7293

2 years agoconvert : get general.name from model dir, not its parent (#5615)
Jared Van Bortel [Thu, 16 May 2024 06:15:23 +0000 (02:15 -0400)]
convert : get general.name from model dir, not its parent (#5615)

Co-authored-by: Brian <redacted>
2 years agogrammar, json, llama: replace push on emplace if it possible (#7273)
Herman Semenov [Thu, 16 May 2024 06:14:24 +0000 (06:14 +0000)]
grammar, json, llama: replace push on emplace if it possible (#7273)

2 years agodoc: add references to hugging face GGUF-my-repo quantisation web tool. (#7288)
Vaibhav Srivastav [Thu, 16 May 2024 05:38:43 +0000 (07:38 +0200)]
doc: add references to hugging face GGUF-my-repo quantisation web tool. (#7288)

* chore: add references to the quantisation space.

* fix grammer lol.

* Update README.md

Co-authored-by: Julien Chaumond <redacted>
* Update README.md

Co-authored-by: Georgi Gerganov <redacted>
---------

Co-authored-by: Julien Chaumond <redacted>
Co-authored-by: Georgi Gerganov <redacted>
2 years agoci: fix bin/Release path for windows-arm64 builds (#7317)
Max Krasnyansky [Thu, 16 May 2024 05:36:43 +0000 (22:36 -0700)]
ci: fix bin/Release path for windows-arm64 builds (#7317)

Switch to Ninja Multi-Config CMake generator to resurect bin/Release path
that broke artifact packaging in CI.

2 years agoAdd support for properly optimized Windows ARM64 builds with LLVM and MSVC (#7191)
Max Krasnyansky [Thu, 16 May 2024 02:47:36 +0000 (19:47 -0700)]
Add support for properly optimized Windows ARM64 builds with LLVM and MSVC (#7191)

* logging: add proper checks for clang to avoid errors and warnings with VA_ARGS

* build: add CMake Presets and toolchian files for Windows ARM64

* matmul-int8: enable matmul-int8 with MSVC and fix Clang warnings

* ci: add support for optimized Windows ARM64 builds with MSVC and LLVM

* matmul-int8: fixed typos in q8_0_q8_0 matmuls

Co-authored-by: Georgi Gerganov <redacted>
* matmul-int8: remove unnecessary casts in q8_0_q8_0

---------

Co-authored-by: Georgi Gerganov <redacted>
2 years agoreadme : remove stray double quote (#7310)
Daniel Bevenius [Wed, 15 May 2024 21:41:03 +0000 (23:41 +0200)]
readme : remove stray double quote (#7310)

Signed-off-by: Daniel Bevenius <redacted>
2 years agoggml : use dynamic thread scheduling for matrix multiplication (#6915)
kunnis [Wed, 15 May 2024 17:59:12 +0000 (12:59 -0500)]
ggml : use dynamic thread scheduling for matrix multiplication (#6915)

* Just reordering some structs.

* Adding in the calls to mm_pause

* Passing around the state

* Renaming and moving a bunch of variables around.

* Extracting the logic to it's own function.

* Moving some variable definitions into the chunk function.

* Moving some variables around

* moving src1_cont inside

* Moving row_size

* adding the current_chunk

* Reorg the code.

* Formatting to match the orig patch

* starting to setup the chunking variables

* Starting the buildup of the loop

* The yield shouldn't be necessary.

* adding the looping structure based on the chunk configuration.

* Add in the re-chunking code.

* Making it much more likely to rechunk.

* disable resizing if numa is enabled.

* Updating comments with what we've learned.

* Fix formatting

* Couple more formatting fixes.

* More style fixes.

* Fix Warnings

* Going with unused because there's conditional logic that needs it.

* Update ggml.c

* Update ggml.c

---------

2 years agoAvoid unnecessarily disabling CUDA graphs (#7302)
agray3 [Wed, 15 May 2024 13:44:49 +0000 (14:44 +0100)]
Avoid unnecessarily disabling CUDA graphs (#7302)

As discussed in PR #6766, CUDA graphs were being disabled in the presence of long prompts.
This fixes the issue by avoiding the consective update counter from incrementing unnecessarily
for tokens in which cuda graphs are disabled due to batch size > 1.

2 years agoggml : tag ggml_tensor::backend as deprecated (#7290)
slaren [Wed, 15 May 2024 13:08:48 +0000 (15:08 +0200)]
ggml : tag ggml_tensor::backend as deprecated (#7290)

2 years agoAdd missing " (#7303)
AidanBeltonS [Wed, 15 May 2024 12:26:30 +0000 (13:26 +0100)]
Add missing " (#7303)

2 years agoembedding : free the batch after execution (#7297)
dm4 [Wed, 15 May 2024 12:01:12 +0000 (20:01 +0800)]
embedding : free the batch after execution (#7297)

2 years agosync : ggml
Georgi Gerganov [Wed, 15 May 2024 10:23:41 +0000 (13:23 +0300)]
sync : ggml

2 years agoggml : add `ggml_upscale_ext` (ggml/814)
John Balis [Wed, 15 May 2024 08:52:33 +0000 (03:52 -0500)]
ggml : add `ggml_upscale_ext` (ggml/814)

* initial commit with CPU implementation of upscale to shape and test, cuda implementation next

* experimental commit to see if dst shape is correct

* test version

* test

* removed unnecessary params

* refactor

* fixed tests

* ggml : metal impl + cleanup + sycl dev warnings

* patched ggml_upscale cuda op to handle non-contiguous tensors, added test for non-contiguous behavior

* metal : fix upsacle op to support nb00 + style

---------

Co-authored-by: Georgi Gerganov <redacted>
2 years agoserver bench: fix bench not waiting for model load (#7284)
Johannes Gäßler [Wed, 15 May 2024 06:44:16 +0000 (08:44 +0200)]
server bench: fix bench not waiting for model load (#7284)

2 years agoscript : sync ggml-rpc
Georgi Gerganov [Tue, 14 May 2024 16:14:38 +0000 (19:14 +0300)]
script : sync ggml-rpc

2 years agometal : support FA without mask + add asserts (#7278)
Georgi Gerganov [Tue, 14 May 2024 16:09:30 +0000 (19:09 +0300)]
metal : support FA without mask + add asserts (#7278)

* ggml : fa without mask + add asserts

ggml-ci

* metal : support non-contiguous KV

ggml-ci

2 years agosync : ggml
Georgi Gerganov [Tue, 14 May 2024 12:33:16 +0000 (15:33 +0300)]
sync : ggml

ggml-ci

2 years agometal : tune soft_max number of threads (whisper/0)
Georgi Gerganov [Mon, 13 May 2024 08:01:07 +0000 (11:01 +0300)]
metal : tune soft_max number of threads (whisper/0)

2 years agoggml : try fix ppc64 (whisper/0)
Georgi Gerganov [Sun, 12 May 2024 17:36:31 +0000 (20:36 +0300)]
ggml : try fix ppc64 (whisper/0)

2 years agoggml : expose SSE3 and SSSE3 for MSVC when AVX is available (whisper/2128)
Przemysław Pawełczyk [Wed, 8 May 2024 15:33:43 +0000 (17:33 +0200)]
ggml : expose SSE3 and SSSE3 for MSVC when AVX is available (whisper/2128)

2 years agoggml : optimize for ppc64le using VSX intrinsics (ggml/784)
Hong Bo PENG [Sun, 12 May 2024 09:17:18 +0000 (17:17 +0800)]
ggml : optimize for ppc64le using VSX intrinsics (ggml/784)

* optimize for ppc64le using VSX intrinsics

* 1. code clean up by removing comments about overflow concern.

2. fix typo in suffix of scaling.

* Continue to fix typo in suffix of scaling for QK_K <> 256

---------

Co-authored-by: Georgi Gerganov <redacted>
2 years agoserver: free sampling contexts on exit (#7264)
Steve Grubb [Tue, 14 May 2024 14:11:24 +0000 (10:11 -0400)]
server: free sampling contexts on exit (#7264)

* server: free sampling contexts on exit

This cleans up last leak found by the address sanitizer.

* fix whitespace

* fix whitespace

2 years agoRevert "move ndk code to a new library (#6951)" (#7282)
Brian [Tue, 14 May 2024 13:10:39 +0000 (23:10 +1000)]
Revert "move ndk code to a new library (#6951)" (#7282)

This reverts commit efc8f767c8c8c749a245dd96ad4e2f37c164b54c.

2 years agoggml : add RPC backend (#6829)
Radoslav Gerganov [Tue, 14 May 2024 11:27:19 +0000 (14:27 +0300)]
ggml : add RPC backend (#6829)

* ggml : add RPC backend

The RPC backend proxies all operations to a remote server which runs a
regular backend (CPU, CUDA, Metal, etc).

* set TCP_NODELAY

* add CI workflows

* Address review comments

* fix warning

* implement llama_max_devices() for RPC

* Address review comments

* Address review comments

* wrap sockfd into a struct

* implement get_alignment and get_max_size

* add get_device_memory

* fix warning

* win32 support

* add README

* readme : trim trailing whitespace

* Address review comments

* win32 fix

* Address review comments

* fix compile warnings on macos

2 years agollama : disable pipeline parallelism with nkvo (#7265)
slaren [Tue, 14 May 2024 07:33:42 +0000 (09:33 +0200)]
llama : disable pipeline parallelism with nkvo (#7265)

2 years agomove ndk code to a new library (#6951)
Elton Kola [Tue, 14 May 2024 07:30:30 +0000 (03:30 -0400)]
move ndk code to a new library (#6951)

2 years agoAdd left recursion check: quit early instead of going into an infinite loop (#7083)
Haggai Nuchi [Tue, 14 May 2024 05:25:56 +0000 (22:25 -0700)]
Add left recursion check: quit early instead of going into an infinite loop (#7083)

* Add left recursion check: quit early instead of going into an infinite loop

* Remove custom enum, rename left recursion check and move to "grammar internal" section, add handling for edge case where a leftmost nonterminal may be empty

* Remove unnecessary declaration

2 years agodocs: Fix typo and update description for --embeddings flag (#7026)
Ryuei [Tue, 14 May 2024 05:20:47 +0000 (14:20 +0900)]
docs: Fix typo and update description for --embeddings flag (#7026)

- Change '--embedding' to '--embeddings' in the README
- Update the description to match the latest --help output
- Added a caution about defining physical batch size

2 years agoconvert-hf : support direct Q8_0 conversion (#7234)
compilade [Mon, 13 May 2024 18:10:51 +0000 (14:10 -0400)]
convert-hf : support direct Q8_0 conversion (#7234)

* convert-hf : support q8_0 conversion

* convert-hf : add missing ftype

This was messing with the checksums otherwise.

* convert-hf : add missing ftype to Baichuan and Xverse

I didn't notice these on my first pass.

2 years agollama : less KV padding when FA is off (#7257)
Georgi Gerganov [Mon, 13 May 2024 14:15:15 +0000 (17:15 +0300)]
llama : less KV padding when FA is off (#7257)

ggml-ci

2 years agollava-cli: fix base64 prompt (#7248)
k.h.lai [Mon, 13 May 2024 14:02:36 +0000 (22:02 +0800)]
llava-cli: fix base64 prompt (#7248)

2 years agoperplexity: add BF16 vs. FP16 results (#7150)
Johannes Gäßler [Mon, 13 May 2024 11:03:27 +0000 (13:03 +0200)]
perplexity: add BF16 vs. FP16 results (#7150)

2 years ago[SYCL] rm wait() (#7233)
Neo Zhang [Mon, 13 May 2024 10:11:26 +0000 (18:11 +0800)]
[SYCL] rm wait() (#7233)

2 years agollama : rename jina tokenizers to v2 (#7249)
Joan Fontanals [Mon, 13 May 2024 08:35:14 +0000 (10:35 +0200)]
llama : rename jina tokenizers to v2 (#7249)

* refactor: rename jina tokenizers to v2

* refactor: keep refactoring non-breaking

2 years agoconvert.py: Outfile default name change and additional metadata support (#4858)
Brian [Mon, 13 May 2024 02:56:47 +0000 (12:56 +1000)]
convert.py: Outfile default name change and additional metadata support (#4858)

* convert.py: Outfile default name change and additional metadata support

* convert.py: don't stringify Metadata load method output

* convert.py: typo fix

* convert.py: fix metadata format to sync with LLM_KV_NAMES in llama.cpp

2 years agochange default temperature of OAI compat API from 0 to 1 (#7226)
Benjamin Findley [Mon, 13 May 2024 02:40:08 +0000 (19:40 -0700)]
change default temperature of OAI compat API from 0 to 1 (#7226)

* change default temperature of OAI compat API from 0 to 1

* make tests explicitly send temperature to OAI API

2 years ago[SYCL] Add oneapi runtime dll files to win release package (#7241)
Neo Zhang [Mon, 13 May 2024 00:04:29 +0000 (08:04 +0800)]
[SYCL] Add oneapi runtime dll files to win release package (#7241)

* add oneapi running time dlls to release package

* fix path

* fix path

* fix path

* fix path

* fix path

---------

Co-authored-by: Zhang <redacted>
2 years ago[SYCL] update CI with oneapi 2024.1 (#7235)
Neo Zhang [Mon, 13 May 2024 00:02:55 +0000 (08:02 +0800)]
[SYCL] update CI with oneapi 2024.1 (#7235)

Co-authored-by: Zhang <redacted>
2 years agoCUDA: add FP32 FlashAttention vector kernel (#7188)
Johannes Gäßler [Sun, 12 May 2024 17:40:45 +0000 (19:40 +0200)]
CUDA: add FP32 FlashAttention vector kernel (#7188)

* CUDA: add FP32 FlashAttention vector kernel

* fixup! CUDA: add FP32 FlashAttention vector kernel

* fixup! fixup! CUDA: add FP32 FlashAttention vector kernel

* fixup! fixup! fixup! CUDA: add FP32 FlashAttention vector kernel

2 years agocmake : fix version cmp (#7227)
Georgi Gerganov [Sun, 12 May 2024 15:30:23 +0000 (18:30 +0300)]
cmake : fix version cmp (#7227)

2 years agoremove convert-lora-to-ggml.py (#7204)
slaren [Sun, 12 May 2024 00:29:33 +0000 (02:29 +0200)]
remove convert-lora-to-ggml.py (#7204)

2 years agometal : fix warnings (skipme) (#0)
Georgi Gerganov [Sat, 11 May 2024 18:36:20 +0000 (21:36 +0300)]
metal : fix warnings (skipme) (#0)

2 years agosync : ggml
Georgi Gerganov [Sat, 11 May 2024 18:35:05 +0000 (21:35 +0300)]
sync : ggml

2 years agometal : fix indent (ggml/0)
Georgi Gerganov [Sat, 11 May 2024 13:57:53 +0000 (16:57 +0300)]
metal : fix indent (ggml/0)

2 years agoggml : resolve merge (ggml/0)
Georgi Gerganov [Sat, 11 May 2024 13:25:50 +0000 (16:25 +0300)]
ggml : resolve merge (ggml/0)

ggml-ci

2 years agoScripting & documenting debugging one test without anything else in the loop. (#7096)
Josh Ramer [Sat, 11 May 2024 17:26:35 +0000 (12:26 -0500)]
Scripting & documenting debugging one test without anything else in the loop. (#7096)

* A little documentation that shares my quick tips for working in the repository.

* Update startup-testing-debugging.md

* script that shows a menu of tests to pick from & run the debugger on

* debug-test.sh: Refactor CLI help message

* debug-test.sh: documentation update

* debug-test.sh: CLI Help output corrections

* debug-test.sh: minor doc fix

---------

authored-by: Josh Ramer <redacted>
Assisted-by: brian khuu <redacted>
2 years agofix system prompt handling (#7153)
Xuan Son Nguyen [Sat, 11 May 2024 15:28:10 +0000 (17:28 +0200)]
fix system prompt handling (#7153)

2 years agoconvert-hf : support bfloat16 conversion (#7158)
compilade [Sat, 11 May 2024 15:06:26 +0000 (11:06 -0400)]
convert-hf : support bfloat16 conversion (#7158)

* convert-hf : support bfloat16 conversion

* gguf-py : flake8 fixes

* convert-hf : add missing space after comma

* convert-hf : get bit-exact same output as ./quantize

The quantization version was missing.

* convert-hf : don't round bf16 NANs

* convert-hf : save some memory with np.int16 intermediate bf16 weights

* convert-hf : more closely match llama.cpp with which weights to keep in f32

* convert-hf : add --outtype auto-f16

A reason for this to exist is for model quantizers who want an initial
GGUF with the most fidelity to the original model while still using
a 16-bit float type instead of 32-bit floats.

* convert-hf : remove a semicolon because flake8 doesn't like it

It's a reflex from when programming in C/C++, I guess.

* convert-hf : support outtype templating in outfile name

* convert-hf : rename --outtype auto-f16 to --outtype auto

2 years agosync : ggml
Georgi Gerganov [Sat, 11 May 2024 09:02:39 +0000 (12:02 +0300)]
sync : ggml

ggml-ci

2 years agofeat: implemented sigmoid function (ggml/806)
Justina Cho [Wed, 1 May 2024 21:44:26 +0000 (14:44 -0700)]
feat: implemented sigmoid function (ggml/806)

* added sigmoid function

* implemented metal kernel for sigmoid

* implemented cuda kernel for sigmoid

* added sigmoid unary op and incremented count

2 years agobuild: fix and ignore msvc warnings (ggml/805)
Borislav Stanimirov [Thu, 25 Apr 2024 14:24:07 +0000 (17:24 +0300)]
build: fix and ignore msvc warnings (ggml/805)

2 years agoconvert : skip unaccessible HF repos (#7210)
CrispStrobe [Sat, 11 May 2024 08:18:35 +0000 (10:18 +0200)]
convert : skip unaccessible HF repos (#7210)

2 years agoserver : free llama_batch on exit (#7212)
Steve Grubb [Sat, 11 May 2024 08:13:02 +0000 (04:13 -0400)]
server : free llama_batch on exit (#7212)

* [server] Cleanup a memory leak on exit

There are a couple memory leaks on exit of the server. This hides others.
After cleaning this up, you can see leaks on slots. But that is another
patch to be sent after this.

* make tab into spaces

2 years agollama : lookup word in vocab before doing BPE merges (#7193)
Haoxiang Fei [Sat, 11 May 2024 08:12:06 +0000 (16:12 +0800)]
llama : lookup word in vocab before doing BPE merges (#7193)

* fix: llama-3 ignore_merges

* test: add test for llama-3 bpe ignore_merges

* fix: set ignore_merges only for llama-3

* fix: test-tokenizer-1-bpe --ingore-merges detection

* fix: copy to fix fallthrough

* fix: change ignore_merges to bool

* fix: add ignore merges tests to cmake

* llama : alternative merge ignore logic

---------

Co-authored-by: Haoxiang Fei <redacted>
Co-authored-by: Georgi Gerganov <redacted>
2 years agoserver: fix reported top tokens for temperature 0 (#7203)
Johannes Gäßler [Sat, 11 May 2024 08:11:28 +0000 (10:11 +0200)]
server: fix reported top tokens for temperature 0 (#7203)

2 years agollama : add Jina Embeddings architecture (#6826)
Joan Fontanals [Sat, 11 May 2024 07:46:09 +0000 (09:46 +0200)]
llama : add Jina Embeddings architecture (#6826)

* feat: first things to do

* feat: create tensors for Jina architecture

* fix: use other tensors

* feat: embedding gets results

* fix: fix usage of ALIBI

* fix: clean prints

* fix: do some cleanup unused vars

* fix: revert changes to Makefile and CMakeLists

* fix: revert some changes

* fix: fix small detail

* fix: fix convert formatting

* fix: fix linting and editor

* feat: set proper vocab settings

* fix: JinaBertForMaskedLM registration

* feat: support q_normalization and k_normalization in Jina arch

* feat: handle gpt2 tokenizer with Jina architecture

* feat: example comments in embedding

* feat: rename Jina Bert to Jina Bert V2

* fix: add some changes as per review

* feat: proper KQ_pos for Jina embeddings

* feat: add capacity to load models ES and DE for Spanish

* llama : fix pre-tokenizers

* ggml : full ALiBi support

* ggml : update ggml_soft_max_ext() CUDA, SYCL

* ggml : ggml_flash_attn_ext() support ALiBi (CPU)

* ggml : ggml_flash_attn_ext() support ALiBi (Metal)

* ggml : fix warning

* ggml : ggml_flash_attn_ext() support ALiBi (CUDA)

ggml-ci

* minor : clean-up

* embedding : add warning about missing SEP

---------

Co-authored-by: Georgi Gerganov <redacted>
2 years agoggml : full ALiBi support (#7192)
Georgi Gerganov [Sat, 11 May 2024 07:32:41 +0000 (10:32 +0300)]
ggml : full ALiBi support (#7192)

* ggml : full ALiBi support

* ggml : update ggml_soft_max_ext() CUDA, SYCL

* ggml : ggml_flash_attn_ext() support ALiBi (CPU)

* ggml : ggml_flash_attn_ext() support ALiBi (Metal)

* ggml : fix warning

* ggml : ggml_flash_attn_ext() support ALiBi (CUDA)

ggml-ci

* ggml : fix assert message

* vulkan : add dev notes

* ggml : require mask when using ALiBi

ggml-ci

* convert : fix convert for refact models

2 years agollama-bench : add pp+tg test type (#7199)
slaren [Fri, 10 May 2024 16:03:54 +0000 (18:03 +0200)]
llama-bench : add pp+tg test type (#7199)

2 years agometal : fix flash attention kernel requirements (#7169)
Georgi Gerganov [Fri, 10 May 2024 15:20:10 +0000 (18:20 +0300)]
metal : fix flash attention kernel requirements (#7169)

* metal : fix flash attention kernel requirements

ggml-ci

* metal : fix ggml_metal_supports_op

ggml-ci

2 years agoconvert : print "ignore_merges" field
Georgi Gerganov [Fri, 10 May 2024 14:53:04 +0000 (17:53 +0300)]
convert : print "ignore_merges" field

2 years agollama : use n_vocab to differentiate between mistral 7B and llama3 8B (#7200)
slaren [Fri, 10 May 2024 12:28:01 +0000 (14:28 +0200)]
llama : use n_vocab to differentiate between mistral 7B and llama3 8B (#7200)

2 years agoFix memory bug in grammar parser (#7194)
Justine Tunney [Fri, 10 May 2024 11:01:08 +0000 (07:01 -0400)]
Fix memory bug in grammar parser (#7194)

The llama.cpp grammar parser had a bug where forgetting to add a closing
quotation mark to strings would cause parsing to crash. Anyone running a
server on a public endpoint is advised to upgrade. To reproduce this bug

    ./llamafile -m foo.gguf -p bar --grammar 'root::="'

Credit for discovering and reporting this issue goes to Eclypsium
Security Researcher Richard Johnson <redacted>.

2 years agoMain+: optionally allow special tokens from user in interactive mode (#7097)
HanishKVC [Fri, 10 May 2024 10:21:58 +0000 (15:51 +0530)]
Main+: optionally allow special tokens from user in interactive mode (#7097)

@hanishkvc added a new `--interactive-specials` flag which would allow for inserting special tokens from user side into the embedding stream.

2 years agollava : fix moondream support (#7163)
Andrei [Fri, 10 May 2024 06:41:10 +0000 (02:41 -0400)]
llava : fix moondream support (#7163)

* Revert "Revert "llava : add support for moondream vision language model (#6899)""

This reverts commit 9da243b36ac0b9d609adfaaa4c8f1cc8c592f737.

* Fix num_positions and embeddings initialization

2 years agoMinor arithmetic improvement to mmvq wrapper kernel (#7172)
Ouadie EL FAROUKI [Fri, 10 May 2024 00:32:15 +0000 (01:32 +0100)]
Minor arithmetic improvement to mmvq wrapper kernel (#7172)

2 years agoeval-callback : fix conversion to float (#7184)
slaren [Thu, 9 May 2024 23:04:12 +0000 (01:04 +0200)]
eval-callback : fix conversion to float (#7184)

2 years agoVulkan Bugfixes and Improvements (#7084)
0cc4m [Thu, 9 May 2024 18:39:54 +0000 (20:39 +0200)]
Vulkan Bugfixes and Improvements (#7084)

* Modify mat mat mul shader for mul_mat_id, modify mat vec mul shaders for single call batch operation

* Further work towards MoE, disabled for now

* Disable MoE code (not ready yet), fix a number of bugs in shaders and Vulkan code

* Add softmax with f16 mask and pos buffer support

* Disable mul_mat_id shaders for now

* Fix flake8

* Fix validation errors caused by empty buffers on larger batch sizes

2 years agoreadme : add scheduled server workflow status badge
Georgi Gerganov [Thu, 9 May 2024 13:40:42 +0000 (16:40 +0300)]
readme : add scheduled server workflow status badge

2 years agoreadme : add app (#6371)
l3utterfly [Thu, 9 May 2024 13:32:40 +0000 (22:32 +0900)]
readme : add app (#6371)

* added Layla to supported UIs

* Update README.md

2 years agollama3 custom regex split (#6965)
jaime-m-p [Thu, 9 May 2024 13:30:44 +0000 (15:30 +0200)]
llama3 custom regex split (#6965)

* merged the changes from deepseeker models to main branch

* Moved regex patterns to unicode.cpp and updated unicode.h

* Moved header files

* Resolved issues

* added and refactored unicode_regex_split and related functions

* Updated/merged the deepseek coder pr

* Refactored code

* Adding unicode regex mappings

* Adding unicode regex function

* Added needed functionality, testing remains

* Fixed issues

* Fixed issue with gpt2 regex custom preprocessor

* unicode : fix? unicode_wstring_to_utf8

* lint : fix whitespaces

* tests : add tokenizer tests for numbers

* unicode : remove redundant headers

* tests : remove and rename tokenizer test scripts

* tests : add sample usage

* gguf-py : reader prints warnings on duplicate keys

* llama : towards llama3 tokenization support (wip)

* unicode : shot in the dark to fix tests on Windows

* unicode : first try custom implementations

* convert : add "tokenizer.ggml.pre" GGUF KV (wip)

* llama : use new pre-tokenizer type

* convert : fix pre-tokenizer type writing

* lint : fix

* make : add test-tokenizer-0-llama-v3

* wip

* models : add llama v3 vocab file

* llama : adapt punctuation regex + add llama 3 regex

* minor

* unicode : set bomb

* unicode : set bomb

* unicode : always use std::wregex

* unicode : support \p{N}, \p{L} and \p{P} natively

* unicode : try fix windows

* unicode : category support via std::regex

* unicode : clean-up

* unicode : simplify

* llama3 custom regex split

* convert : add convert-hf-to-gguf-update.py

ggml-ci

* lint : update

* convert : add falcon

ggml-ci

* unicode : normalize signatures

* lint : fix

* lint : fix

* convert : remove unused functions

* convert : add comments

* convert : exercise contractions

ggml-ci

* Using char32_t for codepoints

* lint : fix

* already exists unicode_tolower()

* Typing

* Restore BOM

* cmake : refactor test targets

* tests : refactor vocab tests

ggml-ci

* tests : add more vocabs and tests

ggml-ci

* unicode : cleanup

* scripts : ignore new update script in check-requirements.sh

* Fix merge

* models : add phi-3, mpt, gpt-2, starcoder

* tests : disable obsolete

ggml-ci

* tests : use faster bpe test

ggml-ci

* llama : more prominent warning for old BPE models

* tests : disable test-tokenizer-1-bpe due to slowness

ggml-ci

* Move unused variable value

* GPT2 custom regex split

* Add alternative regex for custom aplit llama3

Co-authored-by: Georgi Gerganov <redacted>
* Style

* Add bruteforce random tests for token encoding

* wip: fixing unicode codepoint ranges

* Fix merge

* Unicode tables: separator, lowercase, uppercase and whitespace

* llama3 custom regex split: fix \s

* Restore BOM

* Style

* wip: generate NDF table

* Ignore special tokens for testing

* Clean gen-unicode-data.py

* Refactor random tokenizer test

* lint : fix

* tests : add fail test for llama-bpe

---------

Co-authored-by: Jaggzh <redacted>
Co-authored-by: Kazim Abrar Mahi <redacted>
Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: jaime-m-p <>
2 years agoCUDA: generalize FP16 fattn vec kernel (#7061)
Johannes Gäßler [Thu, 9 May 2024 12:32:02 +0000 (14:32 +0200)]
CUDA: generalize FP16 fattn vec kernel (#7061)

* CUDA: generalize FP16 fattn vec kernel

* disable unsupported head sizes for AMD in test

* try AMD fix

* fix batch size 2-8

* partially revert changes

2 years agoAdd warning if token is invalid (#7173)
Galunid [Thu, 9 May 2024 12:13:05 +0000 (14:13 +0200)]
Add warning if token is invalid (#7173)

2 years agollama : update llama_timings.n_p_eval setting (#7160)
Daniel Bevenius [Thu, 9 May 2024 11:03:29 +0000 (13:03 +0200)]
llama : update llama_timings.n_p_eval setting (#7160)

This commit changes the value assigned to llama_timings.n_p_eval when
ctx->n_p_eval is 0 to be 1 instead of 1 which is the current value.

The motivation for this change is that if session caching is enabled,
for example using the `--prompt-cache main-session.txt` command line
argument for the main example, and if the same prompt is used then on
subsequent runs, the prompt tokens will not actually be passed to
llama_decode, and n_p_eval will not be updated by llama_synchoronize.

But the value of n_p_eval will be set 1 by llama_get_timings because
ctx->n_p_eval will be 0. This could be interpreted as 1 token was
evaluated for the prompt which could be misleading for applications
using this value.

Signed-off-by: Daniel Bevenius <redacted>
2 years agogguf-py : add special token modification capability (#7166)
Sigbjørn Skjæret [Thu, 9 May 2024 10:56:00 +0000 (12:56 +0200)]
gguf-py : add special token modification capability (#7166)

* Add special token modification capability

To be able to fix/amend special tokens in a GGUF let's add two new arguments:
* `--special-token <name> <value>` where `<name>` can be bos, eos, prefix, middle, etc. while `<value>` is the token value, f.ex. `"<|fim▁begin|>"`
* `--special-token-by-id <name> <id>` where `<id>` is the ID of the token, f.ex. 32006

So, in order to f.ex. add fill-in-middle tokens to a GGUF you would do the following:
```bash
python3 gguf-new-metadata.py input.gguf output.gguf --special-token prefix "<|fim▁begin|>" --special-token middle "<|fim▁hole|>" --special-token suffix "<|fim▁end|>"
```

* improve help text

* flake--

* fix multiple tokens warning

* make script executable

* switch to namedtuple, no need to dataclass

* typing++

* add progress bar

* Add special token modification capability

To be able to fix/amend special tokens in a GGUF let's add two new arguments:
* `--special-token <name> <value>` where `<name>` can be bos, eos, prefix, middle, etc. while `<value>` is the token value, f.ex. `"<|fim▁begin|>"`
* `--special-token-by-id <name> <id>` where `<id>` is the ID of the token, f.ex. 32006

So, in order to f.ex. add fill-in-middle tokens to a GGUF you would do the following:
```bash
gguf-new-metadata.py input.gguf output.gguf --special-token prefix "<|fim▁begin|>" --special-token middle "<|fim▁end|>" --special-token suffix "<|fim▁hole|>"
```
(yes, fim_end is the `middle` token, because completion is a `prefix`/`suffix`/`middle` sequence (where `middle` is unfilled))
or
```bash
gguf-new-metadata.py input.gguf output.gguf --special-token prefix "<fim_prefix>" --special-token middle "<fim_middle>" --special-token suffix "<fim_suffix>"
```
etc...

NB: The tokens have to exist already, trying to add non-existent token name/IDs will be ignored (with a warning), while non-existent values will fail (with an error).

* improve help text

* flake--

* fix multiple tokens warning

* make script executable

* switch to namedtuple, no need to dataclass

* typing++

* add progress bar

* fail on invalid token id