]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/log
pkg/ggml/sources/llama.cpp
22 months agofalcon : fix CUDA inference by making K and Q contiguous (#2830)
Georgi Gerganov [Sun, 27 Aug 2023 13:40:48 +0000 (16:40 +0300)]
falcon : fix CUDA inference by making K and Q contiguous (#2830)

* falcon : fix CUDA inference by making K and Q contiguous

ggml-ci

* cuda : add assert to guard from non-cont ropes

22 months agoreadme : fix headings
Georgi Gerganov [Sun, 27 Aug 2023 12:52:34 +0000 (15:52 +0300)]
readme : fix headings

22 months agoscripts : helper convert script
Georgi Gerganov [Sun, 27 Aug 2023 12:24:40 +0000 (15:24 +0300)]
scripts : helper convert script

22 months agok_quants tuning for Falcon-7b (#2816)
Kawrakow [Sun, 27 Aug 2023 12:19:59 +0000 (15:19 +0300)]
k_quants tuning for Falcon-7b (#2816)

* Make ggml-cuda.cu build with QK_K = 64

Using LLAMA_CUDA_FORCE_DMMV = ON and -nommq it runs and produces
a meaningful result.

* k_quants tuning for Falcon-7b

---------

Co-authored-by: Iwan Kawrakow <redacted>
22 months agoreadme : update hot topics
Georgi Gerganov [Sun, 27 Aug 2023 11:44:35 +0000 (14:44 +0300)]
readme : update hot topics

22 months agogguf : add 64-bit support (GGUF v2) (#2821)
Georgi Gerganov [Sun, 27 Aug 2023 11:19:54 +0000 (14:19 +0300)]
gguf : add 64-bit support (GGUF v2) (#2821)

* gguf : bump version to 2

* gguf : add support for 64-bit (no backwards comp yet)

* gguf : v1 backwards comp

* gguf.py : bump GGUF version

* gguf.py : uint64_t on all lengths, sizes and counts, enums still uint32_t

* gguf.py : string lengths uint32_t

* gguf : update all counts to 64-bit

* gguf.py : string len uint64_t and n_dims uint32_t

* gguf : fix typo

* llama.cpp : print gguf version

---------

Co-authored-by: klosax <redacted>
22 months agollama : more tokenizer fixes (#2810)
Georgi Gerganov [Sun, 27 Aug 2023 11:19:19 +0000 (14:19 +0300)]
llama : more tokenizer fixes (#2810)

* tests : write a Python tokenizer test (wip)

* llama : prefix input text for tokenization with whitespace

* llama : distinguish pieces from decoded text + fix detokenization

* common : add comments

* examples : no longer manually add leading space when tokenizing

* tests : use Python to generate tokenizer tests for C++

* tests : add option to tokenize text files

ggml-ci

* tests : add test-tokenizer-1.py

* llama.cpp : fix LF token

* hellaswag : move the concat space for clarity

* tests : add falcon tests (py + cpp, currently do not pass Unicode)

ggml-ci

* common : temporary separate llama_detokenize calls for SPM and BPE

---------

Co-authored-by: klosax <redacted>
22 months agoggml : detect SSSE3 (#2825)
Przemysław Pawełczyk [Sun, 27 Aug 2023 08:10:25 +0000 (10:10 +0200)]
ggml : detect SSSE3 (#2825)

* ggml : add ggml_cpu_has_ssse3

* llama : show SSSE3 in system info

22 months agoci : add LoRA test to CI (#2650)
slaren [Sun, 27 Aug 2023 07:03:27 +0000 (09:03 +0200)]
ci : add LoRA test to CI (#2650)

* ci : add lora test

ggml-ci

* move lora summary to the top, add lora logs

ggml-ci

* ci : decrease CPU ppl runs to 2 to avoide 20 min timeout

ggml-ci

* add 7b lora test

use 1 thread for CUDA generation tests

ggml-ci

* add test with q8_0 (cpu only)

ggml-ci

---------

Co-authored-by: Georgi Gerganov <redacted>
22 months agoserver : add `/detokenize` endpoint (#2802)
Bruce MacDonald [Sat, 26 Aug 2023 23:11:45 +0000 (16:11 -0700)]
server : add `/detokenize` endpoint (#2802)

* Add a /detokenize endpoint to the example server

* remove trailing white-space

22 months agoconvert.py : advanced option (#2753)
Kerfuffle [Sat, 26 Aug 2023 20:13:36 +0000 (14:13 -0600)]
convert.py : advanced option (#2753)

* Allow convert.py to convert to q8_0

Fix issue with bounded_parallel_map and greedy consuming iterator

Display elapsed time during conversion

* Add --concurrency option

Minor improvements to help text

Clean up bounded_parallel_map function a bit

* Massive speed improvement thanks to Cebtenzzre

* Refactor types

22 months agollama : use Unicode Escape Sequence to replace encoded characters (#2814)
Tim Miller [Sat, 26 Aug 2023 18:27:07 +0000 (03:27 +0900)]
llama : use Unicode Escape Sequence to replace encoded characters (#2814)

The use of special characters within source files can break compiling on some computers with different region and language settings. Using Unicode escape sequences should allow for the code to be compiled on all setups without needing to change your computers settings or switch regions.

22 months agoflake.nix : add rocm support and cleanup (#2808)
Tungsten842 [Sat, 26 Aug 2023 18:19:44 +0000 (20:19 +0200)]
flake.nix : add rocm support and cleanup (#2808)

22 months agollama : move #includes out of _GNU_SOURCE conditional (#2817)
Cebtenzzre [Sat, 26 Aug 2023 18:17:51 +0000 (14:17 -0400)]
llama : move #includes out of _GNU_SOURCE conditional (#2817)

22 months agomain : fix bug (penalize_nl=false doesn't work) + suppress warning on mingw (#1528)
Dr. Tom Murphy VII Ph.D [Sat, 26 Aug 2023 18:12:56 +0000 (14:12 -0400)]
main : fix bug (penalize_nl=false doesn't work) + suppress warning on mingw (#1528)

* Fix bug in main.cpp where penalize_nl=false has no effect. It modifies the underlying logits array, but at this point we are already working on the candidates copy.

* Suppress redefinition warning for NOMINMAX on mingw. In my installation, this macro is already defined by /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/os_defines.h:45.

* main : fix indentation

* main : pass ctx to llama_token_nl()

---------

Co-authored-by: Georgi Gerganov <redacted>
22 months agollama : use std::abs in llama_sample_tail_free (#2800)
Cebtenzzre [Sat, 26 Aug 2023 16:53:52 +0000 (12:53 -0400)]
llama : use std::abs in llama_sample_tail_free (#2800)

Plain 'abs' casts the input to int.

22 months agok-quants : remove unnecessary tensor shape restrictions (#2811)
Georgi Gerganov [Sat, 26 Aug 2023 14:37:35 +0000 (17:37 +0300)]
k-quants : remove unnecessary tensor shape restrictions (#2811)

22 months agoBetter perplexity for 2- and 3-bit quantization for LLaMA-v2-70B (#2807)
Kawrakow [Sat, 26 Aug 2023 14:27:49 +0000 (17:27 +0300)]
Better perplexity for 2- and 3-bit quantization for LLaMA-v2-70B (#2807)

* Better perplexity for 2- and 3-bit quantization for the 70B model

* PR comment

---------

Co-authored-by: Iwan Kawrakow <redacted>
22 months agoFix HellaSwag (#2805)
Kawrakow [Sat, 26 Aug 2023 13:48:53 +0000 (16:48 +0300)]
Fix HellaSwag (#2805)

Co-authored-by: Iwan Kawrakow <redacted>
22 months agoflake : build llama.cpp on Intel with nix (#2795)
Volodymyr Vitvitskyi [Sat, 26 Aug 2023 13:25:39 +0000 (14:25 +0100)]
flake : build llama.cpp on Intel with nix (#2795)

Problem
-------
`nix build` fails with missing `Accelerate.h`.

Changes
-------
- Fix build of the llama.cpp with nix for Intel: add the same SDK frameworks as
for ARM
- Add `quantize` app to the output of nix flake
- Extend nix devShell with llama-python so we can use convertScript

Testing
-------
Testing the steps with nix:
1. `nix build`
Get the model and then
2. `nix develop` and then `python convert.py models/llama-2-7b.ggmlv3.q4_0.bin`
3. `nix run llama.cpp#quantize -- open_llama_7b/ggml-model-f16.gguf ./models/ggml-model-q4_0.bin 2`
4. `nix run llama.cpp#llama -- -m models/ggml-model-q4_0.bin -p "What is nix?" -n 400 --temp 0.8 -e -t 8`

Co-authored-by: Volodymyr Vitvitskyi <redacted>
22 months agoHandle null rope scaling value (#2793)
Nigel Bosch [Sat, 26 Aug 2023 12:11:17 +0000 (07:11 -0500)]
Handle null rope scaling value (#2793)

22 months agoFix spm whitespaces (#2806)
klosax [Sat, 26 Aug 2023 11:45:53 +0000 (13:45 +0200)]
Fix spm whitespaces (#2806)

* llama.cpp : fix spm whitespace escaping + clean up

* main.cpp : spm - add whitespace in front of prompt

* test-tokenizer-0.cpp : spm - add whitespace in front of prompt

22 months agoexamples : skip unnecessary external lib in server README.md how-to (#2804)
lon [Sat, 26 Aug 2023 08:07:43 +0000 (10:07 +0200)]
examples : skip unnecessary external lib in server README.md how-to (#2804)

22 months agollama : fix struct decl (#2790)
Marcus Dunn [Fri, 25 Aug 2023 16:17:15 +0000 (09:17 -0700)]
llama : fix struct decl (#2790)

22 months agoFaster perplexity computation (#2786)
Kawrakow [Fri, 25 Aug 2023 16:05:02 +0000 (19:05 +0300)]
Faster perplexity computation (#2786)

Co-authored-by: Iwan Kawrakow <redacted>
22 months agollama : add llama_beam_search() (#2267)
Matt Pulver [Fri, 25 Aug 2023 15:18:48 +0000 (11:18 -0400)]
llama : add llama_beam_search() (#2267)

* Add llama_beam_search().

* Add '// Beam search' heading to llama.{h,cpp} after llama_grammar_accept_token().

* Add space around * pointers and & references.

* Add spaces around comparison and assignment operators.

* Prefer west const.

* Use llama_ prefix for structs in global namespace.

* Delete obsolete comment from an earlier revision.

* Change eos to eob in llama_beam and llama_beam_view structs.

22 months agoconvert.py : Get rope scale from HuggingFace models (#2772)
Nigel Bosch [Fri, 25 Aug 2023 14:41:52 +0000 (09:41 -0500)]
convert.py : Get rope scale from HuggingFace models (#2772)

* Get rope scale from HF models

* Save rope scale only for linear scaling

* Rewrite for clarity

22 months agollama-bench : add model sizes (#2771)
slaren [Fri, 25 Aug 2023 13:16:19 +0000 (15:16 +0200)]
llama-bench : add model sizes (#2771)

* llama-bench : add model sizes

* more compact markdown output

* back to GiB

* adjust column sizes

22 months agoconvert.py : export rope freq_base when converting CodeLlama from an HF model (#2773)
slaren [Fri, 25 Aug 2023 12:08:53 +0000 (14:08 +0200)]
convert.py : export rope freq_base when converting CodeLlama from an HF model (#2773)

22 months agoserver : display token probabilities in the UI (#2489)
Jhen-Jie Hong [Fri, 25 Aug 2023 10:32:45 +0000 (18:32 +0800)]
server : display token probabilities in the UI (#2489)

* server : add n_probs param in chat UI

* server : keep message data array & show in probabilites component

* server : add simple popover component

* server : fix completion_probabilities undefined if not set n_probs

* server : implement Probabilites

* server : handle bytes

* server : make n_probs max to 10 for easy scroll

* server : adjust for dark/light mode

* server : Fix regenerated prompt

* server : update index.html.hpp

* server : convert prob to percentage + show original value as div title

* server : fix Probabilites not used if included empty str

* server : skip byte pair in display probabilites

* server : remove array check of completion_probabilities in messages

* skip empty array or byte pair (> 1) in Probabilites

* generate index.html.hpp

* fix incorrect prob convert if the str is already a known token

* use final response to show probabilities on stop

* revert unnecessary change

* correct probabilites usage

* remove unused function

* always send partial response for get correct probs of last to_send

* fix typo

* fix content of format_final_response

* refactor probs render & make pColor transparent if not found

* send empty string when got stop_pos in partial

* avoid unnecessary empty data event & send rest of partial tokens on stop

* use <br /> for new line

* skip -1 tok in loop to avoid send '' on end

* trim last new lines on stop

* revert unnecessary change

22 months agoci : pip install gguf in editable mode (#2782)
Georgi Gerganov [Fri, 25 Aug 2023 10:03:25 +0000 (13:03 +0300)]
ci : pip install gguf in editable mode (#2782)

ggml-ci

22 months agogguf : export objects to user code (#2780)
M. Yusuf Sarıgöz [Fri, 25 Aug 2023 09:43:41 +0000 (12:43 +0300)]
gguf : export objects to user code (#2780)

* gguf export more objects to user code

* gguf export all objects to user code for now

* gguf : bump version

22 months agoROCm Port (#1087)
Henri Vasserman [Fri, 25 Aug 2023 09:09:42 +0000 (12:09 +0300)]
ROCm Port (#1087)

* use hipblas based on cublas
* Update Makefile for the Cuda kernels
* Expand arch list and make it overrideable
* Fix multi GPU on multiple amd architectures with rocblas_initialize() (#5)
* add hipBLAS to README
* new build arg LLAMA_CUDA_MMQ_Y
* fix half2 decomposition
* Add intrinsics polyfills for AMD
* AMD assembly optimized __dp4a
* Allow overriding CC_TURING
* use "ROCm" instead of "CUDA"
* ignore all build dirs
* Add Dockerfiles
* fix llama-bench
* fix -nommq help for non CUDA/HIP

---------

Co-authored-by: YellowRoseCx <redacted>
Co-authored-by: ardfork <redacted>
Co-authored-by: funnbot <redacted>
Co-authored-by: Engininja2 <redacted>
Co-authored-by: Kerfuffle <redacted>
Co-authored-by: jammm <redacted>
Co-authored-by: jdecourval <redacted>
22 months agocuda : add RoPE kernel for mode == 2 (NeoX) (#2760)
Georgi Gerganov [Fri, 25 Aug 2023 08:55:59 +0000 (11:55 +0300)]
cuda : add RoPE kernel for mode == 2 (NeoX) (#2760)

* cuda : add RoPE kernel for mode == 2 (NeoX)

* falcon : do not offload the embeddings layer

22 months agogguf : make gguf pip-installable
M. Yusuf Sarıgöz [Fri, 25 Aug 2023 06:26:05 +0000 (09:26 +0300)]
gguf : make gguf pip-installable

* gitignore : add dist and rm pyproject.toml

* gguf: prepare as Pip package

* gguf: prepare as Pip package

* gguf : fix line endings

* requirements : add gguf

* gguf : update readme with build notes

* gguf : update readme with build notes

* gguf : add notes for tests

22 months agoggml-alloc : enlarge size of parse_seq (#2776)
Shouzheng Liu [Fri, 25 Aug 2023 05:58:00 +0000 (01:58 -0400)]
ggml-alloc : enlarge size of parse_seq (#2776)

Since we also store barriers in this array, we need to double its size.

22 months agoAdded `enum` to `llama_token_get_type` return type (#2774)
Marcus Dunn [Thu, 24 Aug 2023 21:49:30 +0000 (14:49 -0700)]
Added `enum` to `llama_token_get_type` return type (#2774)

22 months agoconvert.py : try to determine n_ctx automatically for CodeLlama (#2770)
slaren [Thu, 24 Aug 2023 19:10:39 +0000 (21:10 +0200)]
convert.py : try to determine n_ctx automatically for CodeLlama (#2770)

22 months agogguf : add rope_freq_base parameter for CodeLlama (#2769)
slaren [Thu, 24 Aug 2023 18:04:05 +0000 (20:04 +0200)]
gguf : add rope_freq_base parameter for CodeLlama (#2769)

22 months agofalcon : write file type
Georgi Gerganov [Thu, 24 Aug 2023 16:58:30 +0000 (19:58 +0300)]
falcon : write file type

22 months agometal : bug-fix when enable ggml-alloc (#2757)
Shouzheng Liu [Thu, 24 Aug 2023 16:27:25 +0000 (12:27 -0400)]
metal : bug-fix when enable ggml-alloc (#2757)

* metal: better memory alloc w/ concurrency dispatch

The ggml-alloc should only free tensors at memory barriers.

* ggml-alloc: avoid return silently

In certain cases, the allocate_node() function may silently return
without performing any memory allocation.

22 months agoconvert : auto-determine model name based on dir + scripts update
Georgi Gerganov [Thu, 24 Aug 2023 16:26:19 +0000 (19:26 +0300)]
convert : auto-determine model name based on dir + scripts update

22 months agoFix for main example getting stuck when -n -2 and --interactive (#2767)
Kerfuffle [Thu, 24 Aug 2023 16:11:13 +0000 (10:11 -0600)]
Fix for main example getting stuck when -n -2 and --interactive (#2767)

* Fix for main example getting stuck when -n -2 and --interactive

* Add a comment so future generations may suffer less.

22 months agofix convert.py for codellama, add llama 34B to the list of recognized models (#2768)
slaren [Thu, 24 Aug 2023 15:44:11 +0000 (17:44 +0200)]
fix convert.py for codellama, add llama 34B to the list of recognized models (#2768)

22 months agoTag release with build number (#2732)
DannyDaemonic [Thu, 24 Aug 2023 13:58:02 +0000 (06:58 -0700)]
Tag release with build number (#2732)

* Modified build.yml to use build number for release

* Add the short hash back into the tag

* Prefix the build number with b

22 months agometal : add Q8_0 support (#2763)
Georgi Gerganov [Thu, 24 Aug 2023 13:19:57 +0000 (16:19 +0300)]
metal : add Q8_0 support (#2763)

* metal : add dequantize_q8_0 kernel

* metal : add mul_mat_q8_0_f32 kernel

* metal : add Q8_0 mul_mm kernel

22 months agollama : escape all U+2581 in a string (#2750)
Georgi Gerganov [Thu, 24 Aug 2023 09:26:01 +0000 (12:26 +0300)]
llama : escape all U+2581 in a string (#2750)

22 months agollama : fix grammar sometimes generating null char (#2756)
Evan Jones [Thu, 24 Aug 2023 04:07:13 +0000 (00:07 -0400)]
llama : fix grammar sometimes generating null char (#2756)

22 months agoreadme : fix link
Georgi Gerganov [Wed, 23 Aug 2023 20:44:19 +0000 (23:44 +0300)]
readme : fix link

22 months agominor : fix trailing whitespace
Georgi Gerganov [Wed, 23 Aug 2023 20:43:00 +0000 (23:43 +0300)]
minor : fix trailing whitespace

22 months agoreadme : update hot topics
Georgi Gerganov [Wed, 23 Aug 2023 20:41:16 +0000 (23:41 +0300)]
readme : update hot topics

22 months agollm : add Falcon support (#2717)
Georgi Gerganov [Wed, 23 Aug 2023 20:08:04 +0000 (23:08 +0300)]
llm : add Falcon support (#2717)

* llama : refactor GGUF constants into static maps

* llama : check if model architecture is known

* llama : refactor llama_model_load_internal()

* gguf : add KV constant maps

* llm : read arch-specific KVs

* convert : add dummy scores + types

* falcon : load tensor data (CPU only)

* llama : fix loading progress bar

* llama : add arch member to llama_model

* falcon : CPU inference working

* falcon : support non-40B models

* falcon : minor

* llama : minor updates

ggml-ci

* convert-falcon-hf-to-gguf.py : fix special token mapping

* llama.cpp : llama default UNK token = id 0

* llama.cpp : fix bpe tokenizer

* llama.cpp : fix the fix of bpe tokenizer

* ggml : pass eps to ggml_norm

* metal : implement RoPE (mode = 2) + avoid ggml_repeat

* ggml : ggml_repeat always creates new tensor

* falcon : copy-paste self-attention from LLaMA

* metal : print extra compute pipeline info

* falcon : minor changes (still chasing the Metal problem)

* llama.cpp : fix linefeed token

* metal : fix GELU kernel numerical stability by using precise::tanh

* metal : temporary workaround for the concurrency optimization bug

* falcon : add CUDA offloading (#2739)

* llama : better model naming and size reporting

* llama : prep new tokenizer support

* llama : advanced BPE tokenizer based on ggllm.cpp imlpementation

* llama : remove oboslete comment

ggml-ci

* common : remove obsolete BPE API + disable test-tokenizer-1

* llama : revert BPE special-case in llama_byte_to_token()

* cuda : add TODOs for RoPE NeoX implementation

* llama : default special tokens based on vocab type

* perplexity : add log for start of tokenization

---------

Co-authored-by: klosax <redacted>
Co-authored-by: slaren <redacted>
22 months agominor : fix trailing whitespace
Georgi Gerganov [Wed, 23 Aug 2023 19:37:39 +0000 (22:37 +0300)]
minor : fix trailing whitespace

22 months agoexamples : restore the functionality to import llama2.c models (#2685)
Olivier Chafik [Wed, 23 Aug 2023 19:33:05 +0000 (20:33 +0100)]
examples : restore the functionality to import llama2.c models (#2685)

* Fix import of llama2.c models that don't share weights between embedding layers

* llama2c: reinstate ggmlv3 conversion output + update readme w/ gguf conv

* llama2.c: comment out legacy "load from ggml model" logic

* llama2.c: convert special-cased "<0xXX>" single byte tokens from tokenizer.bin

22 months agofix convert-lora-to-ggml.py (#2738)
slaren [Wed, 23 Aug 2023 14:46:54 +0000 (16:46 +0200)]
fix convert-lora-to-ggml.py (#2738)

22 months agomain : insert bos if no tokens (#2727)
klosax [Wed, 23 Aug 2023 14:46:03 +0000 (16:46 +0200)]
main : insert bos if no tokens (#2727)

* main.cpp : insert bos if no tokens

* Update examples/main/main.cpp

* Update examples/main/main.cpp

---------

Co-authored-by: Georgi Gerganov <redacted>
22 months agogitignore : fix for windows (#2729)
akawrykow [Wed, 23 Aug 2023 14:31:34 +0000 (07:31 -0700)]
gitignore : fix for windows (#2729)

22 months agochmod : make scripts executable (#2675)
Cebtenzzre [Wed, 23 Aug 2023 14:29:09 +0000 (10:29 -0400)]
chmod : make scripts executable (#2675)

22 months agodevops : RPM Specs (#2723)
JohnnyB [Wed, 23 Aug 2023 14:28:22 +0000 (15:28 +0100)]
devops : RPM Specs (#2723)

* Create llama-cpp.srpm

* Rename llama-cpp.srpm to llama-cpp.srpm.spec

Correcting extension.

* Tested spec success.

* Update llama-cpp.srpm.spec

* Create lamma-cpp-cublas.srpm.spec

* Create lamma-cpp-clblast.srpm.spec

* Update lamma-cpp-cublas.srpm.spec

Added BuildRequires

* Moved to devops dir

22 months agoFix values shown in the quantize tool help (#2735)
Kawrakow [Wed, 23 Aug 2023 09:57:12 +0000 (12:57 +0300)]
Fix values shown in the quantize tool help (#2735)

Co-authored-by: Iwan Kawrakow <redacted>
22 months agoStrided perplexity (#2714)
Kawrakow [Wed, 23 Aug 2023 09:56:42 +0000 (12:56 +0300)]
Strided perplexity (#2714)

* Implementing strided computation of perplexity

* Alternative way to output PPL results

---------

Co-authored-by: Iwan Kawrakow <redacted>
22 months agoFix ggml to gguf conversion on Windows (#2733)
IgnacioFDM [Wed, 23 Aug 2023 09:31:09 +0000 (06:31 -0300)]
Fix ggml to gguf conversion on Windows (#2733)

This fixes `RuntimeWarning: overflow encountered in long_scalars`

Credit: anon (not mine)

22 months agoserver : allow json array in prompt or content for direct token input (#2306)
Xiao-Yong Jin [Wed, 23 Aug 2023 07:12:12 +0000 (02:12 -0500)]
server : allow json array in prompt or content for direct token input (#2306)

* server: allow json array in prompt or content

We accept an array of strings and numbers representing tokens,
in addition to the current string valued prompt or content.

This allows direct token input, so that any special tokens
can be processed and used at the frontend during the construction
of the json data, before sending to the server. And the server
does not need to know or parse special tokens from textual input.

With this, we can use EOS and BOS used in llama-2-chat models.

* server: use tokenizePrompt(json) and default "" if empty prompt

* server: fix prompt check

* server: tokenize endpoint no longer adds BOS

22 months agodocs : add grammar docs (#2701)
Evan Jones [Wed, 23 Aug 2023 01:01:57 +0000 (21:01 -0400)]
docs : add grammar docs (#2701)

* docs : add grammar docs

* tweaks to grammar guide

* rework GBNF example to be a commented grammar

22 months agoImprove handling of special tokens in GGML to GGUF converter (#2725)
Kerfuffle [Tue, 22 Aug 2023 23:39:39 +0000 (17:39 -0600)]
Improve handling of special tokens in GGML to GGUF converter (#2725)

* Improve UNK, BOS, EOS token handling when converting without metadata.

* Allow importing as a module.

* Remove some obsolete code and minor cleanups.

* Set default UNK token mapping from -1 to 0 in llama.cpp

* Try to handle overflow due to buggy Windows Python with a better error message

22 months agollama : fix whitespace escaping in tokenizer (#2724)
goerch [Tue, 22 Aug 2023 21:10:42 +0000 (23:10 +0200)]
llama : fix whitespace escaping in tokenizer (#2724)

22 months agoCUDA: use mul_mat_q kernels by default (#2683)
Johannes Gäßler [Tue, 22 Aug 2023 20:47:05 +0000 (22:47 +0200)]
CUDA: use mul_mat_q kernels by default (#2683)

22 months agoconvert.py : clarifying error message (#2718)
Alex Petenchea [Tue, 22 Aug 2023 18:58:16 +0000 (21:58 +0300)]
convert.py : clarifying error message (#2718)

22 months agoFix CUDA softmax by subtracting max value before exp (#2665)
Jiahao Li [Tue, 22 Aug 2023 18:27:06 +0000 (02:27 +0800)]
Fix CUDA softmax by subtracting max value before exp (#2665)

22 months agogguf : add ftype meta info to the model (#2710)
Georgi Gerganov [Tue, 22 Aug 2023 17:05:59 +0000 (20:05 +0300)]
gguf : add ftype meta info to the model (#2710)

* llama : add ftype meta info to the model

ggml-ci

* convert.py : add ftype when converting (does not work)

* convert.py : fix Enum to IntEnum

ggml-ci

22 months agoQuantization imrovements for k_quants (#2707)
Kawrakow [Tue, 22 Aug 2023 16:14:09 +0000 (19:14 +0300)]
Quantization imrovements for k_quants (#2707)

* Improve LLaMA-2 2-, 3- and 4-bit quantization

* Q3_K_S: use Q5_K for 1st 2 layers of attention.wv and feed_forward.w2
* Q4_K_S: use Q6_K for 1st 2 layers of attention.wv and feed_forward.w2
* Q2_K and Q3_K_M: use Q5_K instead of Q4_K for 1st 2 layers of
  attention.wv and feed_forward.w2

This leads to a slight model sized increase as follows:
Q2_K  : 2.684G vs 2.670G
Q3_K_S: 2.775G vs 2.745G
Q3_K_M: 3.071G vs 3.057G
Q4_K_S: 3.592G vs 3.563G

LLaMA-2 PPL for context 512 changes as follows:
Q2_K  : 6.6691 vs 6.8201
Q3_K_S: 6.2129 vs 6.2584
Q3_K_M: 6.0387 vs 6.1371
Q4_K_S: 5.9138 vs 6.0041

There are improvements for LLaMA-1 as well, but they are
way smaller than the above.

* Minor 4-bit quantization improvement

For the same model size as previus commit, we get
PPL = 5.9069 vs 5.9138.

* Some more fine tuning

* Adding make_qkx2_quants

With it, we get PPL = 5.8828 for L2-7B Q4_K_S.

* Another minor improvement

* Q2_K improvement

Smaller model, lower perplexity.
 7B: file size = 2.632G, PPL = 6.3772 vs original 2.670G PPL = 6.8201
12B: file size = 5.056G, PPL = 5.4577 vs original 5.130G PPL = 5.7178

It is mostly Q3_K except for tok_embeddings, attention.wq, attention.wk,
which are Q2_K

* Iterating

* Revert Q5_K back to make_qkx1_quants

* Better Q6_K

* make_qkx2_quants is better for Q5_K after all

* Fix after rebasing on master

* Fix for changed tensor names

---------

Co-authored-by: Iwan Kawrakow <redacted>
22 months agoembedding : evaluate prompt in batches (#2713)
slaren [Tue, 22 Aug 2023 14:03:12 +0000 (16:03 +0200)]
embedding : evaluate prompt in batches (#2713)

22 months agoggml-cuda : use graph allocator (#2684)
slaren [Tue, 22 Aug 2023 13:25:19 +0000 (15:25 +0200)]
ggml-cuda : use graph allocator (#2684)

use a different function for no_alloc to avoid breaking backwards compat, fixes lora

remove 512 n_batch limit

fixed 2048 batch size

cleanup

Co-authored-by: Johannes Gäßler <redacted>
22 months agoggml : sync latest (SAM + SD operators, CUDA alibi) (#2709)
Georgi Gerganov [Tue, 22 Aug 2023 11:22:08 +0000 (14:22 +0300)]
ggml : sync latest (SAM + SD operators, CUDA alibi) (#2709)

* ggml : sync latest (SAM + SD operators, CUDA alibi)

ggml-ci

* ggml : fix tabs

22 months agollama-bench : minor fixes (#2695)
slaren [Tue, 22 Aug 2023 07:56:03 +0000 (09:56 +0200)]
llama-bench : minor fixes (#2695)

22 months agoggml : support CUDA's half type for aarch64(#1455) (#2670)
Kylin [Tue, 22 Aug 2023 07:14:23 +0000 (15:14 +0800)]
ggml : support CUDA's half type for aarch64(#1455) (#2670)

* ggml: support CUDA's half type for aarch64(#1455)
support CUDA's half type for aarch64 in ggml_fp16_t definition

* ggml: use __CUDACC__ to recognise nvcc compiler

22 months agometal : add missing barriers for mul-mat (#2699)
Shouzheng Liu [Tue, 22 Aug 2023 06:18:40 +0000 (02:18 -0400)]
metal : add missing barriers for mul-mat (#2699)

22 months agoserver : fallback to default if client param is null (#2688)
Jhen-Jie Hong [Tue, 22 Aug 2023 00:32:00 +0000 (08:32 +0800)]
server : fallback to default if client param is null (#2688)

* server : fallback to default if client param is null

* server : do not overwrite 404 if status is 500 from exception_handler

22 months agoFix convert-llama-ggmlv3-to-gguf.py vocab conversion (#2698)
Kerfuffle [Tue, 22 Aug 2023 00:01:34 +0000 (18:01 -0600)]
Fix convert-llama-ggmlv3-to-gguf.py vocab conversion (#2698)

When converting without metadata, the hex value for bytes entries weren't 0 padded to 2 digits.

22 months agopy : remove obsolete script
Georgi Gerganov [Mon, 21 Aug 2023 20:40:22 +0000 (23:40 +0300)]
py : remove obsolete script

22 months agogguf : new file format with flexible meta data (beta) (#2398)
Georgi Gerganov [Mon, 21 Aug 2023 20:07:43 +0000 (23:07 +0300)]
gguf : new file format with flexible meta data (beta) (#2398)

* gguf : first API pass

* gguf : read header + meta data

* gguf : read tensor info

* gguf : initial model loading - not tested

* gguf : add gguf_get_tensor_name()

* gguf : do not support passing existing ggml_context to gguf_init

* gguf : simplify gguf_get_val

* gguf : gguf.c is now part of ggml.c

* gguf : read / write sample models

* gguf : add comments

* refactor : reduce code duplication and better API (#2415)

* gguf : expose the gguf_type enum through the API for now

* gguf : add array support

* gguf.py : some code style changes

* convert.py : start a new simplified implementation by removing old stuff

* convert.py : remove GGML vocab + other obsolete stuff

* GGUF : write tensor (#2426)

* WIP: Write tensor

* GGUF : Support writing tensors in Python

* refactor : rm unused import and upd todos

* fix : fix errors upd writing example

* rm example.gguf

* gitignore *.gguf

* undo formatting

* gguf : add gguf_find_key (#2438)

* gguf.cpp : find key example

* ggml.h : add gguf_find_key

* ggml.c : add gguf_find_key

* gguf : fix writing tensors

* gguf : do not hardcode tensor names to read

* gguf : write sample tensors to read

* gguf : add tokenization constants

* quick and dirty conversion example

* gguf : fix writing gguf arrays

* gguf : write tensors one by one and code reuse

* gguf : fix writing gguf arrays

* gguf : write tensors one by one

* gguf : write tensors one by one

* gguf : write tokenizer data

* gguf : upd gguf conversion script

* Update convert-llama-h5-to-gguf.py

* gguf : handle already encoded string

* ggml.h : get array str and f32

* ggml.c : get arr str and f32

* gguf.py : support any type

* Update convert-llama-h5-to-gguf.py

* gguf : fix set is not subscriptable

* gguf : update convert-llama-h5-to-gguf.py

* constants.py : add layer norm eps

* gguf.py : add layer norm eps and merges

* ggml.h : increase GGML_MAX_NAME to 64

* ggml.c : add gguf_get_arr_n

* Update convert-llama-h5-to-gguf.py

* add gptneox gguf example

* Makefile : add gptneox gguf example

* Update convert-llama-h5-to-gguf.py

* add gptneox gguf example

* Update convert-llama-h5-to-gguf.py

* Update convert-gptneox-h5-to-gguf.py

* Update convert-gptneox-h5-to-gguf.py

* Update convert-llama-h5-to-gguf.py

* gguf : support custom alignment value

* gguf : fix typo in function call

* gguf : mmap tensor data example

* fix : update convert-llama-h5-to-gguf.py

* Update convert-llama-h5-to-gguf.py

* convert-gptneox-h5-to-gguf.py : Special tokens

* gptneox-main.cpp : special tokens

* Update gptneox-main.cpp

* constants.py : special tokens

* gguf.py : accumulate kv and tensor info data + special tokens

* convert-gptneox-h5-to-gguf.py : accumulate kv and ti + special tokens

* gguf : gguf counterpart of llama-util.h

* gguf-util.h : update note

* convert-llama-h5-to-gguf.py : accumulate kv / ti + special tokens

* convert-llama-h5-to-gguf.py : special tokens

* Delete gptneox-common.cpp

* Delete gptneox-common.h

* convert-gptneox-h5-to-gguf.py : gpt2bpe tokenizer

* gptneox-main.cpp : gpt2 bpe tokenizer

* gpt2 bpe tokenizer (handles merges and unicode)

* Makefile : remove gptneox-common

* gguf.py : bytesarray for gpt2bpe tokenizer

* cmpnct_gpt2bpe.hpp : comments

* gguf.py : use custom alignment if present

* gguf : minor stuff

* Update gptneox-main.cpp

* map tensor names

* convert-gptneox-h5-to-gguf.py : map tensor names

* convert-llama-h5-to-gguf.py : map tensor names

* gptneox-main.cpp : map tensor names

* gguf : start implementing libllama in GGUF (WIP)

* gguf : start implementing libllama in GGUF (WIP)

* rm binary commited by mistake

* upd .gitignore

* gguf : calculate n_mult

* gguf :  inference with 7B model working (WIP)

* gguf : rm deprecated function

* gguf : start implementing gguf_file_saver (WIP)

* gguf : start implementing gguf_file_saver (WIP)

* gguf : start implementing gguf_file_saver (WIP)

* gguf : add gguf_get_kv_type

* gguf : add gguf_get_kv_type

* gguf : write metadata in gguf_file_saver (WIP)

* gguf : write metadata in gguf_file_saver (WIP)

* gguf : write metadata in gguf_file_saver

* gguf : rm references to old file formats

* gguf : shorter name for member variable

* gguf : rm redundant method

* gguf : get rid of n_mult, read n_ff from file

* Update gguf_tensor_map.py

* Update gptneox-main.cpp

* gguf : rm references to old file magics

* gguf : start implementing quantization (WIP)

* gguf : start implementing quantization (WIP)

* gguf : start implementing quantization (WIP)

* gguf : start implementing quantization (WIP)

* gguf : start implementing quantization (WIP)

* gguf : start implementing quantization (WIP)

* gguf : quantization is working

* gguf : roper closing of file

* gguf.py : no need to convert tensors twice

* convert-gptneox-h5-to-gguf.py : no need to convert tensors twice

* convert-llama-h5-to-gguf.py : no need to convert tensors twice

* convert-gptneox-h5-to-gguf.py : simplify nbytes

* convert-llama-h5-to-gguf.py : simplify nbytes

* gptneox-main.cpp : n_layer --> n_block

* constants.py : n_layer --> n_block

* gguf.py : n_layer --> n_block

* convert-gptneox-h5-to-gguf.py : n_layer --> n_block

* convert-llama-h5-to-gguf.py : n_layer --> n_block

* gptneox-main.cpp : n_layer --> n_block

* Update gguf_tensor_map.py

* convert-gptneox-h5-to-gguf.py : load model in parts to save memory

* convert-llama-h5-to-gguf.py : load model in parts to save memory

* convert : write more metadata for LLaMA

* convert : rm quantization version

* convert-gptneox-h5-to-gguf.py : add file_type key

* gptneox-main.cpp : add file_type key

* fix conflicts

* gguf : add todos and comments

* convert-gptneox-h5-to-gguf.py : tensor name map changes

* Create gguf_namemap.py : tensor name map changes

* Delete gguf_tensor_map.py

* gptneox-main.cpp : tensor name map changes

* convert-llama-h5-to-gguf.py : fixes

* gguf.py : dont add empty strings

* simple : minor style changes

* gguf : use UNIX line ending

* Create convert-llama-7b-pth-to-gguf.py

* llama : sync gguf-llama.cpp with latest llama.cpp (#2608)

* llama : sync gguf-llama.cpp with latest llama.cpp

* minor : indentation + assert

* llama : refactor gguf_buffer and gguf_ctx_buffer

* llama : minor

* gitignore : add gptneox-main

* llama : tokenizer fixes (#2549)

* Merge tokenizer fixes into the gguf branch.

* Add test vocabularies

* convert : update convert-new.py with tokenizer fixes (#2614)

* Merge tokenizer fixes into the gguf branch.

* Add test vocabularies

* Adapt convert-new.py (and fix a clang-cl compiler error on windows)

* llama : sync gguf-llama with llama (#2613)

* llama : sync gguf-llama with llama

* tests : fix build + warnings (test-tokenizer-1 still fails)

* tests : fix wstring_convert

* convert : fix layer names

* llama : sync gguf-llama.cpp

* convert : update HF converter to new tokenizer voodoo magics

* llama : update tokenizer style

* convert-llama-h5-to-gguf.py : add token types

* constants.py : add token types

* gguf.py : add token types

* convert-llama-7b-pth-to-gguf.py : add token types

* gguf-llama.cpp :  fix n_head_kv

* convert-llama-h5-to-gguf.py : add 70b gqa support

* gguf.py : add tensor data layout

* convert-llama-h5-to-gguf.py : add tensor data layout

* convert-llama-7b-pth-to-gguf.py : add tensor data layout

* gptneox-main.cpp : add tensor data layout

* convert-llama-h5-to-gguf.py : clarify the reverse permute

* llama : refactor model loading code (#2620)

* llama : style formatting + remove helper methods

* llama : fix quantization using gguf tool

* llama : simplify gguf_file_saver

* llama : fix method names

* llama : simplify write_header()

* llama : no need to pass full file loader to the file saver

just gguf_ctx

* llama : gguf_file_saver write I32

* llama : refactor tensor names (#2622)

* gguf: update tensor names searched in quantization

* gguf : define tensor names as constants

* gguf : initial write API (not tested yet)

* gguf : write to file API (not tested)

* gguf : initial write API ready + example

* gguf : fix header write

* gguf : fixes + simplify example + add ggml_nbytes_pad()

* gguf : minor

* llama : replace gguf_file_saver with new gguf write API

* gguf : streaming support when writing files

* gguf : remove oboslete write methods

* gguf : remove obosolete gguf_get_arr_xxx API

* llama : simplify gguf_file_loader

* llama : move hparams and vocab from gguf_file_loader to llama_model_loader

* llama : merge gguf-util.h in llama.cpp

* llama : reorder definitions in .cpp to match .h

* llama : minor simplifications

* llama : refactor llama_model_loader (WIP)

wip : remove ggml_ctx from llama_model_loader

wip : merge gguf_file_loader in llama_model_loader

* llama : fix shape prints

* llama : fix Windows build + fix norm_rms_eps key

* llama : throw error on missing KV paris in model meta data

* llama : improve printing + log meta data

* llama : switch print order of meta data

---------

Co-authored-by: M. Yusuf Sarıgöz <redacted>
* gguf : deduplicate (#2629)

* gguf : better type names

* dedup : CPU + Metal is working

* ggml : fix warnings about unused results

* llama.cpp : fix line feed and compiler warning

* llama : fix strncpy warning + note token_to_str does not write null

* llama : restore the original load/save session implementation

Will migrate this to GGUF in the future

* convert-llama-h5-to-gguf.py : support alt ctx param name

* ggml : assert when using ggml_mul with non-F32 src1

* examples : dedup simple

---------

Co-authored-by: klosax <redacted>
* gguf.py : merge all files in gguf.py

* convert-new.py : pick #2427 for HF 70B support

* examples/gguf : no need to keep q option for quantization any more

* llama.cpp : print actual model size

* llama.cpp : use ggml_elements()

* convert-new.py : output gguf (#2635)

* convert-new.py : output gguf (WIP)

* convert-new.py : add gguf key-value pairs

* llama : add hparams.ctx_train + no longer print ftype

* convert-new.py : minor fixes

* convert-new.py : vocab-only option should work now

* llama : fix tokenizer to use llama_char_to_byte

* tests : add new ggml-vocab-llama.gguf

* convert-new.py : tensor name mapping

* convert-new.py : add map for skipping tensor serialization

* convert-new.py : convert script now works

* gguf.py : pick some of the refactoring from #2644

* convert-new.py : minor fixes

* convert.py : update to support GGUF output

* Revert "ci : disable CI temporary to not waste energy"

This reverts commit 7e82d25f40386540c2c15226300ad998ecd871ea.

* convert.py : n_head_kv optional and .gguf file extension

* convert.py : better always have n_head_kv and default it to n_head

* llama : sync with recent PRs on master

* editorconfig : ignore models folder

ggml-ci

* ci : update ".bin" to ".gguf" extension

ggml-ci

* llama : fix llama_model_loader memory leak

* gptneox : move as a WIP example

* llama : fix lambda capture

ggml-ci

* ggml : fix bug in gguf_set_kv

ggml-ci

* common.h : .bin --> .gguf

* quantize-stats.cpp : .bin --> .gguf

* convert.py : fix HF tensor permuting / unpacking

ggml-ci

* llama.cpp : typo

* llama : throw error if gguf fails to init from file

ggml-ci

* llama : fix tensor name grepping during quantization

ggml-ci

* gguf.py : write tensors in a single pass (#2644)

* gguf : single pass for writing tensors + refactoring writer

* gguf : single pass for writing tensors + refactoring writer

* gguf : single pass for writing tensors + refactoring writer

* gguf : style fixes in simple conversion script

* gguf : refactor gptneox conversion script

* gguf : rename h5 to hf (for HuggingFace)

* gguf : refactor pth to gguf conversion script

* gguf : rm file_type key and method

* gguf.py : fix vertical alignment

* gguf.py : indentation

---------

Co-authored-by: Georgi Gerganov <redacted>
* convert-gptneox-hf-to-gguf.py : fixes

* gguf.py : gptneox mapping

* convert-llama-hf-to-gguf.py : fixes

* convert-llama-7b-pth-to-gguf.py : fixes

* ggml.h : reverse GGUF_MAGIC

* gguf.py : reverse GGUF_MAGIC

* test-tokenizer-0.cpp : fix warning

* llama.cpp : print kv general.name

* llama.cpp : get special token kv and linefeed token id

* llama : print number of tensors per type + print arch + style

* tests : update vocab file with new magic

* editorconfig : fix whitespaces

* llama : re-order functions

* llama : remove C++ API + reorganize common source in /common dir

* llama : minor API updates

* llama : avoid hardcoded special tokens

* llama : fix MPI build

ggml-ci

* llama : introduce enum llama_vocab_type + remove hardcoded string constants

* convert-falcon-hf-to-gguf.py : falcon HF --> gguf conversion, not tested

* falcon-main.cpp : falcon inference example

* convert-falcon-hf-to-gguf.py : remove extra kv

* convert-gptneox-hf-to-gguf.py : remove extra kv

* convert-llama-7b-pth-to-gguf.py : remove extra kv

* convert-llama-hf-to-gguf.py : remove extra kv

* gguf.py : fix for falcon 40b

* falcon-main.cpp : fix for falcon 40b

* convert-falcon-hf-to-gguf.py : update ref

* convert-falcon-hf-to-gguf.py : add tensor data layout

* cmpnct_gpt2bpe.hpp : fixes

* falcon-main.cpp : fixes

* gptneox-main.cpp : fixes

* cmpnct_gpt2bpe.hpp : remove non-general stuff

* Update examples/server/README.md

Co-authored-by: slaren <redacted>
* cmpnct_gpt2bpe.hpp : cleanup

* convert-llama-hf-to-gguf.py : special tokens

* convert-llama-7b-pth-to-gguf.py : special tokens

* convert-permute-debug.py : permute debug print

* convert-permute-debug-master.py : permute debug for master

* convert-permute-debug.py : change permute type of attn_q

* convert.py : 70b model working (change attn_q permute)

* Delete convert-permute-debug-master.py

* Delete convert-permute-debug.py

* convert-llama-hf-to-gguf.py : fix attn_q permute

* gguf.py : fix rope scale kv

* convert-llama-hf-to-gguf.py : rope scale and added tokens

* convert-llama-7b-pth-to-gguf.py : rope scale and added tokens

* llama.cpp : use rope scale kv

* convert-llama-7b-pth-to-gguf.py : rope scale fix

* convert-llama-hf-to-gguf.py : rope scale fix

* py : fix whitespace

* gguf : add Python script to convert GGMLv3 LLaMA models to GGUF (#2682)

* First pass at converting GGMLv3 LLaMA models to GGUF

* Cleanups, better output during conversion

* Fix vocab space conversion logic

* More vocab conversion fixes

* Add description to converted GGUF files

* Improve help text, expand warning

* Allow specifying name and description for output GGUF

* Allow overriding vocab and hyperparams from original model metadata

* Use correct params override var name

* Fix wrong type size for Q8_K

Better handling of original style metadata

* Set default value for gguf add_tensor raw_shape KW arg

* llama : improve token type support (#2668)

* Merge tokenizer fixes into the gguf branch.

* Add test vocabularies

* Adapt convert-new.py (and fix a clang-cl compiler error on windows)

* Improved tokenizer test

But does it work on MacOS?

* Improve token type support

- Added @klosax code to convert.py
- Improved token type support in vocabulary

* Exclude platform dependent tests

* More sentencepiece compatibility by eliminating magic numbers

* Restored accidentally removed comment

* llama : add API for token type

ggml-ci

* tests : use new tokenizer type API (#2692)

* Merge tokenizer fixes into the gguf branch.

* Add test vocabularies

* Adapt convert-new.py (and fix a clang-cl compiler error on windows)

* Improved tokenizer test

But does it work on MacOS?

* Improve token type support

- Added @klosax code to convert.py
- Improved token type support in vocabulary

* Exclude platform dependent tests

* More sentencepiece compatibility by eliminating magic numbers

* Restored accidentally removed comment

* Improve commentary

* Use token type API in test-tokenizer-1.cpp

* py : cosmetics

* readme : add notice about new file format

ggml-ci

---------

Co-authored-by: M. Yusuf Sarıgöz <redacted>
Co-authored-by: klosax <redacted>
Co-authored-by: goerch <redacted>
Co-authored-by: slaren <redacted>
Co-authored-by: Kerfuffle <redacted>
22 months agometal : fix synchronization in new matrix multiplication kernel (#2686)
Shouzheng Liu [Mon, 21 Aug 2023 10:59:29 +0000 (06:59 -0400)]
metal : fix synchronization in new matrix multiplication kernel (#2686)

22 months agoHellaSwag: split token evaluation into batches if needed (#2681)
Kawrakow [Mon, 21 Aug 2023 08:11:31 +0000 (11:11 +0300)]
HellaSwag: split token evaluation into batches if needed (#2681)

Co-authored-by: Iwan Kawrakow <redacted>
22 months agoggml : move all type info to ggml_type_traits (#2663)
slaren [Sun, 20 Aug 2023 20:17:53 +0000 (22:17 +0200)]
ggml : move all type info to ggml_type_traits (#2663)

22 months agoMore efficient Hellaswag implementation (#2677)
Kawrakow [Sun, 20 Aug 2023 13:44:46 +0000 (16:44 +0300)]
More efficient Hellaswag implementation (#2677)

Co-authored-by: Iwan Kawrakow <redacted>
22 months agoserver : better default prompt (#2646)
Georgi Gerganov [Fri, 18 Aug 2023 21:45:36 +0000 (00:45 +0300)]
server : better default prompt (#2646)

22 months agoserver : update xxd usage for older versions compatibility (#2649)
Jhen-Jie Hong [Fri, 18 Aug 2023 21:41:32 +0000 (05:41 +0800)]
server : update xxd usage for older versions compatibility (#2649)

* server : update xxd usage for older versions compatibility

* remove unused $func

22 months agoAdd link to clojure bindings to Readme. (#2659)
Adrian [Fri, 18 Aug 2023 19:39:22 +0000 (12:39 -0700)]
Add link to clojure bindings to Readme. (#2659)

22 months agoreadme : incoming BREAKING CHANGE
Georgi Gerganov [Fri, 18 Aug 2023 14:48:31 +0000 (17:48 +0300)]
readme : incoming BREAKING CHANGE

22 months agollama : add benchmark example (#2626)
slaren [Fri, 18 Aug 2023 10:44:58 +0000 (12:44 +0200)]
llama : add benchmark example (#2626)

* llama : add benchmark example

* add to examples CMakeLists.txt

* fix msvc build

* add missing include

* add Bessel's correction to stdev calculation

Co-authored-by: Johannes Gäßler <redacted>
* improve markdown formatting

* add missing include

* print warning is NDEBUG is not defined

* remove n_prompt and n_gen from the matrix, use each value separately instead

* better checks for non-optimized builds

* llama.cpp : fix MEM_REQ_SCRATCH0 reusing the value of n_ctx of the first call

* fix json formatting

* add sql output

* add basic cpu and gpu info (linx/cuda only)

* markdown: also show values that differ from the default

* markdown: add build id

* cleanup

* improve formatting

* formatting

---------

Co-authored-by: Johannes Gäßler <redacted>
22 months agoreadme : add link to Rust bindings (#2656)
mdrokz [Fri, 18 Aug 2023 10:17:58 +0000 (15:47 +0530)]
readme : add link to Rust bindings (#2656)

22 months agoperplexity : more meaningful ETA number - 2 decimal points
Georgi Gerganov [Fri, 18 Aug 2023 09:48:55 +0000 (12:48 +0300)]
perplexity : more meaningful ETA number - 2 decimal points

22 months agoFix unicode in grammars (fixes #2501) (#2553)
Evan Jones [Thu, 17 Aug 2023 23:54:44 +0000 (19:54 -0400)]
Fix unicode in grammars (fixes #2501) (#2553)

* Fix unicode in grammars (fixes #2501)

* add more comments

* fix test-llama-grammar

22 months agoserver : support for saving templates in browser LocalStorage (#2486)
staviq [Thu, 17 Aug 2023 23:34:01 +0000 (23:34 +0000)]
server : support for saving templates in browser LocalStorage (#2486)

* support for templates in browser LocalStorage

* sync accepted #2409 fix from upstream

* convert autosave invocation to useEffect

* Apply suggestions from code review

Co-authored-by: Jhen-Jie Hong <redacted>
* Regen index.html.cpp, suggested from code review

---------

Co-authored-by: Jhen-Jie Hong <redacted>
22 months agoREADME: fix LLAMA_CUDA_MMV_Y documentation (#2647)
Johannes Gäßler [Thu, 17 Aug 2023 21:57:59 +0000 (23:57 +0200)]
README: fix LLAMA_CUDA_MMV_Y documentation (#2647)

22 months ago[Zig] Fixing Zig build and improvements (#2554)
Henri Vasserman [Thu, 17 Aug 2023 20:11:18 +0000 (23:11 +0300)]
[Zig] Fixing Zig build and improvements (#2554)

* Fix zig after console.o was split

* Better include and flag management

* Change LTO to option

22 months agoAdd --cfg-negative-prompt-file option for examples (#2591)
Kerfuffle [Thu, 17 Aug 2023 13:29:44 +0000 (07:29 -0600)]
Add --cfg-negative-prompt-file option for examples (#2591)

Add --cfg-negative-prompt-file option for examples

22 months agollama : replace (permute + reshape + view_1d) with (view_3d) (#2538)
Georgi Gerganov [Thu, 17 Aug 2023 07:47:09 +0000 (10:47 +0300)]
llama : replace (permute + reshape + view_1d) with (view_3d) (#2538)

ggml-ci

22 months agotests : adds simple llama grammar tests (#2618)
drbh [Thu, 17 Aug 2023 07:41:01 +0000 (03:41 -0400)]
tests : adds simple llama grammar tests (#2618)

* adds simple llama grammar tests

* fix lint and add Makefile

* 0 terminate code_points

* avoid dangling pointers in candidate cleanup

* cleanup grammar at end of test

22 months agoggml-alloc : fix discrepency between measure&eval (#2639)
Shouzheng Liu [Thu, 17 Aug 2023 07:35:53 +0000 (03:35 -0400)]
ggml-alloc : fix discrepency between measure&eval (#2639)

The GGML memory allocator consistently places a tensor within the
optimal-fit memory block, which is the smallest block capable of
accommodating the tensor's size. During the measurement phase, the final
block is generously sized, ensuring it never qualifies as the
optimal-fit block as long as there exists another block capable of
accommodating the tensor. Nevertheless, in the evaluation phase, the
last block is constrained in size and could potentially qualify as the
optimal-fit block. Consequently, there exists the possibility of a
tensor being allocated to a different region during evaluation, leading
to more memory fragmentation in our scratch buffer.

This recent commit guarantees uniform behavior of the allocator across
both the measurement and evaluation phases, eliminating discrepancies
between the two.