]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/log
pkg/ggml/sources/llama.cpp
13 months 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

13 months 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)

13 months 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>
13 months 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

13 months agoopencl : alignment size converted from bits to bytes (#7090)
Albert Jin [Thu, 9 May 2024 09:34:37 +0000 (17:34 +0800)]
opencl : alignment size converted from bits to bytes (#7090)

* opencl alignment size should be converted from bits to bytes

Reference: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#CL_DEVICE_MEM_BASE_ADDR_ALIGN

> Alignment requirement (in bits) for sub-buffer offsets.

* Update ggml-opencl.cpp for readability using division instead of shift

Co-authored-by: Jared Van Bortel <redacted>
---------

Co-authored-by: Jared Van Bortel <redacted>
13 months agoTypoFix (#7162)
Ahmet Zeer [Thu, 9 May 2024 08:16:45 +0000 (11:16 +0300)]
TypoFix (#7162)

13 months agocmake : fix typo (#7151)
Jared Van Bortel [Wed, 8 May 2024 23:55:32 +0000 (19:55 -0400)]
cmake : fix typo (#7151)

13 months agoconvert-hf : save memory with lazy evaluation (#7075)
compilade [Wed, 8 May 2024 22:16:38 +0000 (18:16 -0400)]
convert-hf : save memory with lazy evaluation (#7075)

* convert-hf : begin refactoring write_tensor

* convert : upgrade to sentencepiece v0.2.0

* convert-hf : remove unused n_dims in extra_*_tensors

* convert-hf : simplify MoE weights stacking

* convert-hf : flake8 linter doesn't like semicolons

* convert-hf : allow unusual model part names

For example, loading `model-00001-of-00001.safetensors` now works.

* convert-hf : fix stacking MoE expert tensors

`torch.stack` and `torch.cat` don't do the same thing.

* convert-hf : fix Mamba conversion

Tested to work even with a SentencePiece-based tokenizer.

* convert : use a string for the SentencePiece tokenizer path

* convert-hf : display tensor shape

* convert-hf : convert norms to f32 by default

* convert-hf : sort model part names

`os.listdir` is said to list files in arbitrary order.
Sorting the file names should let "model-00009-of-00042.safetensors"
be loaded before "model-00010-of-00042.safetensors".

* convert-hf : use an ABC for Model again

It seems Protocol can't be used as a statically type-checked ABC,
because its subclasses also can't be instantiated. (why did it seem to work?)

At least there's still a way to throw an error when forgetting to define
the `model_arch` property of any registered Model subclasses.

* convert-hf : use a plain class for Model, and forbid direct instantiation

There are no abstract methods used anyway,
so using ABC isn't really necessary.

* convert-hf : more consistent formatting of cmdline args

* convert-hf : align the message logged for converted tensors

* convert-hf : fix Refact conversion

* convert-hf : save memory with lazy evaluation

* convert-hf : flake8 doesn't like lowercase L as a variable name

* convert-hf : remove einops requirement for InternLM2

* convert-hf : faster model parts loading

Instead of pre-loading them all into a dict, iterate on the tensors
in the model parts progressively as needed in Model.write_tensors

Conversion for some architectures relies on checking for the presence
of specific tensor names, so for multi-part models, the weight map is read
from the relevant json file to quickly get these names up-front.

* convert-hf : minor changes for consistency

* gguf-py : add tqdm as a dependency

It's small, and used for a progress bar
in GGUFWriter.write_tensors_to_file

13 months agoIntroduction of CUDA Graphs to LLama.cpp (#6766)
agray3 [Wed, 8 May 2024 20:55:49 +0000 (21:55 +0100)]
Introduction of CUDA Graphs to LLama.cpp (#6766)

* DRAFT: Introduction of CUDA Graphs to LLama.cpp

* FIx issues raised in comments

* Tidied to now only use CUDA runtime (not mixed with driver calls)

* disable for multi-gpu and batch size > 1

* Disable CUDA graphs for old GPU arch and with env var

* added missing CUDA_CHECKs

* Addressed comments

* further addressed comments

* limit to GGML_ALLOW_CUDA_GRAPHS defined in llama.cpp cmake

* Added more comprehensive graph node checking

* With mechanism to fall back if graph capture fails

* Revert "With mechanism to fall back if graph capture fails"

This reverts commit eb9f15fb6fcb81384f732c4601a5b25c016a5143.

* Fall back if graph capture fails and address other comments

* - renamed GGML_ALLOW_CUDA_GRAPHS to GGML_CUDA_USE_GRAPHS

- rename env variable to disable CUDA graphs to GGML_CUDA_DISABLE_GRAPHS

- updated Makefile build to enable CUDA graphs

- removed graph capture failure checking in ggml_cuda_error
  using a global variable to track this is not thread safe, but I am also not safistied with checking an error by string
  if this is necessary to workaround some issues with graph capture with eg. cuBLAS, we can pass the ggml_backend_cuda_context to the error checking macro and store the result in the context

- fixed several resource leaks

- fixed issue with zero node graphs

- changed fixed size arrays to vectors

- removed the count of number of evaluations before start capturing, and instead changed the capture mode to relaxed

- removed the check for multiple devices so that it is still possible to use a single device, instead checks for split buffers to disable cuda graphs with -sm row

- changed the op for checking batch size to GGML_OP_ADD, should be more reliable than GGML_OP_SOFT_MAX

- code style fixes

- things to look into
  - VRAM usage of the cudaGraphExec_t, if it is significant we may need to make it optional
  - possibility of using cudaStreamBeginCaptureToGraph to keep track of which ggml graph nodes correspond to which cuda graph nodes

* fix build without cuda graphs

* remove outdated comment

* replace minimum cc value with a constant

---------

Co-authored-by: slaren <redacted>
13 months agoJSON: [key] -> .at(key), assert() -> GGML_ASSERT (#7143)
Johannes Gäßler [Wed, 8 May 2024 19:53:08 +0000 (21:53 +0200)]
JSON: [key] -> .at(key), assert() -> GGML_ASSERT (#7143)

13 months agoRevert "llava : add support for moondream vision language model (#6899)"
Georgi Gerganov [Wed, 8 May 2024 19:14:39 +0000 (22:14 +0300)]
Revert "llava : add support for moondream vision language model (#6899)"

This reverts commit 46e12c4692a37bdd31a0432fc5153d7d22bc7f72.

13 months agoserver : add themes + favicon (#6848)
JohnnyB [Wed, 8 May 2024 19:12:06 +0000 (20:12 +0100)]
server : add themes + favicon (#6848)

* Added themes support with two sample themes and a favicon.

* Newline

* Newline

* Newline

* Trailing whitespace

* Increased opacity for contrast

* Increase opacity.

Check actions cancelled for some other priority job and I can't seem to manually re-run them, so MOAR OPACITY

* Opacity action trigger.

Trying to re-trigger the cancelled action.

* One more opacity adjustment

This Actions pipeline is failing for random issues.

* Delete examples/server/themes/buttons_top/completion.js

This will be served from the static string built-in to server.

* Delete examples/server/themes/buttons_top/index.js

This will be served from the static string built-in to server.

* Delete examples/server/themes/wild/completion.js

This will be served from the static string built-in to server.

* Delete examples/server/themes/buttons_top/json-schema-to-grammar.mjs

This will be served from the static string built-in to server.

* Delete examples/server/themes/wild/index.js

This will be served from the static string built-in to server.

* Delete examples/server/themes/wild/json-schema-to-grammar.mjs

This will be served from the static string built-in to server.

* Replaced underscore.

13 months agometal : use `vm_allocate` instead of `posix_memalign` on macOS (#7078)
Gilad S [Wed, 8 May 2024 19:08:10 +0000 (22:08 +0300)]
metal : use `vm_allocate` instead of `posix_memalign` on macOS (#7078)

* fix: use `malloc` instead of `posix_memalign` in `ggml-metal.m` to make it not crash Electron proccesses

* fix: typo

* fix: use `vm_allocate` instead of `posix_memalign`

* fix: don't call `newBufferWithBytesNoCopy` with `NULL` when `ggml_metal_host_malloc` returns `NULL`

* fix: use `vm_allocate` only on macOS

13 months agomain : add --conversation / -cnv flag (#7108)
Dawid Potocki [Wed, 8 May 2024 14:32:32 +0000 (02:32 +1200)]
main : add --conversation / -cnv flag (#7108)

13 months agosgemm : AVX Q4_0 and Q8_0 (#6891)
Eve [Wed, 8 May 2024 14:29:23 +0000 (14:29 +0000)]
sgemm : AVX Q4_0 and Q8_0 (#6891)

* basic avx implementation

* style

* combine denibble with load

* reduce 256 to 128 (and back!) conversions

* sse load

* Update sgemm.cpp

* oops

oops

13 months agoserver : add_special option for tokenize endpoint (#7059)
Johan [Wed, 8 May 2024 12:27:58 +0000 (14:27 +0200)]
server : add_special option for tokenize endpoint (#7059)

13 months agoconvert.py : --vocab-only generates false but valid params (#7027)
20kdc [Wed, 8 May 2024 12:22:32 +0000 (13:22 +0100)]
convert.py : --vocab-only generates false but valid params (#7027)

An example of how this might be used in the style of baby-llama will be attached with this PR.

13 months agollama : add BPE pre-tokenization for Qwen2 (#7114)
Ren Xuancheng [Wed, 8 May 2024 12:06:43 +0000 (20:06 +0800)]
llama : add BPE pre-tokenization for Qwen2 (#7114)

* Add BPE pre-tokenization for Qwen2.

* minor : fixes

---------

Co-authored-by: Ren Xuancheng <redacted>
Co-authored-by: Georgi Gerganov <redacted>
13 months agoclean up json_value & server_log (#7142)
Xuan Son Nguyen [Wed, 8 May 2024 11:24:14 +0000 (13:24 +0200)]
clean up json_value & server_log (#7142)

13 months agoconvert : add BPE pre-tokenization for DBRX (#7132)
DAN™ [Wed, 8 May 2024 10:43:23 +0000 (06:43 -0400)]
convert : add BPE pre-tokenization for DBRX (#7132)

* Add BPE pre-tokenization for DBRX.

* Add vocab GGUFs.

* Remove test.

* Remove GGUFs.

13 months agopy : also print the normalizers
Georgi Gerganov [Wed, 8 May 2024 09:47:07 +0000 (12:47 +0300)]
py : also print the normalizers

13 months agocompare-llama-bench.py: add missing basicConfig (#7138)
Brian [Wed, 8 May 2024 08:54:39 +0000 (18:54 +1000)]
compare-llama-bench.py: add missing basicConfig (#7138)

* compare-llama-bench.py: add missing basicConfig

* compare-llama-bench.py: Add line break between error message and print_help()

* Add regular print() markdown table

13 months agoggml : introduce bfloat16 support (#6412)
Justine Tunney [Wed, 8 May 2024 06:30:09 +0000 (02:30 -0400)]
ggml : introduce bfloat16 support (#6412)

* Introduce bfloat16 support

Many models on Hugging Face (e.g. Mistral, TinyLLaMA) use bfloat16 as
their canonical floating point format.

      ┌sign
      │
      │   ┌exponent
      │   │
      │   │      ┌mantissa
      │   │      │
      │┌──┴───┐┌─┴───┐
    0b0000000000000000 brain16

This encoding has the same number of exponent bits as float32. That
makes conversion relatively straightforward, even in the absence of
hardware support. For example, converting brain16 to binary32 means
simply shifting 16 bits to the left.

      ┌sign
      │
      │   ┌exponent
      │   │
      │   │      ┌mantissa
      │   │      │
      │┌──┴───┐┌─┴───────────────────┐
    0b00000000000000000000000000000000 IEEE binary32

The issue is that converting bf16 to fp16 can result in information
loss. Only 13% of bf16 numbers can be precisely represented in fp16
which in practice ends up being 99.71% of Mistral 7b v0.2's weights
however there is currently no way other than fp32 to get the others

      ┌sign
      │
      │  ┌exponent
      │  │
      │  │    ┌mantissa
      │  │    │
      │┌─┴─┐┌─┴──────┐
    0b0000000000000000 IEEE binary16

This change fixes that, by adding a bf16 data type to GGML. Support
for CPU inference has been implemented along with optimizations for
the AVX2, AVX512, and AVX512BF16 ISAs. Perplexity on Mistral 7b 0.2
improves somewhere around -0.0024 to -0.0046 compared to using fp16

* Remove GGML code that's not needed

* Minimize the GGML API surface area for BF16

* Remove bf16 luts

* Make the GGML header look nicer

* Fix documentation

* Apply ggerganov's fixes for test-backend-ops

* Add BF16 code for new ggml_validate_row_data() function

13 months agometal : fix unused warning
Georgi Gerganov [Wed, 8 May 2024 06:14:50 +0000 (09:14 +0300)]
metal : fix unused warning

13 months agoFurther tidy on Android instructions README.md (#7077)
Jeximo [Wed, 8 May 2024 00:26:43 +0000 (21:26 -0300)]
Further tidy on Android instructions README.md (#7077)

* Further tidy on Android instructions README.md

Fixed some logic when following readme direction

* Clean up redundent information

A new user arriving will see simple directions on llama.cpp homepage

* corrected puncuation

Period after cmake, colon after termux

* re-word for clarity

method seems to be more correct, instead of alternative in this context

* Organized required packages per build type

building llama.cpp with NDK on a pc doesn't require installing clang, cmake, git, or wget in termux.

* README.md

corrected title

* fix trailing whitespace

13 months agoFixed save_imatrix to match old behaviour for MoE (#7099)
jukofyork [Wed, 8 May 2024 00:24:16 +0000 (01:24 +0100)]
Fixed save_imatrix to match old behaviour for MoE (#7099)

* Fixed save_imatrix to match old behaviour for MoE

This fix is simple and clear, but unnecessarily doubles the memory overhead..

* Fixed missing idx variable

* Unconditionally increment ncall

Co-authored-by: slaren <redacted>
* Fixed 2 bugs in save_imatrix()

- Fixed segfault bug because the counts vector needed to be created.
- Fixed pre-existing bug didn't actually add to the counts for "--combine" option.

* ncall needs summing too

* Trailing whitespace

---------

Co-authored-by: slaren <redacted>
13 months agoserver: fix incorrectly reported token probabilities (#7125)
Johannes Gäßler [Tue, 7 May 2024 21:07:58 +0000 (23:07 +0200)]
server: fix incorrectly reported token probabilities (#7125)

* server: normalize token probabilities

* fix temperature == 0.0f

13 months agoFix OLMo HF to GGUF conversion (#6910)
nopperl [Tue, 7 May 2024 19:39:43 +0000 (19:39 +0000)]
Fix OLMo HF to GGUF conversion (#6910)

13 months agoserver : update readme with undocumented options (#7013)
Kyle Mistele [Tue, 7 May 2024 18:44:29 +0000 (13:44 -0500)]
server : update readme with undocumented options (#7013)

13 months agoreadme : update hot topics
Georgi Gerganov [Tue, 7 May 2024 18:43:13 +0000 (21:43 +0300)]
readme : update hot topics

13 months agomain : update log text (EOS to EOG) (#7104)
RhinoDevel [Tue, 7 May 2024 17:51:31 +0000 (19:51 +0200)]
main : update log text (EOS to EOG) (#7104)

* Update log text (EOS to EOG)

The log text "found EOS" is no longer always correct, here, because there is now an is-EOG check that also returns true for EOT.

* Improve log msg. further by using "an" instead of "some".

As suggested, to avoid misunderstanding (no multiple EOG tokens found, just one).

13 months agodocs: fix typos (#7124)
omahs [Tue, 7 May 2024 15:20:33 +0000 (17:20 +0200)]
docs: fix typos (#7124)

* fix typo

* fix typos

* fix typo

* fix typos

* fix typo

* fix typos

13 months agoci : add GG_BUILD_EXTRA_TESTS_0 env (#7098)
Georgi Gerganov [Tue, 7 May 2024 08:08:49 +0000 (11:08 +0300)]
ci : add GG_BUILD_EXTRA_TESTS_0 env (#7098)

* ci : add GG_BUILD_EXTRA_TESTS_0 env

ggml-ci

* Update run.sh

ggml-ci

13 months agoAdd an option to build without CUDA VMM (#7067)
William Tambellini [Mon, 6 May 2024 18:12:14 +0000 (11:12 -0700)]
Add an option to build without CUDA VMM (#7067)

Add an option to build ggml cuda without CUDA VMM
resolves
https://github.com/ggerganov/llama.cpp/issues/6889
https://forums.developer.nvidia.com/t/potential-nvshmem-allocated-memory-performance-issue/275416/4

13 months agoflake.lock: Update (#7079)
Georgi Gerganov [Mon, 6 May 2024 15:36:06 +0000 (18:36 +0300)]
flake.lock: Update (#7079)

Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/9126214d0a59633752a136528f5f3b9aa8565b7d?narHash=sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm%2BGpZNw%3D' (2024-04-01)
  → 'github:hercules-ci/flake-parts/e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e?narHash=sha256-yzcRNDoyVP7%2BSCNX0wmuDju1NUCt8Dz9%2BlyUXEI0dbI%3D' (2024-05-02)
• Updated input 'flake-parts/nixpkgs-lib':
    'github:NixOS/nixpkgs/d8fe5e6c92d0d190646fb9f1056741a229980089?dir=lib&narHash=sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk%3D' (2024-03-29)
  → 'https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz?narHash=sha256-QBx10%2Bk6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94%3D' (2024-05-02)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856?narHash=sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY%3D' (2024-04-25)
  → 'github:NixOS/nixpkgs/63c3a29ca82437c87573e4c6919b09a24ea61b0f?narHash=sha256-4cPymbty65RvF1DWQfc%2BBc8B233A1BWxJnNULJKQ1EY%3D' (2024-05-02)

Co-authored-by: github-actions[bot] <redacted>
13 months agominor : fix trailing whitespace
Georgi Gerganov [Mon, 6 May 2024 06:31:30 +0000 (09:31 +0300)]
minor : fix trailing whitespace

13 months agoAdding support for the --numa argument for llama-bench. (#7080)
kunnis [Sun, 5 May 2024 12:17:47 +0000 (07:17 -0500)]
Adding support for the --numa argument for llama-bench. (#7080)

13 months agoDisable benchmark on forked repo (#7034)
Sigbjørn Skjæret [Sun, 5 May 2024 11:38:55 +0000 (13:38 +0200)]
Disable benchmark on forked repo (#7034)

* Disable benchmark on forked repo

* only check owner on schedule event

* check owner on push also

* more readable as multi-line

* ternary won't work

* style++

* test++

* enable actions debug

* test--

* remove debug

* test++

* do debug where we can get logs

* test--

* this is driving me crazy

* correct github.event usage

* remove test condition

* correct github.event usage

* test++

* test--

* event_name is pull_request_target

* test++

* test--

* update ref checks

13 months agoreadme : add note that LLaMA 3 is not supported with convert.py (#7065)
Lyle Dean [Sun, 5 May 2024 05:21:46 +0000 (06:21 +0100)]
readme : add note that LLaMA 3 is not supported with convert.py (#7065)

13 months agocommand-r : add BPE pre-tokenization (#7063)
DAN™ [Sun, 5 May 2024 05:19:30 +0000 (01:19 -0400)]
command-r : add BPE pre-tokenization (#7063)

* Add BPE pre-tokenization for Command-R/R+.

* Bump transformers convert requirement.

* command-r : add individual digits regex

---------

Co-authored-by: Georgi Gerganov <redacted>
13 months agopy : logging and flake8 suppression refactoring (#7081)
Brian [Sun, 5 May 2024 05:07:48 +0000 (15:07 +1000)]
py : logging and flake8 suppression refactoring (#7081)

Set one as executable and add basicConfig()
to another. Also added noqa tag to test scripts.

13 months agogguf-split: add --no-tensor-first-split (#7072)
Xuan Son Nguyen [Sat, 4 May 2024 16:56:22 +0000 (18:56 +0200)]
gguf-split: add --no-tensor-first-split (#7072)

13 months agoTidy Android Instructions README.md (#7016)
Jeximo [Sat, 4 May 2024 16:10:15 +0000 (13:10 -0300)]
Tidy Android Instructions README.md (#7016)

* Tidy Android Instructions README.md

Remove CLBlast instructions(outdated), added OpenBlas.

* don't assume git is installed

Added apt install git, so that git clone works

* removed OpenBlas

Linked to Linux build instructions

* fix typo

Remove word "run"

* correct style

Co-authored-by: slaren <redacted>
* correct grammar

Co-authored-by: slaren <redacted>
* delete reference to Android API

* remove Fdroid reference, link directly to Termux

Fdroid is not required

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

Co-authored-by: slaren <redacted>
---------

Co-authored-by: slaren <redacted>
13 months agoFix Linux /sys cpu path to guess number of cores (#7064)
viric [Sat, 4 May 2024 13:26:53 +0000 (15:26 +0200)]
Fix Linux /sys cpu path to guess number of cores (#7064)

13 months agoIf first token generated from the server is the stop word the server will crash ...
maor-ps [Sat, 4 May 2024 09:06:40 +0000 (12:06 +0300)]
If first token generated from the server is the stop word the server will crash (#7038)

This will reproduce the issue in llama13b
{
'prompt': 'Q: hello world \nA: ',
 'stop': ['\n'],
 'temperature': 0.0,
 'n_predict': 10,
 'cache_prompt': True,
 'n_probs': 10
}

13 months agotests : add test-tokenizer-0.sh + fix some tokenizers (#7036)
Georgi Gerganov [Sat, 4 May 2024 05:32:32 +0000 (08:32 +0300)]
tests : add test-tokenizer-0.sh + fix some tokenizers (#7036)

* tests : add test-tokenizer-0.sh

* unicode : add all unicode number ranges

* starcoder : fix pre-tokenizer

* tests : add test that fails with DeepSeek tokenizers

* falcon : fix regex

* unicode : regenerate unicode tables

* refact : add tokenizer model

* lint : fix

* tests : disable failing tests

ggml-ci

* refact : add tests files

ggml-ci

* convert : print -> logging

ggml-ci

* lint : fix

* unicode : digit -> number

* phi-3 : update

14 months agoconvert.py : add python logging instead of print() (#6511)
Brian [Fri, 3 May 2024 19:36:41 +0000 (05:36 +1000)]
convert.py : add python logging instead of print() (#6511)

* convert.py: add python logging instead of print()

* convert.py: verbose flag takes priority over dump flag log suppression

* convert.py: named instance logging

* convert.py: use explicit logger id string

* convert.py: convert extra print() to named logger

* convert.py: sys.stderr.write --> logger.error

* *.py: Convert all python scripts to use logging module

* requirements.txt: remove extra line

* flake8: update flake8 ignore and exclude to match ci settings

* gh-actions: add flake8-no-print to flake8 lint step

* pre-commit: add flake8-no-print to flake8 and also update pre-commit version

* convert-hf-to-gguf.py: print() to logger conversion

* *.py: logging basiconfig refactor to use conditional expression

* *.py: removed commented out logging

* fixup! *.py: logging basiconfig refactor to use conditional expression

* constant.py: logger.error then exit should be a raise exception instead

* *.py: Convert logger error and sys.exit() into a raise exception (for atypical error)

* gguf-convert-endian.py: refactor convert_byteorder() to use tqdm progressbar

* verify-checksum-model.py: This is the result of the program, it should be printed to stdout.

* compare-llama-bench.py: add blank line for readability during missing repo response

* reader.py: read_gguf_file() use print() over logging

* convert.py: warning goes to stderr and won't hurt the dump output

* gguf-dump.py: dump_metadata() should print to stdout

* convert-hf-to-gguf.py: print --> logger.debug or ValueError()

* verify-checksum-models.py: use print() for printing table

* *.py: refactor logging.basicConfig()

* gguf-py/gguf/*.py: use __name__ as logger name

Since they will be imported and not run directly.

* python-lint.yml: use .flake8 file instead

* constants.py: logger no longer required

* convert-hf-to-gguf.py: add additional logging

* convert-hf-to-gguf.py: print() --> logger

* *.py: fix flake8 warnings

* revert changes to convert-hf-to-gguf.py for get_name()

* convert-hf-to-gguf-update.py: use triple quoted f-string instead

* *.py: accidentally corrected the wrong line

* *.py: add compilade warning suggestions and style fixes

14 months agollama : rename ctx to user_data in progress_callback (#7045)
Daniel Bevenius [Fri, 3 May 2024 13:24:30 +0000 (15:24 +0200)]
llama : rename ctx to user_data in progress_callback (#7045)

* llama : rename ctx to user_data in progress_callback

This commit renames the `ctx` parameter to `user_data` in the
`llama_progress_callback` typedef.

The motivation for this is that other callbacks use `user_data` or
`data`, and using `ctx` in this case might be confusing as it could be
confused with `llama_context`.

---------

Signed-off-by: Daniel Bevenius <redacted>
14 months agoRemove .attention from skipped tensors to match more accurately (#7051)
Bartowski [Thu, 2 May 2024 23:49:09 +0000 (19:49 -0400)]
Remove .attention from skipped tensors to match more accurately (#7051)

14 months agochore: fix typo in llama.cpp (#7032)
alwqx [Thu, 2 May 2024 15:56:41 +0000 (23:56 +0800)]
chore: fix typo in llama.cpp (#7032)

Co-authored-by: Jared Van Bortel <redacted>
14 months agoUpdate LOG_IMPL and LOG_TEE_IMPL (#7029)
Andrew Downing [Wed, 1 May 2024 21:31:30 +0000 (17:31 -0400)]
Update LOG_IMPL and LOG_TEE_IMPL (#7029)

ROCm clang defines _MSC_VER which results in the wrong implementation of LOG_IMPL and LOG_TEE_IMPL being compiled.

This fixes https://github.com/ggerganov/llama.cpp/issues/6972

14 months agomain : fix off by one error for context shift (#6921)
l3utterfly [Wed, 1 May 2024 19:27:41 +0000 (04:27 +0900)]
main : fix off by one error for context shift (#6921)

14 months agoServer: add tests for batch size, different seeds (#6950)
Johannes Gäßler [Wed, 1 May 2024 15:52:55 +0000 (17:52 +0200)]
Server: add tests for batch size, different seeds (#6950)

14 months agoCUDA: CUDART < 11.7 workaround for __hmax, __hmax2 (#7019)
Johannes Gäßler [Wed, 1 May 2024 12:46:37 +0000 (14:46 +0200)]
CUDA: CUDART < 11.7 workaround for __hmax, __hmax2 (#7019)

14 months agoci : exempt confirmed bugs from being tagged as stale (#7014)
slaren [Wed, 1 May 2024 05:13:59 +0000 (07:13 +0200)]
ci : exempt confirmed bugs from being tagged as stale (#7014)

14 months agoperplexity: more statistics, added documentation (#6936)
Johannes Gäßler [Tue, 30 Apr 2024 21:36:27 +0000 (23:36 +0200)]
perplexity: more statistics, added documentation (#6936)

* perplexity: more statistics, added documentation

* add LLaMA 3 8b scoreboard

14 months agoswitch to using localizedDescription (#7010)
Kevin Gibbons [Tue, 30 Apr 2024 15:14:02 +0000 (08:14 -0700)]
switch to using localizedDescription (#7010)

14 months agometal : remove deprecated error code (#7008)
Georgi Gerganov [Tue, 30 Apr 2024 12:52:21 +0000 (15:52 +0300)]
metal : remove deprecated error code (#7008)

14 months agometal : log more info on error (#6987)
Kevin Gibbons [Tue, 30 Apr 2024 09:34:50 +0000 (02:34 -0700)]
metal : log more info on error (#6987)

14 months agoggml : add Flash Attention (#5021)
Georgi Gerganov [Tue, 30 Apr 2024 09:16:08 +0000 (12:16 +0300)]
ggml : add Flash Attention (#5021)

* ggml : add ggml_flash_attn_ext API

* ggml : fix GQA support in ggml_flash_attn_ext

* ggml : online attention (CPU)

* metal : initial implementation

* metal : f16 precision

* metal : reduce branches

* metal : specialize for head size

* wip : 8 rows per simd group

* wip : 4 rows per simd group

* wip : template for rows per warp

* metal : parallelize across KV size

* metal : parallel reduce across heads

* metal : efficient flash_attn_f16 implementation

* metal : avoid redundant loads of the attention

* metal : scale and mask in matrix form

* metal : fix comment

* llama : avoid ggml_cast, use F32 query

* metal : add parallel reduce version (disabled)

* metal : move output into local memory + optimize

- the result from each simdgroup now stays in the registers
- significantly reduced SRAM usage
- more efficient skipping of -INF blocks
- avoid simdgroup barrier in hot loop
- add comments

* metal : add tests, fix scaling, support C > 32

* metal : improve precision

* ggml : fix f16 mad

* metal : minor

* metal : support Q > 8

* tests : add ATTN tests

* metal : disable buffer allocation logs

* tests : more

* metal : faster inner loop for C == 32

* metal : fix array initialization

* tests : ifdef

* ggml : switch to padded F16 mask for ggml_soft_max, ggml_flash_attn_ext

* ggml : fix ggml_soft_max mask requirement

* cuda : fix soft_max to use correct mask size

* cuda : add flash_attn kernel (wip)

* metal : optimize softmax for C > 32

* metal : optimize softmax

* tests : minor fix

* cuda : avoid zeroing fragments

* tests : update dims

* cuda : fix __hisinf() result check

* cuda : avoid warp_reduce for smax

* cuda : use int instead of int64_t

Noticeably improves performance (thanks to Johannes)

* cuda : make loops use the same loop values

Thanks Johannes again for the tip

* cuda : unroll some of the loops

* cuda : avoid __hisinf branches

* cuda : use half2 in softmax

* cuda : switch to 1 warp for bs > 16

* cuda : speed-up reduce part of the kernel

* cuda : unroll Q*K^T loop

* cuda : fix -INF block check

* cuda : simplify softmax

* cuda : fix matrix names

* cuda : minor

* llama : adapt to F16 KQ_pos

* llama : adapt new models to F16 KQ_mask

* ggml : fix F16 store (ARM NEON)

* llama : fix type of KQ_mask and KQ_pos

* ggml : fix CPU soft_max

* tests : add hs=256

* cuda : fix build

* metal : improve perf via smaller int registers

* cuda : adapt soft_max to F16 mask and pos

* CUDA: faster FlashAttention, kernel for bs == 1

* 16 cols for Phi-2

* no vec for hs, no hs==256 ncols==32 for Volta

* adjust kernel selection logic

* 4 warps, 256 stride for all D

* no ncols == 64

* Multiple parallel blocks for batch size 1

* fix compile warnings

* fix excessive KQ_b loads

* fix cmake build

* fix KV cache padding, NaN from INFINITY (#6438)

* llama : flash_attn cparam + fix defrag

* server: support flash_attn param

* server: bench: enable flash_attn param

* CUDA: refactor host code, dyn. par. blocks

* fix flash_attn_vec_f16 race condition

* flush softmax exp below threshold to 0

* store temp KQ in registers

* Calculate KQ as FP32 if KQV has GGML_PREC_F32

* Add __hgt2_mask implementation for CUDA 11

* fix KQ FP32 precision fpr parallel_blocks > 1

* llama-bench : add -fa,--flash-attn arg

* metal : add BS=1 kernel for flash attention (#6508)

* metal : add BS=1 kernel for flash attention (wip)

* metal : support more than 1 warps

* metal : opts

* metal : opt

* metal : switch to parallel reduce

* metal : reduce registers

* metal : simplify

* metal : initial FA vec kernel

* metal : use F32 attention accumulators

* batched-bench : add fattn arg

* llama : simplify llama_build_kv_store

ggml-ci

* llama : adapt build_olmo to changes

* ggml : fix arm fp16 store on windows

* metal : clean-up

* metal : clean-up kernel code

* metal : minor

* tests : remove benchmarks

ggml-ci

* ggml : fix avx512 const correctness

ggml-ci

* ggml : fix soft_max with bias on CPU

ggml-ci

* common : print --flash-attn in help

* ggml : fix num dimensions in ggml_flash_attn_ext

* llama : force disable flash attention for incompatible models

* ggml : ggml_soft_max support F16/F32 mask/pos

ggml-ci

* cuda : uint -> uint32_t

* cuda : "constexpr dim3" -> "const dim3"

ggml-ci

* cuda : try to fix __hgt2_mask

ggml-ci

* ggml : add TODO's for F16/F32 mask/pos support in other backends

* llama : replace bool need_kq_pos with use_alibi

* llama : prep ALiBi support for BERT models

ggml-ci

* llama : fix n_batch requirements

ggml-ci

* cont

* server : add help for --flash-attn arg

* llama : disable FA for AMD

* tests : remove TMP_ATTN_BENCH

ggml-ci

* llama : support save/load state with FA enabled

ggml-ci

* ci : add CUDA save-load-state tests

ggml-ci

* llama : llama_kv_cache_clear zeroes data + fix save-load seq

ggml-ci

* llama : fix copy-paste errors, add TODO

* llama : disallow incompatible states

* llama : update llama_state_get_size after v_trans field

* metal : remove tmp log

* llama : add static reminder for llama_state_get_size

* metal : fix max nsg

ggml-ci

* ci : fix arg order

ggml-ci

---------

Co-authored-by: Johannes Gäßler <redacted>
Co-authored-by: Pierrick HYMBERT <redacted>
14 months agoconvert : use utf8 encoding (#7000)
Georgi Gerganov [Tue, 30 Apr 2024 08:05:25 +0000 (11:05 +0300)]
convert : use utf8 encoding (#7000)

* convert : use utf8 encoding

* convert : update instructions and warning message

14 months agoImprove usability of --model-url & related flags (#6930)
Olivier Chafik [Mon, 29 Apr 2024 23:52:50 +0000 (00:52 +0100)]
Improve usability of --model-url & related flags (#6930)

* args: default --model to models/ + filename from --model-url or --hf-file (or else legacy models/7B/ggml-model-f16.gguf)

* args: main & server now call gpt_params_handle_model_default

* args: define DEFAULT_MODEL_PATH + update cli docs

* curl: check url of previous download (.json metadata w/ url, etag & lastModified)

* args: fix update to quantize-stats.cpp

* curl: support legacy .etag / .lastModified companion files

* curl: rm legacy .etag file support

* curl: reuse regex across headers callback calls

* curl: unique_ptr to manage lifecycle of curl & outfile

* curl: nit: no need for multiline regex flag

* curl: update failed test (model file collision) + gitignore *.gguf.json

14 months agoExtending grammar integration tests (#6644)
Clint Herron [Mon, 29 Apr 2024 18:40:14 +0000 (14:40 -0400)]
Extending grammar integration tests (#6644)

* Cleaning up integration tests to share code between tests and make it simpler to add new tests.

* Add tests around quantifiers to ensure both matching and non-matching compliance.

* Add slightly more complex grammar with quantifiers to test references with quantifiers.

* Fixing build when C++17 is not present.

* Separating test calls to give more helpful stack traces on failure. Adding verbose messages to give visibility for what is being tested.

* Adding quotes around strings to explicitly show whitespace

* Removing trailing whitespace.

* Implementing suggestions from @ochafik -- grammars and test strings now print and flush before tests to aid in debugging segfaults and whatnot.

* Cleaning up forgotten symbols. Modifying simple test to use test harness. Added comments for more verbose descriptions of what each test is accomplishing.

* Unicode symbol modifications to hopefully make log easier to parse visually.

14 months agomain : fix typo in comment in main.cpp (#6985)
Daniel Bevenius [Mon, 29 Apr 2024 17:56:59 +0000 (19:56 +0200)]
main : fix typo in comment in main.cpp (#6985)

Signed-off-by: Daniel Bevenius <redacted>
14 months agobuild(cmake): simplify instructions (`cmake -B build && cmake --build build ...`...
Olivier Chafik [Mon, 29 Apr 2024 16:02:45 +0000 (17:02 +0100)]
build(cmake): simplify instructions (`cmake -B build && cmake --build build ...`) (#6964)

* readme: cmake . -B build && cmake --build build

* build: fix typo

Co-authored-by: Jared Van Bortel <redacted>
* build: drop implicit . from cmake config command

* build: remove another superfluous .

* build: update MinGW cmake commands

* Update README-sycl.md

Co-authored-by: Neo Zhang Jianyu <redacted>
* build: reinstate --config Release as not the default w/ some generators + document how to build Debug

* build: revert more --config Release

* build: nit / remove -H from cmake example

* build: reword debug instructions around single/multi config split

---------

Co-authored-by: Jared Van Bortel <redacted>
Co-authored-by: Neo Zhang Jianyu <redacted>
14 months agoci : tmp disable gguf-split (#6983)
Georgi Gerganov [Mon, 29 Apr 2024 15:36:39 +0000 (18:36 +0300)]
ci : tmp disable gguf-split (#6983)

ggml-ci

14 months agoggml : fix __MSC_VER -> _MSC_VER (#6977)
Georgi Gerganov [Mon, 29 Apr 2024 14:55:02 +0000 (17:55 +0300)]
ggml : fix __MSC_VER -> _MSC_VER (#6977)

ggml-ci

14 months agollava-cli : multiple images (#6969)
cpumaxx [Mon, 29 Apr 2024 14:34:24 +0000 (07:34 -0700)]
llava-cli : multiple images (#6969)

Co-authored-by: root <redacted>
14 months agoreadme : update hot topics
Georgi Gerganov [Mon, 29 Apr 2024 14:06:19 +0000 (17:06 +0300)]
readme : update hot topics

14 months agollama : fix BPE pre-tokenization (#6920)
Georgi Gerganov [Mon, 29 Apr 2024 13:58:41 +0000 (16:58 +0300)]
llama : fix BPE pre-tokenization (#6920)

* 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

* 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

* lint : fix

* 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

* 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

---------

Co-authored-by: Jaggzh <redacted>
Co-authored-by: Kazim Abrar Mahi <redacted>
14 months agosampling : use std::random_device{}() for default random seed (#6962)
David Renshaw [Mon, 29 Apr 2024 13:35:45 +0000 (09:35 -0400)]
sampling : use std::random_device{}() for default random seed (#6962)

14 months agoconvert : fix conversion of some BERT embedding models (#6937)
Christian Zhou-Zheng [Mon, 29 Apr 2024 13:34:41 +0000 (09:34 -0400)]
convert : fix conversion of some BERT embedding models (#6937)

14 months agomake : change GNU make default CXX from g++ to c++ (#6966)
Przemysław Pawełczyk [Mon, 29 Apr 2024 13:08:20 +0000 (15:08 +0200)]
make : change GNU make default CXX from g++ to c++ (#6966)

14 months agoci : add building in MSYS2 environments (Windows) (#6967)
Przemysław Pawełczyk [Mon, 29 Apr 2024 12:59:47 +0000 (14:59 +0200)]
ci : add building in MSYS2 environments (Windows) (#6967)

14 months agollama : fix typo LAMMAFILE -> LLAMAFILE (#6974)
Johannes Gäßler [Mon, 29 Apr 2024 12:36:22 +0000 (14:36 +0200)]
llama : fix typo LAMMAFILE -> LLAMAFILE (#6974)

14 months agoFix more int overflow during quant (PPL/CUDA). (#6563)
DAN™ [Sun, 28 Apr 2024 22:38:44 +0000 (18:38 -0400)]
Fix more int overflow during quant (PPL/CUDA). (#6563)

* Fix more int overflow during quant.

* Fix some more int overflow in softmax.

* Revert back to int64_t.

14 months agogguf : enforce that tensor names are unique (#6905)
Xuan Son Nguyen [Sun, 28 Apr 2024 15:36:18 +0000 (17:36 +0200)]
gguf : enforce that tensor names are unique (#6905)

* not allow adding duplicated tensor name

* no duplicated tensor while reading gguf

* typo

* throw exception inside llama_model_loader

Co-authored-by: slaren <redacted>
---------

Co-authored-by: slaren <redacted>
14 months agoadd device version in device list (#6959)
Neo Zhang [Sun, 28 Apr 2024 14:40:31 +0000 (22:40 +0800)]
add device version in device list (#6959)

Co-authored-by: arthw <>
14 months agoflake.lock: Update
github-actions[bot] [Sun, 28 Apr 2024 00:18:27 +0000 (00:18 +0000)]
flake.lock: Update

Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5c24cf2f0a12ad855f444c30b2421d044120c66f?narHash=sha256-XtTSSIB2DA6tOv%2Bl0FhvfDMiyCmhoRbNB%2B0SeInZkbk%3D' (2024-04-19)
  → 'github:NixOS/nixpkgs/7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856?narHash=sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY%3D' (2024-04-25)

14 months agoReplace "alternative" boolean operator in conditional compilation directive (#6949)
mgroeber9110 [Sat, 27 Apr 2024 19:02:06 +0000 (21:02 +0200)]
Replace "alternative" boolean operator in conditional compilation directive (#6949)

14 months agoci: server: tests python env on github container ubuntu latest / fix n_predict (...
Pierrick Hymbert [Sat, 27 Apr 2024 15:50:48 +0000 (17:50 +0200)]
ci: server: tests python env on github container ubuntu latest / fix n_predict (#6935)

* ci: server: fix python env

* ci: server: fix server tests after #6638

* ci: server: fix windows is not building PR branch

14 months agoReset schedule earlier to allow overlap with ggml graph computation on device (#6933)
agray3 [Fri, 26 Apr 2024 18:08:30 +0000 (19:08 +0100)]
Reset schedule earlier to allow overlap with ggml graph computation on device (#6933)

* Reset schedule earlier to allow overlap with graph computation on device

14 months agoquantize: add imatrix and dataset metadata in GGUF (#6658)
Pierrick Hymbert [Fri, 26 Apr 2024 18:06:33 +0000 (20:06 +0200)]
quantize: add imatrix and dataset metadata in GGUF (#6658)

* imatrix: save the dataset file used in the output file

* llama: support kv overrides type string string

* common: factorize KV Overrides parsing between common and server

* quantize: add imatrix n entries and dataset KV metadata
quantize: factorize KV Overrides parsing between common
#6656

* llama: remove kv override str_value initialization as it does not compile on some toolchain

* quantize: add imatrix m_last_call as `quantize.imatrix.chunks_count`

* quantize: add imatrix filename in KV

* llama: add llama_model_kv_override_free

* common: add llama_model_kv_override_free
common: free kv override if used after model loading

* llama: finally move the string KV override value to the stack

* llama : minor

* no need to add a NUL to the std::vector, std::string can be initialized from a pair of iterators.

Co-authored-by: slaren <redacted>
* kv override: ensure string termination

---------

Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: slaren <redacted>
14 months agoadd basic tensor data validation function (#6884)
slaren [Fri, 26 Apr 2024 16:39:58 +0000 (18:39 +0200)]
add basic tensor data validation function (#6884)

* add basic tensor data validation function

* add --check-tensors command line argument

tensor validation is disabled by default and can be enabled by adding
`--check-tensors` to the command line arguments.

quantize always validates tensors.

14 months agogguf : fix mismatch between alloc and free functions (#6929)
slaren [Fri, 26 Apr 2024 15:07:42 +0000 (17:07 +0200)]
gguf : fix mismatch between alloc and free functions (#6929)

14 months agollamafile : use 64-bit integers in sgemm (#6928)
Justine Tunney [Fri, 26 Apr 2024 14:05:33 +0000 (10:05 -0400)]
llamafile : use 64-bit integers in sgemm (#6928)

14 months agoci: server: fix python installation (#6925)
Pierrick Hymbert [Fri, 26 Apr 2024 10:27:25 +0000 (12:27 +0200)]
ci: server: fix python installation (#6925)

14 months agoserver: stop generation at `n_ctx_train` if `n_predict` is not set (#6638)
Pierrick Hymbert [Fri, 26 Apr 2024 10:15:30 +0000 (12:15 +0200)]
server: stop generation at `n_ctx_train` if `n_predict` is not set (#6638)

* server: cap n_predict if not set to n_ctx_train

* server: fix infinite loop

* server: infinite loop, move in process_token
server: infinite loop: set stop limit to true

* minor: spaces

* minor: spaces

* server: include prompt tokens in the EOS limit

14 months agoci: server: fix python installation (#6922)
Pierrick Hymbert [Fri, 26 Apr 2024 09:11:51 +0000 (11:11 +0200)]
ci: server: fix python installation (#6922)

14 months agoMerge pull request from GHSA-p5mv-gjc5-mwqv
Georgi Gerganov [Fri, 26 Apr 2024 07:41:53 +0000 (10:41 +0300)]
Merge pull request from GHSA-p5mv-gjc5-mwqv

* always use calloc

clamp n_kv on failure to read a kv

* ggml : alternative ctx->header.n_kv update

---------

Co-authored-by: slaren <redacted>
14 months agoci: server: fix python installation (#6918)
Pierrick Hymbert [Fri, 26 Apr 2024 07:27:49 +0000 (09:27 +0200)]
ci: server: fix python installation (#6918)

14 months agoci: fix concurrency for pull_request_target (#6917)
Pierrick Hymbert [Fri, 26 Apr 2024 07:26:59 +0000 (09:26 +0200)]
ci: fix concurrency for pull_request_target (#6917)

14 months agobench: server add stop word for PHI-2 (#6916)
Pierrick Hymbert [Fri, 26 Apr 2024 07:26:16 +0000 (09:26 +0200)]
bench: server add stop word for PHI-2 (#6916)

14 months agollava : add support for moondream vision language model (#6899)
vik [Thu, 25 Apr 2024 19:38:31 +0000 (12:38 -0700)]
llava : add support for moondream vision language model (#6899)

* add support for moondream vision language model

This required making the following changes to the CLIP model:

1. Support for patch embedding bias.
2. Make class embedding and pre-layernorm optional.
3. Add support for post-layernorm.

* Update examples/llava/clip.cpp

---------

Co-authored-by: Georgi Gerganov <redacted>
14 months agocmake : restore LLAMA_LLAMAFILE_DEFAULT
Georgi Gerganov [Thu, 25 Apr 2024 18:31:17 +0000 (21:31 +0300)]
cmake : restore LLAMA_LLAMAFILE_DEFAULT

14 months agocmake : remove obsolete ANDROID check
Georgi Gerganov [Thu, 25 Apr 2024 15:59:51 +0000 (18:59 +0300)]
cmake : remove obsolete ANDROID check

14 months agollama : synchronize before get/set session data (#6911)
slaren [Thu, 25 Apr 2024 15:59:03 +0000 (17:59 +0200)]
llama : synchronize before get/set session data (#6911)

14 months agoci : tmp disable slow tests
Georgi Gerganov [Thu, 25 Apr 2024 14:06:27 +0000 (17:06 +0300)]
ci : tmp disable slow tests

14 months agoreadme : update model list (#6908)
BarfingLemurs [Thu, 25 Apr 2024 13:52:28 +0000 (09:52 -0400)]
readme : update model list (#6908)

* Update README.md

* missing space

* llama3 !

14 months agollama : check that all the tensor data is in the model file (#6885)
slaren [Thu, 25 Apr 2024 13:23:47 +0000 (15:23 +0200)]
llama : check that all the tensor data is in the model file (#6885)

* llama : check that all the tensor data is in the model file

* also check for unsigned overflow