]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/log
pkg/ggml/sources/llama.cpp
17 months agofix : cuda order of synchronization when setting a buffer (ggml/679)
Erik Scholz [Fri, 5 Jan 2024 15:00:00 +0000 (16:00 +0100)]
fix : cuda order of synchronization when setting a buffer (ggml/679)

* fix : cuda order of synchronization when setting a buffer

* also sync before memcpy

---------

Co-authored-by: slaren <redacted>
17 months agoserver : update readme to document the new `/health` endpoint (#4866)
Behnam M [Thu, 11 Jan 2024 07:12:05 +0000 (02:12 -0500)]
server : update readme to document the new `/health` endpoint (#4866)

* added /health endpoint to the server

* added comments on the additional /health endpoint

* Better handling of server state

When the model is being loaded, the server state is `LOADING_MODEL`. If model-loading fails, the server state becomes `ERROR`, otherwise it becomes `READY`. The `/health` endpoint provides more granular messages now according to the server_state value.

* initialized server_state

* fixed a typo

* starting http server before initializing the model

* Update server.cpp

* Update server.cpp

* fixes

* fixes

* fixes

* made ServerState atomic and turned two-line spaces into one-line

* updated `server` readme to document the `/health` endpoint too

17 months agoserver : fix build + rename enums (#4870)
Georgi Gerganov [Thu, 11 Jan 2024 07:10:34 +0000 (09:10 +0200)]
server : fix build + rename enums (#4870)

17 months agoserver : add a `/health` endpoint (#4860)
Behnam M [Wed, 10 Jan 2024 19:56:05 +0000 (14:56 -0500)]
server : add a `/health` endpoint (#4860)

* added /health endpoint to the server

* added comments on the additional /health endpoint

* Better handling of server state

When the model is being loaded, the server state is `LOADING_MODEL`. If model-loading fails, the server state becomes `ERROR`, otherwise it becomes `READY`. The `/health` endpoint provides more granular messages now according to the server_state value.

* initialized server_state

* fixed a typo

* starting http server before initializing the model

* Update server.cpp

* Update server.cpp

* fixes

* fixes

* fixes

* made ServerState atomic and turned two-line spaces into one-line

17 months agollama : add additional suffixes for model params (#4834)
Brian [Wed, 10 Jan 2024 14:09:53 +0000 (01:09 +1100)]
llama : add additional suffixes for model params (#4834)

* llm_load_print_meta: Add additional suffixs for model params

* Update llama.cpp model param log

remove unneeded comments and convert from > to >=

17 months agollama : recognize 1B phi models (#4847)
Austin [Wed, 10 Jan 2024 13:39:09 +0000 (08:39 -0500)]
llama : recognize 1B phi models (#4847)

This update categorizes models with 24 layers as MODEL_1B, ensuring compatibility with different Phi model variants without impacting existing Phi-2 model functionality.

17 months agoclip : support more quantization types (#4846)
John [Wed, 10 Jan 2024 13:37:09 +0000 (14:37 +0100)]
clip : support more quantization types (#4846)

Uses ggml functions instead of hardcoded names and adds support to quantize into the modern Q-K variants.
This is just the bare minimum to get k-types working - a more refined choice of types would be needed to get best quality on low quantizations.

I ran a few tests, it doesn't break anything I could notice and a Q6_K ViT works almost as well as Q8_0 but 3 times the inference speed.

17 months agoPython script to compare commits with llama-bench (#4844)
Johannes Gäßler [Wed, 10 Jan 2024 00:04:33 +0000 (01:04 +0100)]
Python script to compare commits with llama-bench (#4844)

17 months agoconvert.py : fix vanilla LLaMA model conversion (#4818)
Austin [Tue, 9 Jan 2024 18:46:46 +0000 (13:46 -0500)]
convert.py : fix vanilla LLaMA model conversion (#4818)

* Update Imports and Add Notes for Future Reference

- Updated import statements in `convert.py`.
- Added import for `AutoTokenizer` from `transformers` module.
- Added conditional import for `gguf` from the local directory.
- Added comments and notes for future reference.

Additional Notes:

- Noted removal of a redundant `TypeAlias` import.
- Noted the removal of a `gguf` debug statement.
- Commented on the presence of `ARCH` and `NDArray` definitions.
- Commented on cleaning up and refactoring data type definitions.

* Refine Model Hyperparameters and Params Class

- Updated type annotations to use `Optional` for clarity.
- Improved method names and attribute consistency.
- Removed unnecessary variables for better code readability.

Additional Notes:

- Highlighted the use of `Optional` for clearer intent.
- Ensured backward and forward compatibility.

* Restore BpeVocab and SentencePieceVocab classes

- Restored the BpeVocab class for handling BPE tokenization.
- Restored the SentencePieceVocab class for SentencePiece tokenization.

These classes are essential for maintaining the original behavior of the codebase.

* refactor: Standardize vocabulary handling with HfVocab

- Replaced VocabLoader with HfVocab, aligning vocabulary handling across classes.
- Updated initialization of HfVocab with local_files_only=True for AutoTokenizer.
- Introduced optional parameter fname_added_tokens for flexible added token management.
- Streamlined added token handling for clarity and conciseness.
- Maintained special tokens and IDs, enhancing token management.
- Simplified token processing methods for improved readability.
- Added a placeholder for score computation with a default value of -1000.0.
- Optimized newline token check for efficiency.
- Updated __repr__ function for clarity in representation.
- Adjusted type alias Vocab to include BpeVocab, SentencePieceVocab, and HfVocab.
- Removed redundant code related to special token handling, reverse vocabulary mapping, and vocabulary file detection.

This refactoring promotes a standardized and modular approach to vocabulary management, facilitating future integration with a VocabFactory and improving code maintainability and scalability.

* refactor: Enhance readability, functionality, and code quality

- Improved code formatting and readability for better maintainability.
- Refactored LazyUnpickler's CLASSES dictionary for clarity.
- Added print statements and warnings in check_vocab_size for user feedback.
- Removed find_vocab_file_path, as it's superseded by VocabFactory.
- Preparatory changes for upcoming classes: OutputFile and VocabFactory.
- Overall focus on code quality, error handling, and consistency.

These changes reflect a continuous effort to refine the codebase, ensuring it meets best practices and prepares for future enhancements, such as the VocabFactory.

* refactor: Update OutputFile class for enhanced model vocabulary management

- Restructured the constructor for improved readability.
- Updated `add_meta_arch` method for flexible model name determination.
- Introduced `handle_tokenizer_model` for mapping vocab types to supported tokenizer models.
- Streamlined vocabulary extraction with `extract_vocabulary_from_model`.
- Simplified vocabulary metadata addition using `add_meta_vocab`.
- Refactored `add_tensor_info` for clarity and consistency.
- Improved error handling for better user feedback.

These changes signify the development of a versatile and comprehensive `OutputFile` class, enabling efficient management of model conversion output, metadata, vocabulary, and tensor information.

* feat: Introduce VocabFactory for flexible vocabulary management in model conversion

- The VocabFactory class is added to facilitate modular vocabulary handling.
- The constructor initializes a directory path and detects vocabulary-related files.
- The _select_file method provides file paths based on vocabulary type (e.g., BPE, SentencePiece).
- _create_special_vocab generates special vocabularies, accommodating different types.
- The load_vocab method loads vocabularies, handling BPE, SentencePiece, and Hugging Face Fast Tokenizer.
- Error handling and logging enhance debugging and user feedback.
- The modular and flexible design simplifies vocabulary management and supports future extensions.

The VocabFactory class enhances code modularity and maintainability, allowing versatile vocabulary handling in the model conversion process.

* refactor: Improve code organization, argument parsing, and user interface

- Renamed 'default_outfile' to 'default_output_file' for clarity.
- Refactored argument parser setup into 'get_argument_parser' function.
- Introduced descriptive comments for each argument in the parser.
- Added '--vocab-type' argument with choices ["spm", "bpe", "hfft"] for vocabulary processing.
- Improved flag naming consistency: '--outfile' to '--out-file' and '--bigendian' to '--big-endian'.
- Enhanced error handling to prevent overwriting input data in 'default_output_file'.
- Made 'argv' in 'main' an optional parameter for flexibility.
- Introduced dynamic import for 'awq.apply_awq' based on 'args.awq_path' for conditional dependency.

These changes enhance code clarity, organization, and the user interface of the script, aligning it with Python best practices and improving maintainability.

* refactor: Further refine functionality, improve user interaction, and streamline vocabulary handling

- Renamed command-line arguments for clarity and consistency.
- Improved path resolution and import adjustments for robustness.
- Thoughtfully handled 'awq-path' and conditional logic for the weighted model.
- Enhanced model and vocabulary loading with the 'VocabFactory' class for structured and adaptable loading.
- Strengthened error handling and user feedback for a more user-friendly experience.
- Structured output file handling with clear conditions and defaults.
- Streamlined and organized the 'main' function for better logic flow.
- Passed 'sys.argv[1:]' to 'main' for adaptability and testability.

These changes solidify the script's functionality, making it more robust, user-friendly, and adaptable. The use of the 'VocabFactory' class is a notable enhancement in efficient vocabulary handling, reflecting a thoughtful and iterative approach to script development.

* chore: Apply ruff formatting to convert.py

Signed-off-by: teleprint-me <redacted>
* Revert to commit 0614c33

* chore: Apply flake8 formatting rules

Signed-off-by: teleprint-me <redacted>
* refactor: Revise `check_vocab_size` for Enhanced Clarity and Correctness

- Resolved an unreachable branch issue by reorganizing the conditional structure.
- Moved the special case check for `params.n_vocab == -1` to the top for immediate assertion.
- Flattened the conditional logic for improved clarity and predictability of the function's behavior.

These changes enhance the readability and functional correctness of the `check_vocab_size` function without altering its intended functionality.

* py : fix outfile and outtype

* py : suggest hint for missing vocab size

---------

Signed-off-by: teleprint-me <redacted>
Co-authored-by: Georgi Gerganov <redacted>
17 months agollava-cli : don't crash if --image flag is invalid (#4835)
Justine Tunney [Tue, 9 Jan 2024 17:59:14 +0000 (09:59 -0800)]
llava-cli : don't crash if --image flag is invalid (#4835)

This change fixes an issue where supplying `--image missing-file` would
result in a segfault due to a null pointer being dereferenced. This can
result in distracting info being printed if robust crash analysis tools
are being used.

17 months agometal : improve dequantize precision to match CPU (#4836)
Georgi Gerganov [Tue, 9 Jan 2024 17:37:08 +0000 (19:37 +0200)]
metal : improve dequantize precision to match CPU (#4836)

ggml-ci

17 months agoscripts : improve get-pg.sh (#4838)
Georgi Gerganov [Tue, 9 Jan 2024 17:20:45 +0000 (19:20 +0200)]
scripts : improve get-pg.sh (#4838)

17 months agoreadme : add 3rd party collama reference to UI list (#4840)
iohub [Tue, 9 Jan 2024 16:45:54 +0000 (00:45 +0800)]
readme : add 3rd party collama reference to UI list (#4840)

Add a VSCode extension for llama.cpp reference to UI list

17 months agoscripts : script to get Paul Graham essays in txt format (#4838)
Georgi Gerganov [Tue, 9 Jan 2024 14:23:05 +0000 (16:23 +0200)]
scripts : script to get Paul Graham essays in txt format (#4838)

17 months agoserver : update readme about token probs (#4777)
Behnam M [Tue, 9 Jan 2024 10:02:05 +0000 (05:02 -0500)]
server : update readme about token probs (#4777)

* updated server readme to reflect the gg/server-token-probs-4088 commit

added explanation for the API's completion result which now includes `completion_probabilities`. Also added a JSON schema that shows the type/structure of `completion_probabilities`.

* simplified the `completion_probabilities` JSON schema

It's now easier to understand what the structure of `completion_probabilities` looks like.

* minor : fix trailing whitespace

---------

Co-authored-by: Georgi Gerganov <redacted>
17 months agoserver : add api-key flag to documentation (#4832)
Zsapi [Tue, 9 Jan 2024 09:12:43 +0000 (10:12 +0100)]
server : add api-key flag to documentation (#4832)

Document the api-key flag added to server in https://github.com/ggerganov/llama.cpp/pull/4441

17 months agoggml : fix vld1q_s8_x4 32-bit compat (#4828)
Georgi Gerganov [Tue, 9 Jan 2024 08:42:06 +0000 (10:42 +0200)]
ggml : fix vld1q_s8_x4 32-bit compat (#4828)

* ggml : fix vld1q_s8_x4 32-bit compat

ggml-ci

* ggml : fix 32-bit ARM compat (cont)

ggml-ci

17 months agoCUDA: faster softmax via shared memory + fp16 math (#4742)
Johannes Gäßler [Tue, 9 Jan 2024 07:58:55 +0000 (08:58 +0100)]
CUDA: faster softmax via shared memory + fp16 math (#4742)

17 months agocommon : fix the short form of `--grp-attn-w`, not `-gat` (#4825)
howlger [Mon, 8 Jan 2024 19:05:53 +0000 (20:05 +0100)]
common : fix the short form of `--grp-attn-w`, not `-gat` (#4825)

See https://github.com/ggerganov/llama.cpp/blob/master/common/common.cpp#L230C53-L230C57

17 months agoreadme : add link to SOTA models
Georgi Gerganov [Mon, 8 Jan 2024 18:25:17 +0000 (20:25 +0200)]
readme : add link to SOTA models

17 months agoSOTA 2-bit quants (#4773)
Kawrakow [Mon, 8 Jan 2024 15:02:32 +0000 (16:02 +0100)]
SOTA 2-bit quants (#4773)

* iq2_xxs: basics

* iq2_xxs: scalar and AVX2 dot products

Needed to change Q8_K to have quants in the -127...127 range,
else the IQ2_XXS AVX implementation becomes very awkward.
The alternative would have been to use Q8_0 instead. Perhaps
I'll change later, for now this is what we have.

* iq2_xxs: ARM_NEON dot product

Somehow strangely slow (112 ms/token).

* iq2_xxs: WIP Metal

Dequantize works, something is still wrong with the
dot product.

* iq2_xxs: Metal dot product now works

We have
PP-512 = 475 t/s
TG-128 = 47.3 t/s

Not the greatest performance, but not complete garbage either.

* iq2_xxs: slighty faster dot product

TG-128 is now 48.4 t/s

* iq2_xxs: slighty faster dot product

TG-128 is now 50.9 t/s

* iq2_xxs: even faster Metal dot product

TG-128 is now 54.1 t/s.

Strangely enough, putting the signs lookup table
into shared memory has a bigger impact than the
grid values being in shared memory.

* iq2_xxs: dequantize CUDA kernel - fix conflict with master

* iq2_xxs: quantized CUDA dot product (MMVQ)

We get TG-128 = 153.1 t/s

* iq2_xxs: slightly faster CUDA dot product

TG-128 is now at 155.1 t/s.

* iq2_xxs: add to llama ftype enum

* iq2_xxs: fix MoE on Metal

* Fix missing MMQ ops when on hipBLAS

I had put the ggml_supports_mmq call at the wrong place.

* Fix bug in qequantize_row_iq2_xxs

The 0.25f factor was missing.
Great detective work by @ggerganov!

* Fixing tests

* PR suggestion

---------

Co-authored-by: Iwan Kawrakow <redacted>
17 months agoswift : exclude ggml-metal.metal from the package (#4822)
Georgi Gerganov [Mon, 8 Jan 2024 14:40:51 +0000 (16:40 +0200)]
swift : exclude ggml-metal.metal from the package (#4822)

17 months agollama.swiftui : update readme
Georgi Gerganov [Mon, 8 Jan 2024 13:57:36 +0000 (15:57 +0200)]
llama.swiftui : update readme

17 months agomain : add self-extend support (#4815)
Georgi Gerganov [Mon, 8 Jan 2024 09:18:32 +0000 (11:18 +0200)]
main : add self-extend support (#4815)

* examples : add passkey test

* passkey : better prints

* passkey : select pass key pos from CLI

* passkey : simplify n_past logic

* llama : "self-extend"-like context extension

* passkey : add comment

* main : add Self-Extend support

* llama : add comment about llama_kv_cache_seq_div

17 months agoexamples : add passkey test (#3856)
Georgi Gerganov [Mon, 8 Jan 2024 09:14:04 +0000 (11:14 +0200)]
examples : add passkey test (#3856)

* examples : add passkey test

* passkey : better prints

* passkey : select pass key pos from CLI

* passkey : simplify n_past logic

* make : add passkey target

* passkey : add "self-extend"-like context extension (#4810)

* llama : "self-extend"-like context extension

* passkey : add comment

* passkey : add readme

17 months agoreadme : add lgrammel/modelfusion JS/TS client for llama.cpp (#4814)
Lars Grammel [Sun, 7 Jan 2024 20:24:11 +0000 (21:24 +0100)]
readme : add lgrammel/modelfusion JS/TS client for llama.cpp (#4814)

17 months agollama-bench : add no-kv-offload parameter (#4812)
slaren [Sun, 7 Jan 2024 16:59:01 +0000 (17:59 +0100)]
llama-bench : add no-kv-offload parameter (#4812)

17 months agoCUDA: fixed redundant value dequantization (#4809)
Johannes Gäßler [Sun, 7 Jan 2024 16:24:08 +0000 (17:24 +0100)]
CUDA: fixed redundant value dequantization (#4809)

17 months agollama : remove unused vars (#4796)
Georgi Gerganov [Sun, 7 Jan 2024 12:29:36 +0000 (14:29 +0200)]
llama : remove unused vars (#4796)

17 months agollama : remove redundant GQA check (#4796)
Georgi Gerganov [Sun, 7 Jan 2024 09:21:53 +0000 (11:21 +0200)]
llama : remove redundant GQA check (#4796)

17 months agollama.swiftui : use llama.cpp as SPM package (#4804)
Alex Azarov [Sun, 7 Jan 2024 08:20:50 +0000 (09:20 +0100)]
llama.swiftui : use llama.cpp as SPM package (#4804)

17 months agollama : print tensor meta for debugging
Georgi Gerganov [Sun, 7 Jan 2024 07:50:31 +0000 (09:50 +0200)]
llama : print tensor meta for debugging

17 months agollama.swiftui : add visionOS target (#4805)
Alex Azarov [Sun, 7 Jan 2024 07:46:55 +0000 (08:46 +0100)]
llama.swiftui : add visionOS target (#4805)

17 months agoggml : use __builtin_amdgcn_sudot4 in __dp4a for gfx11 (#4787)
Konstantin Zhuravlyov [Sun, 7 Jan 2024 06:52:42 +0000 (01:52 -0500)]
ggml : use __builtin_amdgcn_sudot4 in __dp4a for gfx11 (#4787)

17 months agoserver : fix n_predict check (#4798)
Georgi Gerganov [Sun, 7 Jan 2024 06:45:26 +0000 (08:45 +0200)]
server : fix n_predict check (#4798)

17 months agollama.swiftui : use correct pointer for llama_token_eos (#4797)
Daniel Illescas Romero [Sat, 6 Jan 2024 15:12:59 +0000 (16:12 +0100)]
llama.swiftui : use correct pointer for llama_token_eos (#4797)

17 months agoexamples : improve base-translate.sh script (#4783)
Georgi Gerganov [Sat, 6 Jan 2024 09:40:24 +0000 (11:40 +0200)]
examples : improve base-translate.sh script (#4783)

17 months agocmake : check for openblas64 (#4134)
a-n-n-a-l-e-e [Fri, 5 Jan 2024 16:04:40 +0000 (08:04 -0800)]
cmake : check for openblas64 (#4134)

openblas v0.3.22 64-bit pkg-config file is named openblas64.pc
https://github.com/OpenMathLib/OpenBLAS/issues/3790

17 months agoflake.nix : fix typo (#4700)
Ikko Eltociear Ashimine [Fri, 5 Jan 2024 16:02:44 +0000 (01:02 +0900)]
flake.nix : fix typo (#4700)

betwen -> between

17 months agometal : switch back to default.metallib (ggml/681)
Georgi Gerganov [Fri, 5 Jan 2024 14:30:52 +0000 (16:30 +0200)]
metal : switch back to default.metallib (ggml/681)

ggml-ci

17 months agoggml : fix q2_k bpw in comments (ggml/680)
Georgi Gerganov [Fri, 5 Jan 2024 13:36:04 +0000 (15:36 +0200)]
ggml : fix q2_k bpw in comments (ggml/680)

17 months agoggml : add error handling to graph_compute (whisper/1714)
Finn Voorhees [Wed, 3 Jan 2024 13:39:43 +0000 (08:39 -0500)]
ggml : add error handling to graph_compute (whisper/1714)

18 months agoggml : do not sched_yield when calling BLAS (#4761)
Georgi Gerganov [Fri, 5 Jan 2024 13:18:21 +0000 (15:18 +0200)]
ggml : do not sched_yield when calling BLAS (#4761)

* ggml : do not sched_yield when calling BLAS

ggml-ci

* ggml : fix do_yield logic

ggml-ci

* ggml : simplify do_yield logic

ggml-ci

18 months agoexamples : add few-shot translation example (#4783)
Georgi Gerganov [Fri, 5 Jan 2024 13:11:10 +0000 (15:11 +0200)]
examples : add few-shot translation example (#4783)

18 months agofinetune : remove unused includes (#4756)
Daniel Bevenius [Thu, 4 Jan 2024 19:45:37 +0000 (20:45 +0100)]
finetune : remove unused includes (#4756)

This commit removes unused includes from finetune.cpp.

Signed-off-by: Daniel Bevenius <redacted>
18 months agoserver : send token probs for "stream == false" (#4714)
Georgi Gerganov [Thu, 4 Jan 2024 17:56:33 +0000 (19:56 +0200)]
server : send token probs for "stream == false" (#4714)

18 months agoPrint backend name on test-backend-ops failure (#4751)
Johannes Gäßler [Thu, 4 Jan 2024 08:43:23 +0000 (09:43 +0100)]
Print backend name on test-backend-ops failure (#4751)

18 months agollama.swiftui : support loading custom model from file picker (#4767)
singularity [Thu, 4 Jan 2024 08:22:38 +0000 (16:22 +0800)]
llama.swiftui : support loading custom model from file picker (#4767)

* swiftui: support load model from file picker

* swiftui: remove trailing whitespace

18 months agoserver : fix options in README.md (#4765)
Michael Coppola [Thu, 4 Jan 2024 08:17:09 +0000 (03:17 -0500)]
server : fix options in README.md (#4765)

* fix examples/server/README.md

* minor : fix whitespace

---------

Co-authored-by: Georgi Gerganov <redacted>
18 months agoggml : include stdlib.h before intrin.h (#4736)
Georgi Gerganov [Thu, 4 Jan 2024 08:12:26 +0000 (10:12 +0200)]
ggml : include stdlib.h before intrin.h (#4736)

18 months agollama.swiftui : fix build of ggml.metallib (#4754)
singularity [Thu, 4 Jan 2024 07:58:16 +0000 (15:58 +0800)]
llama.swiftui : fix build of ggml.metallib (#4754)

* metal: fix metal backend init failure in swiftui

* metal: build ggml.metallib instead of copy src

* llama.swift : remove debug flags from metallib build

---------

Co-authored-by: Georgi Gerganov <redacted>
18 months agotrain : fix typo in overlapping-samples help msg (#4758)
Daniel Bevenius [Wed, 3 Jan 2024 17:53:40 +0000 (18:53 +0100)]
train : fix typo in overlapping-samples help msg (#4758)

This commit fixes a typo in the help message for the
--overlapping-samples option.

Signed-off-by: Daniel Bevenius <redacted>
18 months agoswift : update Package.swift to use ggml as dependency (#4691)
Ashraful Islam [Wed, 3 Jan 2024 17:30:02 +0000 (11:30 -0600)]
swift : update Package.swift to use ggml as dependency (#4691)

* updates the package.swift to use ggml as dependency

* changes the ggml package url src to ggerganov

18 months agocuda : simplify expression
Georgi Gerganov [Wed, 3 Jan 2024 12:18:46 +0000 (14:18 +0200)]
cuda : simplify expression

Co-authored-by: slaren <redacted>
18 months agocuda : mark I16 and I32 ops as unsupported
Georgi Gerganov [Wed, 3 Jan 2024 11:01:44 +0000 (13:01 +0200)]
cuda : mark I16 and I32 ops as unsupported

ggml-ci

18 months agosync : ggml
Georgi Gerganov [Wed, 3 Jan 2024 09:37:44 +0000 (11:37 +0200)]
sync : ggml

ggml-ci

18 months agometal : add kernel_get_rows_i32
Georgi Gerganov [Wed, 3 Jan 2024 09:35:46 +0000 (11:35 +0200)]
metal : add kernel_get_rows_i32

ggml-ci

18 months agoscripts : fix sync order + metal sed
Georgi Gerganov [Wed, 3 Jan 2024 09:25:54 +0000 (11:25 +0200)]
scripts : fix sync order + metal sed

18 months agoggml : extend ggml_get_rows, ggml_repeat, ggml_concat (ggml/639)
Guillaume Wenzek [Fri, 29 Dec 2023 17:07:03 +0000 (18:07 +0100)]
ggml : extend ggml_get_rows, ggml_repeat, ggml_concat (ggml/639)

* add more int ops

* ggml_compute_forward_dup_bytes

* add tests

* PR comments

* tests : minor indentations

---------

Co-authored-by: Georgi Gerganov <redacted>
18 months agoserver : throw an error when `slot unavailable` (#4741)
Justin Parker [Wed, 3 Jan 2024 08:43:19 +0000 (03:43 -0500)]
server : throw an error when `slot unavailable` (#4741)

18 months agometal : optimize ggml_mul_mat_id (faster Mixtral PP) (#4725)
Georgi Gerganov [Tue, 2 Jan 2024 19:07:47 +0000 (21:07 +0200)]
metal : optimize ggml_mul_mat_id (faster Mixtral PP) (#4725)

* ggml : disable fast-math for Metal (cmake build only)

ggml-ci

* metal : fix Metal API debug warnings

* cmake : add -fno-inline for Metal build (#4545)

* metal : fix API debug warnings

* metal : fix compile warnings

* metal : use uint64_t for strides

* cmake : rename option to LLAMA_METAL_SHADER_DEBUG

* metal : fix mat-vec Q8_0 kernel for BS > 1

* metal : normalize mat-vec kernel signatures

* cmake : respect LLAMA_QKK_64 option

* metal : fix mat-vec Q4_K kernel for QK_K == 64

* metal : optimizing ggml_mul_mat_id (wip)

* metal : minor fix

* metal : opt mul_mm_id

18 months agoserver : add token counts to html footer (#4738)
Phil H [Tue, 2 Jan 2024 15:48:49 +0000 (15:48 +0000)]
server : add token counts to html footer (#4738)

* server: add token counts to stats

* server: generate hpp

---------

Co-authored-by: phiharri <redacted>
18 months agollama : llama_model_desc print number of experts
Georgi Gerganov [Tue, 2 Jan 2024 14:26:45 +0000 (16:26 +0200)]
llama : llama_model_desc print number of experts

18 months agollama : replace all API facing `int`'s with `int32_t` (#4577)
Marcus Dunn [Tue, 2 Jan 2024 14:15:16 +0000 (06:15 -0800)]
llama : replace all API facing `int`'s with `int32_t` (#4577)

* replaced all API facing `int`'s with `int32_t`

* formatting and missed `int` in `llama_token_to_piece`

18 months agollama : differentiate the KV dims in the attention (#4657)
postmasters [Tue, 2 Jan 2024 11:51:28 +0000 (03:51 -0800)]
llama : differentiate the KV dims in the attention (#4657)

* Add n_key_dim and n_value_dim

Some models use values that are not derived from `n_embd`.
Also remove `n_embd_head` and `n_embd_gqa` because it is not clear
which "head" is referred to (key or value).

Fix issue #4648.

* Fix `llm_build_kqv` to use `n_value_gqa`

* Rebase

* Rename variables

* Fix llm_build_kqv to be more generic wrt n_embd_head_k

* Update default values for n_embd_head_k and n_embd_head_v

Co-authored-by: Georgi Gerganov <redacted>
* Fix llm_load_tensors: the asserts were not backcompat

---------

Co-authored-by: Georgi Gerganov <redacted>
18 months agoeditorconfig : fix whitespace and indentation #4710
Georgi Gerganov [Tue, 2 Jan 2024 11:28:15 +0000 (13:28 +0200)]
editorconfig : fix whitespace and indentation #4710

18 months agoserver : add --override-kv parameter (#4710)
minarchist [Tue, 2 Jan 2024 10:38:15 +0000 (04:38 -0600)]
server : add --override-kv parameter (#4710)

* Changes to server to allow metadata override

* documentation

* flake.nix: expose full scope in legacyPackages

* flake.nix: rocm not yet supported on aarch64, so hide the output

* flake.nix: expose checks

* workflows: nix-ci: init; build flake outputs

* workflows: nix-ci: add a job for eval

* workflows: weekly `nix flake update`

* workflows: nix-flakestry: drop tag filters

...and add a job for flakehub.com

* workflows: nix-ci: add a qemu job for jetsons

* flake.nix: suggest the binary caches

* flake.lock: update

to a commit recently cached by nixpkgs-cuda-ci

---------

Co-authored-by: John <redacted>
Co-authored-by: Someone Serge <redacted>
18 months agopy : re-enable mmap in convert hf (#4732)
Nam D. Tran [Tue, 2 Jan 2024 09:23:38 +0000 (16:23 +0700)]
py : re-enable mmap in convert hf (#4732)

* update: awq support llama-7b model

* update: change order

* update: benchmark results for llama2-7b

* update: mistral 7b v1 benchmark

* update: support 4 models

* fix: Readme

* update: ready for PR

* update: readme

* fix: readme

* update: change order import

* black

* format code

* update: work for bot mpt and awqmpt

* update: readme

* Rename to llm_build_ffn_mpt_awq

* Formatted other files

* Fixed params count

* fix: remove code

* update: more detail for mpt

* fix: readme

* fix: readme

* update: change folder architecture

* fix: common.cpp

* fix: readme

* fix: remove ggml_repeat

* update: cicd

* update: cicd

* uppdate: remove use_awq arg

* update: readme

* llama : adapt plamo to new ffn

ggml-ci

* fix: update torch version

---------

Co-authored-by: Trần Đức Nam <redacted>
Co-authored-by: Le Hoang Anh <redacted>
Co-authored-by: Georgi Gerganov <redacted>
18 months agofinetune: fix typo in README.md (#4733)
Daniel Bevenius [Tue, 2 Jan 2024 09:16:55 +0000 (10:16 +0100)]
finetune: fix typo in README.md (#4733)

Signed-off-by: Daniel Bevenius <redacted>
18 months agometal : enable shader debugging (cmake option) (#4705)
Georgi Gerganov [Tue, 2 Jan 2024 08:57:44 +0000 (10:57 +0200)]
metal : enable shader debugging (cmake option) (#4705)

* ggml : disable fast-math for Metal (cmake build only)

ggml-ci

* metal : fix Metal API debug warnings

* cmake : add -fno-inline for Metal build (#4545)

* metal : fix API debug warnings

* metal : fix compile warnings

* metal : use uint64_t for strides

* cmake : rename option to LLAMA_METAL_SHADER_DEBUG

* metal : fix mat-vec Q8_0 kernel for BS > 1

* metal : normalize mat-vec kernel signatures

* cmake : respect LLAMA_QKK_64 option

* metal : fix mat-vec Q4_K kernel for QK_K == 64

ggml-ci

18 months agoflake.lock: update
Someone Serge [Sun, 31 Dec 2023 17:42:22 +0000 (17:42 +0000)]
flake.lock: update

to a commit recently cached by nixpkgs-cuda-ci

18 months agoflake.nix: suggest the binary caches
Someone Serge [Sat, 30 Dec 2023 18:25:25 +0000 (18:25 +0000)]
flake.nix: suggest the binary caches

18 months agoworkflows: nix-ci: add a qemu job for jetsons
Someone Serge [Sat, 30 Dec 2023 18:01:07 +0000 (18:01 +0000)]
workflows: nix-ci: add a qemu job for jetsons

18 months agoworkflows: nix-flakestry: drop tag filters
Someone Serge [Sat, 30 Dec 2023 17:36:08 +0000 (17:36 +0000)]
workflows: nix-flakestry: drop tag filters

...and add a job for flakehub.com

18 months agoworkflows: weekly `nix flake update`
Someone Serge [Sat, 30 Dec 2023 16:38:36 +0000 (16:38 +0000)]
workflows: weekly `nix flake update`

18 months agoworkflows: nix-ci: add a job for eval
Someone Serge [Sat, 30 Dec 2023 17:19:11 +0000 (17:19 +0000)]
workflows: nix-ci: add a job for eval

18 months agoworkflows: nix-ci: init; build flake outputs
Someone Serge [Tue, 26 Dec 2023 19:17:26 +0000 (19:17 +0000)]
workflows: nix-ci: init; build flake outputs

18 months agoflake.nix: expose checks
Someone Serge [Fri, 29 Dec 2023 16:21:50 +0000 (16:21 +0000)]
flake.nix: expose checks

18 months agoflake.nix: rocm not yet supported on aarch64, so hide the output
Someone Serge [Tue, 26 Dec 2023 23:34:40 +0000 (23:34 +0000)]
flake.nix: rocm not yet supported on aarch64, so hide the output

18 months agoflake.nix: expose full scope in legacyPackages
Someone Serge [Fri, 29 Dec 2023 16:15:37 +0000 (16:15 +0000)]
flake.nix: expose full scope in legacyPackages

18 months agoggml : add ggml_vdotq_s32 alias (#4715)
Georgi Gerganov [Sun, 31 Dec 2023 09:43:31 +0000 (11:43 +0200)]
ggml : add ggml_vdotq_s32 alias (#4715)

ggml-ci

18 months agoclip : refactor + bug fixes (#4696)
Georgi Gerganov [Sat, 30 Dec 2023 21:24:42 +0000 (23:24 +0200)]
clip : refactor + bug fixes (#4696)

* clip : refactor + bug fixes

ggml-ci

* server : add log message

18 months agoCUDA: fixed tensor cores not being used on RDNA3 (#4697)
Johannes Gäßler [Sat, 30 Dec 2023 12:52:01 +0000 (13:52 +0100)]
CUDA: fixed tensor cores not being used on RDNA3 (#4697)

18 months agoggml : add ggml_cpu_has_avx_vnni() (#4589)
automaticcat [Sat, 30 Dec 2023 08:07:48 +0000 (15:07 +0700)]
ggml : add ggml_cpu_has_avx_vnni() (#4589)

* feat: add avx_vnni based on intel documents

* ggml: add avx vnni based on intel document

* llama: add avx vnni information display

* docs: add more details about using oneMKL and oneAPI for intel processors

* docs: add more details about using oneMKL and oneAPI for intel processors

* docs: add more details about using oneMKL and oneAPI for intel processors

* docs: add more details about using oneMKL and oneAPI for intel processors

* docs: add more details about using oneMKL and oneAPI for intel processors

* Update ggml.c

Fix indentation upgate

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

Co-authored-by: Georgi Gerganov <redacted>
18 months agoCUDA: fix tensor core logic for Pascal and HIP (#4682)
Johannes Gäßler [Fri, 29 Dec 2023 22:12:53 +0000 (23:12 +0100)]
CUDA: fix tensor core logic for Pascal and HIP (#4682)

18 months agoclip : use ggml_backend_buffer_is_host (#4205)
Georgi Gerganov [Fri, 29 Dec 2023 16:53:34 +0000 (18:53 +0200)]
clip : use ggml_backend_buffer_is_host (#4205)

18 months agoclip : enable gpu backend (#4205)
Steward Garcia [Fri, 29 Dec 2023 16:52:15 +0000 (11:52 -0500)]
clip : enable gpu backend (#4205)

* clip: enable CUDA backend

* add missing kernels

* add enough padding for alignment

* remove ggml_repeat of clip.cpp

* add metal backend

* llava : fixes

- avoid ggml_repeat
- use GGML_USE_ instead of CLIP_USE_ macros
- remove unused vars

---------

Co-authored-by: Georgi Gerganov <redacted>
18 months agocuda: fix vmm oom issue on NVIDIA AGX Orin (#4687)
hydai [Fri, 29 Dec 2023 16:31:19 +0000 (00:31 +0800)]
cuda: fix vmm oom issue on NVIDIA AGX Orin (#4687)

Signed-off-by: hydai <redacted>
18 months agopython : add check-requirements.sh and GitHub workflow (#4585)
crasm [Fri, 29 Dec 2023 14:50:29 +0000 (09:50 -0500)]
python : add check-requirements.sh and GitHub workflow (#4585)

* python: add check-requirements.sh and GitHub workflow

This script and workflow forces package versions to remain compatible
across all convert*.py scripts, while allowing secondary convert scripts
to import dependencies not wanted in convert.py.

* Move requirements into ./requirements

* Fail on "==" being used for package requirements (but can be suppressed)

* Enforce "compatible release" syntax instead of ==

* Update workflow

* Add upper version bound for transformers and protobuf

* improve check-requirements.sh

* small syntax change

* don't remove venvs if nocleanup is passed

* See if this fixes docker workflow

* Move check-requirements.sh into ./scripts/

---------

Co-authored-by: Jared Van Bortel <redacted>
18 months agoflake.nix : rewrite (#4605)
Philip Taron [Fri, 29 Dec 2023 14:42:26 +0000 (06:42 -0800)]
flake.nix : rewrite (#4605)

* flake.lock: update to hotfix CUDA::cuda_driver

Required to support https://github.com/ggerganov/llama.cpp/pull/4606

* flake.nix: rewrite

1. Split into separate files per output.

2. Added overlays, so that this flake can be integrated into others.
   The names in the overlay are `llama-cpp`, `llama-cpp-opencl`,
   `llama-cpp-cuda`, and `llama-cpp-rocm` so that they fit into the
   broader set of Nix packages from [nixpkgs](https://github.com/nixos/nixpkgs).

3. Use [callPackage](https://summer.nixos.org/blog/callpackage-a-tool-for-the-lazy/)
   rather than `with pkgs;` so that there's dependency injection rather
   than dependency lookup.

4. Add a description and meta information for each package.
   The description includes a bit about what's trying to accelerate each one.

5. Use specific CUDA packages instead of cudatoolkit on the advice of SomeoneSerge.

6. Format with `serokell/nixfmt` for a consistent style.

7. Update `flake.lock` with the latest goods.

* flake.nix: use finalPackage instead of passing it manually

* nix: unclutter darwin support

* nix: pass most darwin frameworks unconditionally

...for simplicity

* *.nix: nixfmt

nix shell github:piegamesde/nixfmt/rfc101-style --command \
    nixfmt flake.nix .devops/nix/*.nix

* flake.nix: add maintainers

* nix: move meta down to follow Nixpkgs style more closely

* nix: add missing meta attributes

nix: clarify the interpretation of meta.maintainers

nix: clarify the meaning of "broken" and "badPlatforms"

nix: passthru: expose the use* flags for inspection

E.g.:

```
❯ nix eval .#cuda.useCuda
true
```

* flake.nix: avoid re-evaluating nixpkgs too many times

* flake.nix: use flake-parts

* nix: migrate to pname+version

* flake.nix: overlay: expose both the namespace and the default attribute

* ci: add the (Nix) flakestry workflow

* nix: cmakeFlags: explicit OFF bools

* nix: cuda: reduce runtime closure

* nix: fewer rebuilds

* nix: respect config.cudaCapabilities

* nix: add the impure driver's location to the DT_RUNPATHs

* nix: clean sources more thoroughly

...this way outPaths change less frequently,
and so there are fewer rebuilds

* nix: explicit mpi support

* nix: explicit jetson support

* flake.nix: darwin: only expose the default

---------

Co-authored-by: Someone Serge <redacted>
18 months agocmake : fix ld warning duplicate libraries libllama.a (#4671)
Cuong Trinh Manh [Fri, 29 Dec 2023 14:39:15 +0000 (21:39 +0700)]
cmake : fix ld warning duplicate libraries libllama.a (#4671)

* fix "ld: warning: ignoring duplicate libraries: '../libllama.a'"

* fix warning in example.

18 months agollava-cli : refactor to use sampling library (#4669)
Justine Tunney [Fri, 29 Dec 2023 14:38:38 +0000 (06:38 -0800)]
llava-cli : refactor to use sampling library (#4669)

This change makes it possible to use flags like `--grammar` when using
the `llava-cli` program. The rest is just code cleanup deleting a long
standing TODO comment.

This change also ensures that logging information is emitted to stderr
which helps the `llava-cli` command be more friendly to shell scripts.

See Mozilla-Ocho/llamafile@1cd334f

18 months agoserver : replace sleep with condition variables (#4673)
Justine Tunney [Fri, 29 Dec 2023 14:24:12 +0000 (06:24 -0800)]
server : replace sleep with condition variables (#4673)

The server currently schedules tasks using a sleep(5ms) busy loop. This
adds unnecessary latency since most sleep implementations do a round up
to the system scheduling quantum (usually 10ms). Other libc sleep impls
spin for smaller time intervals which results in the server's busy loop
consuming all available cpu. Having the explicit notify() / wait() code
also helps aid in the readability of the server code.

See mozilla-Ocho/llamafile@711344b

18 months agoserver : fix OpenAI server sampling w.r.t. penalty. (#4675)
SakuraUmi [Fri, 29 Dec 2023 14:22:44 +0000 (22:22 +0800)]
server : fix OpenAI server sampling w.r.t. penalty. (#4675)

18 months agoserver : allow to generate multimodal embeddings (#4681)
Karthik Sethuraman [Fri, 29 Dec 2023 14:22:10 +0000 (06:22 -0800)]
server : allow to generate multimodal embeddings (#4681)

18 months agomain-cmake-pkg : fix build issue (#4665)
andrijdavid [Fri, 29 Dec 2023 14:18:20 +0000 (15:18 +0100)]
main-cmake-pkg : fix build issue (#4665)

* Fix main-cmake-pkg compilation

* Use glob to load common files

* cmake : fix trailing whitespace

---------

Co-authored-by: Georgi Gerganov <redacted>
18 months agollama.swiftui : fix infinite loop, ouput timings, buff UI (#4674)
Peter Sugihara [Fri, 29 Dec 2023 13:58:56 +0000 (05:58 -0800)]
llama.swiftui : fix infinite loop, ouput timings, buff UI (#4674)

* fix infinite loop

* slight UI simplification, clearer UX

* clearer UI text, add timings to completion log

18 months agoscripts : print list of sync commits
Georgi Gerganov [Fri, 29 Dec 2023 13:12:35 +0000 (15:12 +0200)]
scripts : print list of sync commits

18 months agoci : build with CLBlast + ggml-opencl use GGML_API (whisper/1576)
Tamotsu Takahashi [Fri, 29 Dec 2023 10:23:27 +0000 (19:23 +0900)]
ci : build with CLBlast + ggml-opencl use GGML_API (whisper/1576)

* Build with CLBlast

* Declare GGML_API

After rebasing, examples/talk-llama failed:

"D:\a\whisper.cpp\whisper.cpp\build\ALL_BUILD.vcxproj" (build target) (1) ->
"D:\a\whisper.cpp\whisper.cpp\build\examples\talk-llama\talk-llama.vcxproj" (default target) (14) ->
(Link target) ->
  llama.obj : error LNK2019: unresolved external symbol ggml_cl_free_data referenced in function "public: __cdecl llama_model::~llama_model(void)" (??1llama_model@@QEAA@XZ) [D:\a\whisper.cpp\whisper.cpp\build\examples\talk-llama\talk-llama.vcxproj]
  llama.obj : error LNK2019: unresolved external symbol ggml_cl_transform_tensor referenced in function "public: void __cdecl llama_model_loader::load_all_data(struct ggml_context *,void (__cdecl*)(float,void *),void *,struct llama_mlock *)" (?load_all_data@llama_model_loader@@QEAAXPEAUggml_context@@P6AXMPEAX@Z1PEAUllama_mlock@@@Z) [D:\a\whisper.cpp\whisper.cpp\build\examples\talk-llama\talk-llama.vcxproj]
  D:\a\whisper.cpp\whisper.cpp\build\bin\Release\talk-llama.exe : fatal error LNK1120: 2 unresolved externals [D:\a\whisper.cpp\whisper.cpp\build\examples\talk-llama\talk-llama.vcxproj]

18 months agosync : ggml
Georgi Gerganov [Fri, 29 Dec 2023 12:56:41 +0000 (14:56 +0200)]
sync : ggml