]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/log
pkg/ggml/sources/llama.cpp
11 months agollama : bump max layers from 256 to 512 (#8530)
Georgi Gerganov [Fri, 19 Jul 2024 13:50:47 +0000 (16:50 +0300)]
llama : bump max layers from 256 to 512 (#8530)

* llama : bump max layers from 256 to 512

* llama : replace asserts with exceptions

11 months agoreadme : fix server badge
Georgi Gerganov [Fri, 19 Jul 2024 11:34:55 +0000 (14:34 +0300)]
readme : fix server badge

11 months agoggml : add friendlier error message to fopen errors (#8575)
Clint Herron [Fri, 19 Jul 2024 11:05:45 +0000 (07:05 -0400)]
ggml : add friendlier error message to fopen errors (#8575)

* Add additional error information when model files fail to load.

* Adding additional error information to most instances of fopen.

11 months agofix: typo of chatglm4 chat tmpl (#8586)
Frank Mai [Fri, 19 Jul 2024 09:44:41 +0000 (17:44 +0800)]
fix: typo of chatglm4 chat tmpl (#8586)

Signed-off-by: thxCode <redacted>
11 months agoconvert-*.py: add general.name kv override (#8571)
Brian [Fri, 19 Jul 2024 07:51:51 +0000 (17:51 +1000)]
convert-*.py: add general.name kv override (#8571)

11 months agoCUDA: fix partial offloading for ne0 % 256 != 0 (#8572)
Johannes Gäßler [Thu, 18 Jul 2024 21:48:47 +0000 (23:48 +0200)]
CUDA: fix partial offloading for ne0 % 256 != 0 (#8572)

11 months agocmake : install all ggml public headers (#8480)
65a [Thu, 18 Jul 2024 14:47:12 +0000 (07:47 -0700)]
cmake : install all ggml public headers (#8480)

Co-authored-by: 65a <redacted>
11 months agoserver: use relative routes for static files in new UI (#8552)
Eric Zhang [Thu, 18 Jul 2024 10:43:49 +0000 (18:43 +0800)]
server: use relative routes for static files in new UI (#8552)

* server: public: fix api_url on non-index pages

* server: public: use relative routes for static files in new UI

11 months agoconvert-*.py: GGUF Naming Convention Refactor and Metadata Override Refactor (#7499)
Brian [Thu, 18 Jul 2024 10:40:15 +0000 (20:40 +1000)]
convert-*.py: GGUF Naming Convention Refactor and Metadata Override Refactor (#7499)

Main thing is that the default output filename will take this form

{name}{parameters}{finetune}{version}{encoding}{kind}

In addition this add and remove some entries in the KV store and adds a metadata class with automatic heuristics capability to derive some values based on model card content

* No Change:
  - Internal GGUF Spec
    - `general.architecture`
    - `general.quantization_version`
    - `general.alignment`
    - `general.file_type`
  - General Model Details
    - `general.name`
    - `general.author`
    - `general.version`
    - `general.description`
  - Licensing details
    - `general.license`
  - Typically represents the converted GGUF repo (Unless made from scratch)
    - `general.url`
  - Model Source during conversion
    - `general.source.url`

* Removed:
  - Model Source during conversion
    - `general.source.huggingface.repository`

* Added:
  - General Model Details
    - `general.organization`
    - `general.finetune`
    - `general.basename`
    - `general.quantized_by`
    - `general.size_label`
  - Licensing details
    - `general.license.name`
    - `general.license.link`
  - Typically represents the converted GGUF repo (Unless made from scratch)
    - `general.doi`
    - `general.uuid`
    - `general.repo_url`
  - Model Source during conversion
    - `general.source.doi`
    - `general.source.uuid`
    - `general.source.repo_url`
  - Base Model Source
    - `general.base_model.count`
    - `general.base_model.{id}.name`
    - `general.base_model.{id}.author`
    - `general.base_model.{id}.version`
    - `general.base_model.{id}.organization`
    - `general.base_model.{id}.url` (Model Website/Paper)
    - `general.base_model.{id}.doi`
    - `general.base_model.{id}.uuid`
    - `general.base_model.{id}.repo_url` (Model Source Repository (git/svn/etc...))
  - Array based KV stores
    - `general.tags`
    - `general.languages`
    - `general.datasets`

---------

Co-authored-by: compilade <redacted>
Co-authored-by: Xuan Son Nguyen <redacted>
11 months agoserver : respect `--special` cli arg (#8553)
RunningLeon [Thu, 18 Jul 2024 08:06:22 +0000 (16:06 +0800)]
server : respect `--special` cli arg (#8553)

11 months agolookup: fibonacci hashing, fix crashes (#8548)
Johannes Gäßler [Wed, 17 Jul 2024 21:35:44 +0000 (23:35 +0200)]
lookup: fibonacci hashing, fix crashes (#8548)

11 months agobuild : Fix docker build warnings (#8535) (#8537)
Al Mochkin [Wed, 17 Jul 2024 18:21:55 +0000 (20:21 +0200)]
build : Fix docker build warnings (#8535) (#8537)

11 months agoCONTRIBUTING.md : remove mention of noci (#8541)
Brian [Wed, 17 Jul 2024 14:57:06 +0000 (00:57 +1000)]
CONTRIBUTING.md : remove mention of noci (#8541)

11 months ago[CANN] Add Ascend NPU backend (#6035)
hipudding [Wed, 17 Jul 2024 11:23:50 +0000 (19:23 +0800)]
[CANN] Add Ascend NPU backend (#6035)

* [CANN] Add Ascend NPU backend

Ascend is a full-stack AI computing infrastructure for industry
applications and services based on Huawei Ascend processors and
software.

CANN (Compute Architecture of Neural Networks), developped by
Huawei, is a heterogeneous computing architecture for AI.

Co-authored-by: wangshuai09 <redacted>
* delete trailing whitespaces

* Modify the code based on review comment

* Rename LLAMA_CANN to GGML_CANN

* Make ggml-common.h private

* add ggml_cann prefix for acl funcs

* Add logging for CANN backend

* Delete Trailing whitespace

---------

Co-authored-by: wangshuai09 <redacted>
11 months agobatched: fix n_predict parameter (#8527)
Masaya, Kato [Wed, 17 Jul 2024 07:34:28 +0000 (16:34 +0900)]
batched: fix n_predict parameter (#8527)

11 months agollama : disable context-shift for DeepSeek v2 (#8501)
Georgi Gerganov [Wed, 17 Jul 2024 07:32:59 +0000 (10:32 +0300)]
llama : disable context-shift for DeepSeek v2 (#8501)

11 months agomake/cmake: add missing force MMQ/cuBLAS for HIP (#8515)
Johannes Gäßler [Tue, 16 Jul 2024 19:20:59 +0000 (21:20 +0200)]
make/cmake: add missing force MMQ/cuBLAS for HIP (#8515)

11 months agogguf-hash : update clib.json to point to original xxhash repo (#8491)
Brian [Tue, 16 Jul 2024 07:14:16 +0000 (17:14 +1000)]
gguf-hash : update clib.json to point to original xxhash repo (#8491)

* Update clib.json to point to Cyan4973 original xxhash

Convinced Cyan4973 to add clib.json directly to his repo, so can now point the clib package directly to him now. Previously pointed to my fork with the clib.json package metadata

https://github.com/Cyan4973/xxHash/pull/954

* gguf-hash: readme update to point to Cyan4973 xxHash repo [no ci]

11 months agoexport-lora : handle help argument (#8497)
Steve Bonds [Tue, 16 Jul 2024 07:04:45 +0000 (00:04 -0700)]
export-lora : handle help argument (#8497)

The --help option on export-lora isn't accepted as valid. The help still gets displayed by default, but the script exits with an error message and nonzero status.

11 months agollama : valign + remove unused ftype (#8502)
Georgi Gerganov [Tue, 16 Jul 2024 07:00:30 +0000 (10:00 +0300)]
llama : valign + remove unused ftype (#8502)

11 months agoconvert_hf : faster lazy safetensors (#8482)
compilade [Tue, 16 Jul 2024 03:13:10 +0000 (23:13 -0400)]
convert_hf : faster lazy safetensors (#8482)

* convert_hf : faster lazy safetensors

This makes '--dry-run' much, much faster.

* convert_hf : fix memory leak in lazy MoE conversion

The '_lazy' queue was sometimes self-referential,
which caused reference cycles of objects old enough
to avoid garbage collection until potential memory exhaustion.

11 months agoRefactor lora adapter support (#8332)
Xuan Son Nguyen [Mon, 15 Jul 2024 18:50:47 +0000 (20:50 +0200)]
Refactor lora adapter support (#8332)

* lora: load to devide buft

* add patch tensor function

* correct tensor patch

* llama_lora_adapter_apply

* correct ggml_backend_tensor_copy

* add llm_build_mm

* fix auto merge

* update based on review comments

* add convert script

* no more transpose A

* add f16 convert

* add metadata check

* add sanity check

* fix ftype

* add requirements

* fix requirements

* fix outfile

* conversion: only allow selected models

* fix types

* cuda : do not use dmmv if the tensor does not have enough cols

* llama : lora fixes

* do not disable mmap with lora

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

* convert_lora : MoE LoRA conversion support

* convert_lora : prefer safetensors, similarly to convert_hf

* convert_hf : simplify modify_tensors for InternLM2

* convert_lora : lazy conversion

* llama : load and use alpha from LoRA adapters

* llama : use llm_build_lora_mm in most model graphs

* auto scale

* Revert "auto scale"

This reverts commit 42415a4874e0f963e4aca6796ea5dfb97cd17464.

* remove redundant params

* Apply suggestions from code review

Co-authored-by: slaren <redacted>
* change kv metadata

* move add_type to __init__

* convert_hf : move add_type to main()

* convert_lora : use the GGUFWriter from Model instead of overwriting it

---------

Co-authored-by: slaren <redacted>
Co-authored-by: Francis Couture-Harpin <redacted>
11 months agofix ci (#8494)
Xuan Son Nguyen [Mon, 15 Jul 2024 17:23:10 +0000 (19:23 +0200)]
fix ci (#8494)

11 months agoggml : suppress unknown pragma 'GCC' on windows (#8460)
Daniel Bevenius [Mon, 15 Jul 2024 12:48:17 +0000 (14:48 +0200)]
ggml : suppress unknown pragma 'GCC' on windows (#8460)

This commit adds a macro guard to pragma GCC to avoid the following
warning on windows:

```console
C:\llama.cpp\ggml\src\ggml-aarch64.c(17,9): warning C4068:
unknown pragma 'GCC' [C:\lama.cpp\build\ggml\src\ggml.vcxproj]
```

11 months agoserver: update README.md with llama-server --help output [no ci] (#8472)
M-A [Mon, 15 Jul 2024 12:04:56 +0000 (08:04 -0400)]
server: update README.md with llama-server --help output [no ci] (#8472)

The README.md had a stale information. In particular, the --ctx-size
"defaults to 512" confused me and I had to check the code to confirm
this was false. This the server is evolving rapidly, it's probably
better to keep the source of truth at a single place (in the source) and
generate the README.md based on that.

Did:

    make llama-server
    ./llama-server --help > t.txt
    vimdiff t.txt examples/server/README.md

I copied the content inside a backquote block. I would have preferred
proper text but it would require a fair amount of surgery to make the
current output compatible with markdown. A follow up could be to
automate this process with a script.

No functional change.

11 months agocommon : add --no-cont-batching arg (#6358)
Georgi Gerganov [Mon, 15 Jul 2024 11:54:58 +0000 (14:54 +0300)]
common : add --no-cont-batching arg (#6358)

11 months agodocs: fix links in development docs [no ci] (#8481)
NikolaiLyssogor [Mon, 15 Jul 2024 11:46:39 +0000 (04:46 -0700)]
docs: fix links in development docs [no ci] (#8481)

Fixes a few links to within the repo that were broken in the reorganization of the
documentation in #8325.

11 months ago[SYCL] add concat through dim 1/2 (#8483)
Meng, Hengyu [Mon, 15 Jul 2024 11:32:15 +0000 (19:32 +0800)]
[SYCL] add concat through dim 1/2 (#8483)

* add concat through dim 1/2

11 months agollama : de-duplicate deepseek2 norm
Georgi Gerganov [Mon, 15 Jul 2024 11:10:39 +0000 (14:10 +0300)]
llama : de-duplicate deepseek2 norm

11 months agoVulkan MMQ Fix (#8479)
0cc4m [Mon, 15 Jul 2024 07:38:52 +0000 (09:38 +0200)]
Vulkan MMQ Fix (#8479)

* Fix incoherence by adding missing LOAD_VEC_A parameter

* Fix Vulkan op result checker build error

11 months agopydantic : replace uses of __annotations__ with get_type_hints (#8474)
compilade [Sun, 14 Jul 2024 23:51:21 +0000 (19:51 -0400)]
pydantic : replace uses of __annotations__ with get_type_hints (#8474)

* pydantic : replace uses of __annotations__ with get_type_hints

* pydantic : fix Python 3.9 and 3.10 support

11 months agoflake.lock: Update (#8475)
Georgi Gerganov [Sun, 14 Jul 2024 15:54:02 +0000 (18:54 +0300)]
flake.lock: Update (#8475)

Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/9f4128e00b0ae8ec65918efeba59db998750ead6?narHash=sha256-rwz8NJZV%2B387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ%3D' (2024-07-03)
  → 'github:NixOS/nixpkgs/7e7c39ea35c5cdd002cd4588b03a3fb9ece6fad9?narHash=sha256-EYekUHJE2gxeo2pM/zM9Wlqw1Uw2XTJXOSAO79ksc4Y%3D' (2024-07-12)

Co-authored-by: github-actions[bot] <redacted>
11 months agollama : fix Gemma-2 Query scaling factors (#8473)
Georgi Gerganov [Sun, 14 Jul 2024 11:05:09 +0000 (14:05 +0300)]
llama : fix Gemma-2 Query scaling factors (#8473)

* 9B - query_pre_attn_scalar = 256 not 224

See https://github.com/google/gemma_pytorch/commit/03e657582d17cb5a8617ebf333c1c16f3694670e

Gemma 9b should use 256 and not 224 (self.config.hidden_size // self.config.num_attention_heads)

* llama : fix Gemma-2 Query scaling factor

ggml-ci

---------

Co-authored-by: Daniel Han <redacted>
11 months agogguf_hash.py: Add sha256 (#8470)
Brian [Sun, 14 Jul 2024 06:47:14 +0000 (16:47 +1000)]
gguf_hash.py: Add sha256 (#8470)

* gguf_hash.py: Add sha256

* gguf_hash.py: rename string UUIDv5 --> uuid

* Apply suggestions from code review

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

Co-authored-by: compilade <redacted>
11 months agollama : fix pre-tokenization of non-special added tokens (#8228)
compilade [Sun, 14 Jul 2024 03:35:10 +0000 (23:35 -0400)]
llama : fix pre-tokenization of non-special added tokens (#8228)

* llama : fix mpt and olmo pre-tokenizer

* llama : pre-tokenize non-special user-defined tokens first

* llama : fix detection of control-like user-defined tokens

* convert_hf : identify which user-defined tokens are control tokens

Only used in _set_vocab_gpt2() for now.

* convert_hf : identify more added control tokens for SPM tokenziers

This makes Gemma and Gemma-2 tokenize pretty much EVERYTHING correctly,
including HTML tags and consecutive spaces,
but it unfortunately requires model re-conversion.

There seems to be a weird behavior of the HF tokenizer for Gemma,
which prefers to use the 16-space token over more lengthy space tokens,
while using the SentencePiece tokenizer does not do this.
(the implementation in llama.cpp has the same behavior as SentencePiece)

* llama : fix wrong pre-tokenization of byte tokens

* llama : fix Viking pre-tokenizer regex

The order was previously wrong, which caused errors in some tests.

* llama : fix command-r detokenization

* convert_hf : reduce usages of the UNKNOWN token type

* llama : add UNKNOWN tokens in the special tokens cache

* convert_hf : reduce usages of UNKNOWN for InternLM2

This makes the changes from #8321 more consistent
with the other changes made here.

* test-tokenizer-random : reduce potential confilcts with #8379

* test-tokenizer-random : add a failing edge case for falcon

11 months agovulkan : cmake integration (#8119)
bandoti [Sat, 13 Jul 2024 16:12:39 +0000 (13:12 -0300)]
vulkan : cmake integration (#8119)

* Add Vulkan to CMake pkg

* Add Sycl to CMake pkg

* Add OpenMP to CMake pkg

* Split generated shader file into separate translation unit

* Add CMake target for Vulkan shaders

* Update README.md

* Add make target for Vulkan shaders

* Use pkg-config to locate vulkan library

* Add vulkan SDK dep to ubuntu-22-cmake-vulkan workflow

* Clean up tabs

* Move sudo to apt-key invocation

* Forward GGML_EXTRA_LIBS to CMake config pkg

* Update vulkan obj file paths

* Add shaderc to nix pkg

* Add python3 to Vulkan nix build

* Link against ggml in cmake pkg

* Remove Python dependency from Vulkan build

* code review changes

* Remove trailing newline

* Add cflags from pkg-config to fix w64devkit build

* Update README.md

* Remove trailing whitespace

* Update README.md

* Remove trailing whitespace

* Fix doc heading

* Make glslc required Vulkan component

* remove clblast from nix pkg

11 months agometal : template-ify some of the kernels (#8447)
Georgi Gerganov [Sat, 13 Jul 2024 15:32:33 +0000 (18:32 +0300)]
metal : template-ify some of the kernels (#8447)

ggml-ci

11 months agoserver : handle content array in chat API (#8449)
Georgi Gerganov [Fri, 12 Jul 2024 11:48:15 +0000 (14:48 +0300)]
server : handle content array in chat API (#8449)

* server : handle content array in chat API

* Update examples/server/utils.hpp

Co-authored-by: Xuan Son Nguyen <redacted>
---------

Co-authored-by: Xuan Son Nguyen <redacted>
11 months agomain : print error on empty input (#8456)
Georgi Gerganov [Fri, 12 Jul 2024 11:48:04 +0000 (14:48 +0300)]
main : print error on empty input (#8456)

11 months agollama : suppress unary minus operator warning (#8448)
Daniel Bevenius [Fri, 12 Jul 2024 09:05:21 +0000 (11:05 +0200)]
llama : suppress unary minus operator warning (#8448)

This commit updates the _try_copy lambda and moves the unary minus
operator to after the cast to int32_t.

The motivation for this that currently the following warning is
generated on windows:

```console
llama.cpp\src\llama.cpp(21147,30): warning C4146: unary minus operator
applied to unsigned type, result still unsigned
```

11 months agoserver : ensure batches are either all embed or all completion (#8420)
Douglas Hanley [Fri, 12 Jul 2024 08:14:12 +0000 (03:14 -0500)]
server : ensure batches are either all embed or all completion (#8420)

* make sure batches are all embed or all non-embed

* non-embedding batch for sampled tokens; fix unused params warning

11 months agodocker : fix filename for convert-hf-to-gguf.py in tools.sh (#8441)
Armen Kaleshian [Fri, 12 Jul 2024 08:08:19 +0000 (04:08 -0400)]
docker : fix filename for convert-hf-to-gguf.py in tools.sh (#8441)

Commit b0a4699 changed the name of this script from convert-hf-to-gguf.py to
convert_hf_to_gguf.py breaking how convert is called from within a Docker
container.

11 months agoconvert : remove fsep token from GPTRefactForCausalLM (#8237)
Jiří Podivín [Fri, 12 Jul 2024 08:06:33 +0000 (10:06 +0200)]
convert : remove fsep token from GPTRefactForCausalLM (#8237)

The <filename> token used by Refact doesn't serve
the same purpose as the <file_separator> from CodeGemma.

Signed-off-by: Jiri Podivin <redacted>
11 months agoexamples : sprintf -> snprintf (#8434)
Georgi Gerganov [Fri, 12 Jul 2024 07:46:14 +0000 (10:46 +0300)]
examples : sprintf -> snprintf (#8434)

* examples : sprintf -> snprintf

ggml-ci

* examples : use sizeof() instead of hardcoded constants

11 months agoggml : minor naming changes (#8433)
Georgi Gerganov [Fri, 12 Jul 2024 07:46:02 +0000 (10:46 +0300)]
ggml : minor naming changes (#8433)

* ggml : minor naming changes

ggml-ci

* ggml : use PRId64 [no ci]

* ggml : revert FA K/Q names

11 months ago[SYCL] fix the mul_mat_id ut issues (#8427)
Chen Xi [Fri, 12 Jul 2024 00:52:04 +0000 (00:52 +0000)]
[SYCL] fix the mul_mat_id ut issues (#8427)

* fix part of mul_mat_id

* skip the bfloat 16 sycl ut

Signed-off-by: Chen Xi <redacted>
---------

Signed-off-by: Chen Xi <redacted>
Co-authored-by: Meng, Hengyu <redacted>
Co-authored-by: Chen Xi <redacted>
11 months agoggml : add NVPL BLAS support (#8329) (#8425)
Nicholai Tukanov [Thu, 11 Jul 2024 16:49:15 +0000 (11:49 -0500)]
ggml : add NVPL BLAS support (#8329) (#8425)

* ggml : add NVPL BLAS support

* ggml : replace `<BLASLIB>_ENABLE_CBLAS` with `GGML_BLAS_USE_<BLASLIB>`

---------

Co-authored-by: ntukanov <redacted>
11 months agocuda : suppress 'noreturn' warn in no_device_code (#8414)
Daniel Bevenius [Thu, 11 Jul 2024 15:53:42 +0000 (17:53 +0200)]
cuda : suppress 'noreturn' warn in no_device_code (#8414)

* cuda : suppress 'noreturn' warn in no_device_code

This commit adds a while(true) loop to the no_device_code function in
common.cuh. This is done to suppress the warning:

```console
/ggml/src/ggml-cuda/template-instances/../common.cuh:346:1: warning:
function declared 'noreturn' should not return [-Winvalid-noreturn]
  346 | }
      | ^
```

The motivation for this is to reduce the number of warnings when
compilng with GGML_HIPBLAS=ON.

Signed-off-by: Daniel Bevenius <redacted>
* squash! cuda : suppress 'noreturn' warn in no_device_code

Update __trap macro instead of using a while loop to suppress the
warning.

Signed-off-by: Daniel Bevenius <redacted>
---------

Signed-off-by: Daniel Bevenius <redacted>
11 months agoCUDA: optimize and refactor MMQ (#8416)
Johannes Gäßler [Thu, 11 Jul 2024 14:47:47 +0000 (16:47 +0200)]
CUDA: optimize and refactor MMQ (#8416)

* CUDA: optimize and refactor MMQ

* explicit q8_1 memory layouts, add documentation

11 months agogitignore : deprecated binaries
Georgi Gerganov [Thu, 11 Jul 2024 08:20:40 +0000 (11:20 +0300)]
gitignore : deprecated binaries

11 months agotokenize : add --no-parse-special option (#8423)
compilade [Thu, 11 Jul 2024 07:41:48 +0000 (03:41 -0400)]
tokenize : add --no-parse-special option (#8423)

This should allow more easily explaining
how parse_special affects tokenization.

11 months agollama : use F32 precision in Qwen2 attention and no FA (#8412)
Georgi Gerganov [Thu, 11 Jul 2024 07:21:30 +0000 (10:21 +0300)]
llama : use F32 precision in Qwen2 attention and no FA (#8412)

11 months agoInitialize default slot sampling parameters from the global context. (#8418)
Clint Herron [Thu, 11 Jul 2024 00:08:17 +0000 (20:08 -0400)]
Initialize default slot sampling parameters from the global context. (#8418)

11 months agoName Migration: Build the deprecation-warning 'main' binary every time (#8404)
Clint Herron [Wed, 10 Jul 2024 16:35:18 +0000 (12:35 -0400)]
Name Migration: Build the deprecation-warning 'main' binary every time (#8404)

* Modify the deprecation-warning 'main' binary to build every time, instead of only when a legacy binary is present. This is to help users of tutorials and other instruction sets from knowing what to do when the 'main' binary is missing and they are trying to follow instructions.

* Adjusting 'server' name-deprecation binary to build all the time, similar to the 'main' legacy name binary.

11 months ago[SYCL] Use multi_ptr to clean up deprecated warnings (#8256)
AidanBeltonS [Wed, 10 Jul 2024 15:10:49 +0000 (16:10 +0100)]
[SYCL] Use multi_ptr to clean up deprecated warnings (#8256)

11 months agoggml : move sgemm sources to llamafile subfolder (#8394)
Georgi Gerganov [Wed, 10 Jul 2024 12:23:29 +0000 (15:23 +0300)]
ggml : move sgemm sources to llamafile subfolder (#8394)

ggml-ci

11 months agoggml : add AArch64 optimized GEMV and GEMM Q4 kernels (#5780)
Dibakar Gope [Wed, 10 Jul 2024 12:14:51 +0000 (07:14 -0500)]
ggml : add AArch64 optimized GEMV and GEMM Q4 kernels (#5780)

* Arm AArch64: optimized GEMV and GEMM kernels for q4_0_q8_0, and q8_0_q8_0 quantization

* Arm AArch64: add optimized GEMV and GEMM asm kernels for q4_0_q8_0 quantization and refactor code to address llama.cpp pr#5780 suggestions

* Arm AArch64: add optimized GEMV and GEMM asm kernels for q4_0_q8_0 quantization and refactor code to address llama.cpp pr#5780 suggestions

* Arm AArch64: add optimized GEMV and GEMM asm kernels for q4_0_q8_0 quantization and refactor code to address llama.cpp pr#5780 suggestions

* Arm AArch64: add optimized GEMV and GEMM asm kernels for q4_0_q8_0 quantization and refactor code to address llama.cpp pr#5780 suggestions

* Arm AArch64: add copyright claim only to ggml-aarch64.cpp and ggml-aarch64.h files

* Arm AArch64: minor code refactoring for rebase

* Arm AArch64: minor code refactoring for resolving a build issue with cmake

* Arm AArch64: minor code refactoring to split the Q4_0_AARC64 type into three separate types: Q4_0_4_4, Q4_0_4_8, and Q4_0_8_8

* Arm AArch64: minor code change for resolving a build issue with server-windows

* retrigger checks

* Arm AArch64: minor code changes for rebase

* Arm AArch64: minor changes to skip the pr#7433 vec_dot code for arm cpus with SVE VL not equal to 256 bits

* Arm AArch64: remove stale LLAMA_QKK_64 from CMakeLists.txt and delete build.zig

* Arm AArch64: add reference scalar gemm and gemv, and avoid dynamic memory allocations during quantization for Q4_0_4_4, Q4_0_4_8, and Q4_0_8_8

* Arm AArch64: add multithreaded quantization support for the new types: Q4_0_4_4, Q4_0_4_8, and Q4_0_8_8

* Arm AArch64: minor code refactoring

* Arm AArch64: simplify logic for calling gemm and gemv functions in ggml_compute_forward_mul_mat

* Arm AArch64: minimize changes in ggml_compute_forward_mul_mat

* Arm AArch64: minor code refactoring, and add reference scalar code to quantize routines for new quant types

* Arm AArch64: minor code refactoring

* Arm AArch64: minor code refactoring

* Arm AArch64: minor code refactoring

* rebase on the latest master commit 3fd62a6 and adapt to the new directory structure

* Arm AArch64: remove a redundant comment

* Arm AArch64: add pragma in ggml-aarch64.c to turn -Woverlength-strings warning off

* Arm AArch64: use __aarch64__ check to guard 64-bit neon kernels

* Arm AArch64: update docs/build.md README to include compile time flags for buiilding the Q4_0_4_4 quant type

11 months agogguf-py rel pipeline (#8410)
M. Yusuf Sarıgöz [Wed, 10 Jul 2024 12:12:35 +0000 (15:12 +0300)]
gguf-py rel pipeline (#8410)

* Upd gguf-py/readme

* Bump patch version for release

11 months agollama : C++20 compatibility for u8 strings (#8408)
Borislav Stanimirov [Wed, 10 Jul 2024 11:45:44 +0000 (14:45 +0300)]
llama : C++20 compatibility for u8 strings (#8408)

11 months agomsvc : silence codecvt c++17 deprecation warnings (#8395)
Borislav Stanimirov [Wed, 10 Jul 2024 11:40:53 +0000 (14:40 +0300)]
msvc : silence codecvt c++17 deprecation warnings (#8395)

11 months agollama : add assert about missing llama_encode() call (#8400)
fairydreaming [Wed, 10 Jul 2024 11:38:58 +0000 (13:38 +0200)]
llama : add assert about missing llama_encode() call (#8400)

Co-authored-by: Stanisław Szymczyk <redacted>
11 months agopy : fix converter for internlm2 (#8321)
RunningLeon [Wed, 10 Jul 2024 11:26:40 +0000 (19:26 +0800)]
py : fix converter for internlm2 (#8321)

* update internlm2

* remove unused file

* fix lint

11 months agopy : fix extra space in convert_hf_to_gguf.py (#8407)
laik [Wed, 10 Jul 2024 11:19:10 +0000 (19:19 +0800)]
py : fix extra space in convert_hf_to_gguf.py (#8407)

11 months agoServer: Enable setting default sampling parameters via command-line (#8402)
Clint Herron [Tue, 9 Jul 2024 22:26:40 +0000 (18:26 -0400)]
Server: Enable setting default sampling parameters via command-line (#8402)

* Load server sampling parameters from the server context by default.

* Wordsmithing comment

11 months agoUpdate README.md to fix broken link to docs (#8399)
Andy Salerno [Tue, 9 Jul 2024 18:58:44 +0000 (11:58 -0700)]
Update README.md to fix broken link to docs (#8399)

Update the "Performance troubleshooting" doc link to be correct - the file was moved into a dir called 'development'

11 months agoDeprecation warning to assist with migration to new binary names (#8283)
Clint Herron [Tue, 9 Jul 2024 15:54:43 +0000 (11:54 -0400)]
Deprecation warning to assist with migration to new binary names (#8283)

* Adding a simple program to provide a deprecation warning that can exist to help people notice the binary name change from #7809 and migrate to the new filenames.

* Build legacy replacement binaries only if they already exist. Check for their existence every time so that they are not ignored.

11 months agomake/cmake: LLAMA_NO_CCACHE -> GGML_NO_CCACHE (#8392)
Johannes Gäßler [Tue, 9 Jul 2024 15:11:07 +0000 (17:11 +0200)]
make/cmake: LLAMA_NO_CCACHE -> GGML_NO_CCACHE (#8392)

11 months agosycl : Reenabled mmvq path for the SYCL Nvidia Backend (#8372)
Alberto Cabrera Pérez [Tue, 9 Jul 2024 14:03:15 +0000 (15:03 +0100)]
sycl : Reenabled mmvq path for the SYCL Nvidia Backend (#8372)

* SYCL : Reenabled mmvq path for the SYCL Nvidia Backend

* Reduced verbosity of comment

11 months agocmake : allow external ggml (#8370)
Borislav Stanimirov [Tue, 9 Jul 2024 08:38:00 +0000 (11:38 +0300)]
cmake : allow external ggml (#8370)

11 months agoreadme : fix typo [no ci] (#8389)
daghanerdonmez [Tue, 9 Jul 2024 06:16:00 +0000 (09:16 +0300)]
readme : fix typo [no ci] (#8389)

Bakus-Naur --> Backus-Naur

11 months agogguf-py : do not use internal numpy types (#7472)
compilade [Tue, 9 Jul 2024 05:04:49 +0000 (01:04 -0400)]
gguf-py : do not use internal numpy types (#7472)

11 months agoflake.lock: Update (#8342)
Georgi Gerganov [Mon, 8 Jul 2024 22:36:38 +0000 (01:36 +0300)]
flake.lock: Update (#8342)

Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8?narHash=sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw%3D' (2024-06-01)
  → 'github:hercules-ci/flake-parts/9227223f6d922fee3c7b190b2cc238a99527bbb7?narHash=sha256-pQMhCCHyQGRzdfAkdJ4cIWiw%2BJNuWsTX7f0ZYSyz0VY%3D' (2024-07-03)
• Updated input 'flake-parts/nixpkgs-lib':
    'https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz?narHash=sha256-lIbdfCsf8LMFloheeE6N31%2BBMIeixqyQWbSr2vk79EQ%3D' (2024-06-01)
  → 'https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz?narHash=sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI%3D' (2024-07-01)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/b2852eb9365c6de48ffb0dc2c9562591f652242a?narHash=sha256-C8e9S7RzshSdHB7L%2Bv9I51af1gDM5unhJ2xO1ywxNH8%3D' (2024-06-27)
  → 'github:NixOS/nixpkgs/9f4128e00b0ae8ec65918efeba59db998750ead6?narHash=sha256-rwz8NJZV%2B387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ%3D' (2024-07-03)

Co-authored-by: github-actions[bot] <redacted>
11 months agolabeler : updated sycl to match docs and code refactor (#8373)
Alberto Cabrera Pérez [Mon, 8 Jul 2024 20:35:17 +0000 (21:35 +0100)]
labeler : updated sycl to match docs and code refactor (#8373)

11 months agoreadme : fix web link error [no ci] (#8347)
b4b4o [Mon, 8 Jul 2024 14:19:24 +0000 (22:19 +0800)]
readme : fix web link error [no ci] (#8347)

11 months agosycl : fix powf call in device code (#8368)
Alberto Cabrera Pérez [Mon, 8 Jul 2024 13:22:41 +0000 (14:22 +0100)]
sycl : fix powf call in device code (#8368)

11 months agoscripts : fix sync for sycl
Georgi Gerganov [Mon, 8 Jul 2024 10:51:31 +0000 (13:51 +0300)]
scripts : fix sync for sycl

11 months agosync : ggml
Georgi Gerganov [Mon, 8 Jul 2024 07:39:50 +0000 (10:39 +0300)]
sync : ggml

ggml-ci

11 months agotests : fix whitespace (#0)
Georgi Gerganov [Mon, 8 Jul 2024 07:39:36 +0000 (10:39 +0300)]
tests : fix whitespace (#0)

11 months agofeat: cuda implementation for `ggml_conv_transpose_1d` (ggml/854)
John Balis [Tue, 2 Jul 2024 16:09:52 +0000 (11:09 -0500)]
feat: cuda implementation for `ggml_conv_transpose_1d` (ggml/854)

* conv transpose 1d passing test for 1d input and kernel

* working for different input and output channel counts, added test for variable stride

* initial draft appears to work with stride other than 1

* working with all old and new conv1d  tests

* added a test for large tensors

* removed use cuda hardcoding

* restored test-conv-transpose.c

* removed unused arugments, and fixed bug where test failure would cause subsequent tests to fail

* fixed accumulator bug

* added test to test-backend-ops

* fixed mistake

* addressed review

* fixed includes

* removed blank lines

* style and warning fixes

* return failure when test fails

* fix supports_op

---------

Co-authored-by: slaren <redacted>
11 months agocommon : preallocate sampling token data vector (#8363)
Kevin Wang [Mon, 8 Jul 2024 07:26:53 +0000 (03:26 -0400)]
common : preallocate sampling token data vector (#8363)

`emplace_back` repeatedly-called is slower than preallocating the vector to the vocab size and directly inserting the data. Some rudimentary profiling with `chrono` improves the performance of this block of code from ~500us/op to ~40us/op.

Overall, this slightly improves the sampling performance which has a more substantial impact for the `examples/lookahead` implementation -- I am able to see a ~10% performance boost in lookahead inference.

11 months agoinfill : assert prefix/suffix tokens + remove old space logic (#8351)
Georgi Gerganov [Mon, 8 Jul 2024 06:34:35 +0000 (09:34 +0300)]
infill : assert prefix/suffix tokens + remove old space logic (#8351)

11 months agocommon : avoid unnecessary logits fetch (#8358)
Kevin Wang [Mon, 8 Jul 2024 06:31:55 +0000 (02:31 -0400)]
common : avoid unnecessary logits fetch (#8358)

11 months agoreadme : add supported glm models (#8360)
toyer [Mon, 8 Jul 2024 05:57:19 +0000 (13:57 +0800)]
readme : add supported glm models (#8360)

11 months agopy : type-check all Python scripts with Pyright (#8341)
compilade [Sun, 7 Jul 2024 19:04:39 +0000 (15:04 -0400)]
py : type-check all Python scripts with Pyright (#8341)

* py : type-check all Python scripts with Pyright

* server-tests : use trailing slash in openai base_url

* server-tests : add more type annotations

* server-tests : strip "chat" from base_url in oai_chat_completions

* server-tests : model metadata is a dict

* ci : disable pip cache in type-check workflow

The cache is not shared between branches, and it's 250MB in size,
so it would become quite a big part of the 10GB cache limit of the repo.

* py : fix new type errors from master branch

* tests : fix test-tokenizer-random.py

Apparently, gcc applies optimisations even when pre-processing,
which confuses pycparser.

* ci : only show warnings and errors in python type-check

The "information" level otherwise has entries
from 'examples/pydantic_models_to_grammar.py',
which could be confusing for someone trying to figure out what failed,
considering that these messages can safely be ignored
even though they look like errors.

11 months agoUpdate llama-cli documentation (#8315)
Denis Spasyuk [Sun, 7 Jul 2024 15:08:28 +0000 (09:08 -0600)]
Update llama-cli documentation (#8315)

* Update README.md

* Update README.md

* Update README.md

fixed llama-cli/main, templates on some cmds added chat template sections and fixed typos in some areas

* Update README.md

* Update README.md

* Update README.md

11 months agoci : add checks for cmake,make and ctest in ci/run.sh (#8200)
Alex Tuddenham [Sun, 7 Jul 2024 14:59:14 +0000 (15:59 +0100)]
ci : add checks for cmake,make and ctest in ci/run.sh (#8200)

* Added checks for cmake,make and ctest

* Removed erroneous whitespace

11 months agoreadme : update bindings list (#8222)
Andy Tai [Sun, 7 Jul 2024 13:21:37 +0000 (06:21 -0700)]
readme : update bindings list (#8222)

* adding guile_llama_cpp  to binding list

* fix formatting

* fix formatting

11 months agogguf-hash: model wide and per tensor hashing using xxhash and sha1 (#8048)
Brian [Sun, 7 Jul 2024 12:58:43 +0000 (22:58 +1000)]
gguf-hash: model wide and per tensor hashing using xxhash and sha1 (#8048)

CLI to hash GGUF files to detect difference on a per model and per tensor level

The hash type we support is:

- `--xxh64`: use xhash 64bit hash mode (default)
- `--sha1`: use sha1
- `--uuid`: use uuid
- `--sha256`: use sha256

While most POSIX systems already have hash checking programs like sha256sum, it
is designed to check entire files. This is not ideal for our purpose if we want
to check for consistency of the tensor data even if the metadata content of the
gguf KV store has been updated.

This program is designed to hash a gguf tensor payload on a 'per tensor layer'
in addition to a 'entire tensor model' hash. The intent is that the entire
tensor layer can be checked first but if there is any detected inconsistencies,
then the per tensor hash can be used to narrow down the specific tensor layer
that has inconsistencies.

Co-authored-by: Georgi Gerganov <redacted>
11 months agollama : support glm3 and glm4 (#8031)
toyer [Sun, 7 Jul 2024 12:52:10 +0000 (20:52 +0800)]
llama : support glm3 and glm4 (#8031)

* add chatglm3-6b model support huggingface model:
 https://hf-mirror.com/THUDM/chatglm3-6b

Signed-off-by: XingXing Qiao <redacted>
* remove .rotary_pos_emb.inv_freq and unuse code for chatglm3 model

Signed-off-by: XingXing Qiao <redacted>
* fix lint error

Signed-off-by: XingXing Qiao <redacted>
* optimize convert-hf-to-gguf.py for chatglm model

Signed-off-by: XingXing Qiao <redacted>
* support glm-4-9b-chat

Signed-off-by: XingXing Qiao <redacted>
* fix eos tokens to glm4

* remove unused log

* add preprocess to chatglm3 and chatglm4

* add eos_id_list to llama.cpp

* fix code style

* fix code style

* fix conflicts

* fix conflicts

* Revert "add eos_id_list to llama.cpp"

This reverts commit 3a4d5790bfdc205c5b658204239f168fc21cc1a8.

* set <|endoftext|> as eos and <|user|> as eot

* fix chat template bug

* add comment to glm prefix and suffix

* fix conflicts and add rope_ratio & ChatGLMForConditionalGeneration

* fix chat template bug

* fix codestyle

* fix conflicts

* modified the general name of glm model

* fix conflicts

* remove prefix and suffix

* use normal glm4 chattempalte & use LLM_FFN_SWIGLU in phi3

* fix: resolve Flake8 errors in `convert-hf-to-gguf.py`

- Fix E302 by adding two blank lines before top-level function definitions
- Replace print statements to fix NP100
- Fix E303 by ensuring only one blank line between lines of code

* fix rope ratio to solve incorrect answers

* fix by comments

---------

Signed-off-by: XingXing Qiao <redacted>
Co-authored-by: XingXing Qiao <redacted>
Co-authored-by: Umpire2018 <redacted>
11 months agollama : fix n_rot default (#8348)
Georgi Gerganov [Sun, 7 Jul 2024 11:59:02 +0000 (14:59 +0300)]
llama : fix n_rot default (#8348)

ggml-ci

11 months agopy : use cpu-only torch in requirements.txt (#8335)
compilade [Sun, 7 Jul 2024 11:23:38 +0000 (07:23 -0400)]
py : use cpu-only torch in requirements.txt (#8335)

11 months agofinetune: Rename command name in README.md (#8343)
standby24x7 [Sun, 7 Jul 2024 10:38:02 +0000 (19:38 +0900)]
finetune: Rename command name in README.md (#8343)

Rename an old command name "finetune" to "llama-finetune"
in README.md

Signed-off-by: Masanari Iida <redacted>
11 months agofinetune: Rename an old command name in finetune.sh (#8344)
standby24x7 [Sun, 7 Jul 2024 10:37:47 +0000 (19:37 +0900)]
finetune: Rename an old command name in finetune.sh (#8344)

This patch replaces an old commad "main" with "llama-cli"
in finetune.sh.
The part that I fixed is comment, so it doesn't change
the script.

Signed-off-by: Masanari Iida <redacted>
11 months agoserver: Retrieve prompt template in /props (#8337)
Bjarke Viksøe [Sun, 7 Jul 2024 09:10:38 +0000 (11:10 +0200)]
server: Retrieve prompt template in /props (#8337)

* server: Retrieve prompt template in /props

This PR adds the following:
- Expose the model's Jinja2 prompt template from the model in the /props endpoint.
- Change log-level from Error to Warning for warning about template mismatch.

The front-end stands a better chance of actually executing the Jinja template format correctly. Server is currently just guessing it.

Ideally this should have been inside a JSON block that expose the same key/value pairs as listed during startup in "llm_load_print_meta" function.

* Make string buffer dynamic

* Add doc and better string handling

* Using chat_template naming convention

* Use intermediate vector for string assignment

11 months agoadded support for Authorization Bearer tokens when downloading model (#8307)
Derrick T. Woolworth [Sat, 6 Jul 2024 20:32:04 +0000 (15:32 -0500)]
added support for Authorization Bearer tokens when downloading model (#8307)

* added support for Authorization Bearer tokens

* removed auth_token, removed set_ function, other small fixes

* Update common/common.cpp

---------

Co-authored-by: Xuan Son Nguyen <redacted>
11 months agoupdate main readme (#8333)
Xuan Son Nguyen [Sat, 6 Jul 2024 17:01:23 +0000 (19:01 +0200)]
update main readme (#8333)

11 months agollama : add early return for empty range (#8327)
Daniel Bevenius [Sat, 6 Jul 2024 07:22:16 +0000 (09:22 +0200)]
llama : add early return for empty range (#8327)

* llama : add early return for empty range

This commit adds an early return to the llama_kv_cache_seq_add and
llama_kv_cache_seq_div functions.

The motivation for adding this is to avoid looping over the cache
when the range is empty. I ran into this when using the self-extend
feature in main.cpp.

Signed-off-by: Daniel Bevenius <redacted>
* llama : add static_cast to fix CI warning/error

This commit attempts to fix the following warning/error:

```console
src/llama.cpp:7271:31: error:
comparison of integer expressions of different signedness:
‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare]
 7271 |                         if (i < hparams.n_layer_dense_lead) {
      |                             ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
This can be reproduced locally by setting -Wsign-compare in the
Makefile.

Signed-off-by: Daniel Bevenius <redacted>
* squash! llama : add early return for empty range

Remove the setting of cache.head to 0 when the range is empty.

Signed-off-by: Daniel Bevenius <redacted>
* Update src/llama.cpp

---------

Signed-off-by: Daniel Bevenius <redacted>
Co-authored-by: Georgi Gerganov <redacted>
11 months agoDetokenizer fixes (#8039)
jaime-m-p [Fri, 5 Jul 2024 17:01:35 +0000 (19:01 +0200)]
Detokenizer fixes (#8039)

* Add llama_detokenize():
  - Update header files location
  - UNKNOWN and CONTROL are 'special pieces'
  - Remove space after UNKNOWN and CONTROL
  - Refactor llama_token_to_piece()
  - Add flag: clean_up_tokenization_spaces
  - Symmetric params for llama_tokenize() and llama_detokenize()

* Update and fix tokenizer tests:
  - Using llama_detokenize()
  - Unexpected vocab type as test fail instead of error
    - Useful when automating tests:
    - If you don't know in advance the vocab type
    - Differenciate other loading errors
  - Skip unicode surrogaes and undefined
  - Gracefully exit threads
    - Using exit() is throwing random exceptions
  - Clean old known problematic codepoints
  - Minor: confusing hexadecimal codepoint

* Update bruteforce random tests
  - Add detokenizer checks
  - New generator: ascii_lr_strip
  - New generator: apostrophe
  - Add more vocabs files
  - Detokenize special tokens.
  - Replace errors with '\uFFFD' when detokenizing to 'utf-8'
  - More edge cases
  - Better detokenization results check

* Fix add_space_prefix, set false by default
* Better leading space removal
* Do not remove space when decoding special tokens
* Bugfix: custom regexs splits undefined unicode codepoints
* 'viking' detokenizer clean spaces

11 months agoReorganize documentation pages (#8325)
Xuan Son Nguyen [Fri, 5 Jul 2024 16:08:32 +0000 (18:08 +0200)]
Reorganize documentation pages (#8325)

* re-organize docs

* add link among docs

* add link to build docs

* fix style

* de-duplicate sections

11 months agollama : fix compile warning (#8304)
Georgi Gerganov [Fri, 5 Jul 2024 14:32:09 +0000 (17:32 +0300)]
llama : fix compile warning (#8304)