]> git.djapps.eu Git - pkg/ggml/sources/ggml/log
pkg/ggml/sources/ggml
20 months agogguf : add file format specification (#302)
Philpax [Wed, 1 Nov 2023 17:01:49 +0000 (18:01 +0100)]
gguf : add file format specification (#302)

* docs: gguf spec first pass

* docs(gguf): update with review comments

* docs(gguf): update with review comments

* docs(gguf): quant version optional for unquant

* docs(gguf): normalize naming, add whisper

* docs(gguf): more review updates

* docs(gguf): add norm eps and added_tokens

* docs(gguf): move padding

* docs(gguf): remove migration tool

* docs(gguf): make offset base explicit

* docs(gguf): fix replace oops

* docs(gguf): alignment metadata+tensor name len max

* docs(gguf): clarification, fixes, tensor names

* docs(gguf): clarify license

* docs(gguf): minor tweaks

* docs(gguf): data layout, GQA eq, no ft, LE GGUF

* docs(gguf): fix magic order

* docs(gguf): match impl

* docs(gguf): specify fallback alignment

* docs(gguf): remove TensorInfo::n_elements

* docs(gguf): filetype, rope base/linear scale

* docs(gguf): v2 - uint64 all the things

* docs(gguf): tweak extensibility wording

* docs(gguf): fix spec discrepancies

* docs(gguf): v3 + other fixes

* fix(editorconfig): use 2-space tabs for markdown

* docs(gguf): clarify big-endian

20 months agoggml-backend : use __declspec with msvc (#599)
Andrei [Wed, 1 Nov 2023 12:08:28 +0000 (08:08 -0400)]
ggml-backend : use __declspec with msvc (#599)

20 months agoggml-backend v2 : add ggml_backend_sched (#586)
slaren [Mon, 30 Oct 2023 20:28:09 +0000 (21:28 +0100)]
ggml-backend v2 : add ggml_backend_sched (#586)

* ggml-backend-v2 wip

* fix metal build

* ggml-alloc : use a real backend buffer in measure mode

* backend sched : ignore view ops to reduce the number of splits

* dynamic ggml_cgraph wip

* dyn graphs : remove n_tasks from ggml_cplan

* dyn graphs : update ggml_graph_import

* reset hash table in ggml_build_forward

* ggml-alloc : split into tensor and graph allocators

* add ggml_backend_sched_set_node_backend

* remove ggml_build_forward_ctx, ggml_build_backward_ctx
add ggml_opt_params::graph_size
add ggml_new_graph_custom, ggml_graph_overhead_custom
add ggml_graph_clear

* update examples and tests, fix issues

* update more examples

* update gpt-2/main-backend.cpp from master

* ggml : fix copmile warning

* ci : update yolo, fix mnist, use gpt-2-backend

* ggml : fix uninit warning

* ci : switch to gpt-2-backend2

ggml-ci

* metal : skip noops early to avoid warnings from ggml_metal_get_buffer

---------

Co-authored-by: Georgi Gerganov <redacted>
20 months agoyolo : add example implementing YOLO object detection (#576)
Radoslav Gerganov [Mon, 30 Oct 2023 04:34:14 +0000 (06:34 +0200)]
yolo : add example implementing YOLO object detection (#576)

* Add leaky relu activation

* Add padding support in ggml_pool_2d()

* Add yolov3-tiny example

20 months agogitignore : add ggml-model-f16.bin (#597)
Jiří Podivín [Mon, 30 Oct 2023 04:29:41 +0000 (05:29 +0100)]
gitignore : add ggml-model-f16.bin (#597)

Signed-off-by: Jiri Podivin <redacted>
20 months agocmake : cuda architectures: allow user override, only set local if not globally set...
Borislav Stanimirov [Mon, 30 Oct 2023 04:28:11 +0000 (06:28 +0200)]
cmake : cuda architectures: allow user override, only set local if not globally set (#595)

20 months agosync : llama.cpp (CUDA, Metal, OpenCL, gguf magic, ggml iter) (#592)
Georgi Gerganov [Tue, 24 Oct 2023 18:51:12 +0000 (21:51 +0300)]
sync : llama.cpp (CUDA, Metal, OpenCL, gguf magic, ggml iter) (#592)

ggml-ci

20 months agoggml : memset dst to 0 in `ggml_conv_transpose_1d` and `ggml_conv_transpose_2d` ...
PAB [Tue, 24 Oct 2023 16:37:06 +0000 (18:37 +0200)]
ggml : memset dst to 0 in `ggml_conv_transpose_1d` and `ggml_conv_transpose_2d` (#591)

* wrong indexation of kernel buffer

* memset in dst

* apply same fix to ggml_conv_transpose_2d

20 months agogpt-2 : fix allocr worst-case when n_parallel > prompt size
Georgi Gerganov [Fri, 20 Oct 2023 07:12:39 +0000 (10:12 +0300)]
gpt-2 : fix allocr worst-case when n_parallel > prompt size

20 months agogpt-2 : add ignore-eos flag
Georgi Gerganov [Fri, 20 Oct 2023 07:05:28 +0000 (10:05 +0300)]
gpt-2 : add ignore-eos flag

20 months agogpt-2 : allow setting custom context size (i.e. large KV cache)
Georgi Gerganov [Fri, 20 Oct 2023 06:57:04 +0000 (09:57 +0300)]
gpt-2 : allow setting custom context size (i.e. large KV cache)

20 months agoci : add SAM test + improve whisper test (#583)
Georgi Gerganov [Mon, 16 Oct 2023 13:48:40 +0000 (16:48 +0300)]
ci : add SAM test + improve whisper test (#583)

ggml-ci

20 months agotests : add ggml_conv_transpose_1d test (#582)
PAB [Sun, 15 Oct 2023 21:24:27 +0000 (23:24 +0200)]
tests : add ggml_conv_transpose_1d test (#582)

20 months agoci : add gpt-2-batched test
Georgi Gerganov [Thu, 12 Oct 2023 14:07:15 +0000 (17:07 +0300)]
ci : add gpt-2-batched test

20 months agogpt-2 : add batched decoding example (#572)
Yavor Ivanov [Thu, 12 Oct 2023 14:08:09 +0000 (17:08 +0300)]
gpt-2 : add batched decoding example (#572)

* Initial attempt to make gpt2 do parallel decoding

* Fix crash on trying to use empty embd

* Make it work for n_parallel=1

* Add short way of passing n_parallel argument

* Move gpt-2 batched to a separate target and cpp file

* Add batched sample output to README and remove hardcoded model path and prompt

* gpt-2-batched : fix n_kv heuristic

* Free batch at end of example

* gpt-2-batched : simplify kv cache stuff (#574)

ggml-ci

* Fix not generating n_predict tokens and fix warn

* minor : readme

* Add check for end token and mark the stream as finished

---------

Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: YavorGIvanov <redacted>
20 months agoci : add M1 node (#577)
Georgi Gerganov [Thu, 12 Oct 2023 11:39:39 +0000 (14:39 +0300)]
ci : add M1 node (#577)

ggml-ci

20 months agoreadme : add qwen example (#575)
Shijie [Thu, 12 Oct 2023 07:13:22 +0000 (15:13 +0800)]
readme : add qwen example (#575)

20 months agocmake : fix string matching
Georgi Gerganov [Wed, 11 Oct 2023 19:33:24 +0000 (22:33 +0300)]
cmake : fix string matching

20 months agotests : do not build test-vec1 on systems without avx (#573)
slaren [Wed, 11 Oct 2023 18:52:43 +0000 (20:52 +0200)]
tests : do not build test-vec1 on systems without avx (#573)

20 months agoggml : faster ggml_conv_2d using 2-stage op (#483)
leejet [Mon, 9 Oct 2023 15:18:47 +0000 (23:18 +0800)]
ggml : faster ggml_conv_2d using 2-stage op (#483)

* ggml : fix ggm_conv_2d impl

* ggml : make ggml_conv_2d a little faster

* ggml : reorganize ggml_conv_2d code

* ggml : make ggml_conv_2d faster

* use int64_t in conv_2d stage 0

* ggml : add TODO about im2col

---------

Co-authored-by: Georgi Gerganov <redacted>
20 months agocuda : int counters for device, fix fprintf warning (#560)
Borislav Stanimirov [Mon, 9 Oct 2023 15:15:20 +0000 (18:15 +0300)]
cuda : int counters for device, fix fprintf warning (#560)

20 months agoDisable ggml-alloc assert for CPU version of Sam.cpp if the view doesn't have a buffe...
Yavor Ivanov [Mon, 9 Oct 2023 12:24:37 +0000 (15:24 +0300)]
Disable ggml-alloc assert for CPU version of Sam.cpp if the view doesn't have a buffer (#562)

20 months agosync : llama.cpp (Metal + OpenCL + minor alibi) (#558)
Georgi Gerganov [Sun, 8 Oct 2023 16:44:14 +0000 (19:44 +0300)]
sync : llama.cpp (Metal + OpenCL + minor alibi) (#558)

ggml-ci

20 months agofix MSVC build issues (#557)
slaren [Sun, 8 Oct 2023 13:45:22 +0000 (15:45 +0200)]
fix MSVC build issues (#557)

* fix MSVC build issues

20 months agoggml-alloc : fix crash when used without ggml-backend (#555)
slaren [Sat, 7 Oct 2023 10:36:54 +0000 (12:36 +0200)]
ggml-alloc : fix crash when used without ggml-backend (#555)

* ggml-alloc : fix crash when used without ggml-backend

* fix regression in parent reuse that caused increased memory usage

20 months agoreadme : mention Metal could be used for gpt-2 (#553)
Pierre Alexandre SCHEMBRI [Sat, 7 Oct 2023 10:29:33 +0000 (12:29 +0200)]
readme : mention Metal could be used for gpt-2 (#553)

20 months agoggml backends interface v1 (#547)
slaren [Fri, 6 Oct 2023 16:51:25 +0000 (18:51 +0200)]
ggml backends interface v1 (#547)

* ggml backends interface v1

* ggml-backend : metal (#552)

---------

Co-authored-by: Georgi Gerganov <redacted>
20 months agoggml : delete duplicate logging macros (#531)
Hyunsung Lee [Fri, 6 Oct 2023 14:01:42 +0000 (23:01 +0900)]
ggml : delete duplicate logging macros (#531)

* remove duplicate macros

* .

21 months agosync : llama.cpp (training, refactoring) (#548)
Georgi Gerganov [Wed, 4 Oct 2023 12:53:05 +0000 (15:53 +0300)]
sync : llama.cpp (training, refactoring) (#548)

* sync : llama.cpp (training, refactoring)

* examples : fix ggml_rope

* ggml : better optimizer cancel handling

ggml-ci

* ggml : fix UBs

ggml-ci

* ggml : add TODO for refactoring the opt cancellation

21 months agocmake : add OPENCL_LIB to solve problem [cannot resolve external symbol clxxxx ]...
布客飞龙 [Wed, 4 Oct 2023 09:04:16 +0000 (17:04 +0800)]
cmake : add OPENCL_LIB to solve problem [cannot resolve external symbol clxxxx ] (#527)

21 months agoggml : fix batch for ggml_conv_2d (#528)
skirodev [Thu, 28 Sep 2023 21:10:45 +0000 (05:10 +0800)]
ggml : fix batch for ggml_conv_2d (#528)

21 months agoggml : add `GGML_OP_CONV_TRANSPOSE_1D` (#524)
PAB [Thu, 28 Sep 2023 21:09:51 +0000 (23:09 +0200)]
ggml : add `GGML_OP_CONV_TRANSPOSE_1D` (#524)

* introduce GGML_OP_CONV_TRANSPOSE_1D

* implementation

* increment GGML_OP_COUNT

* rename calc_conv_transpose

* fix permutation of kernel data

---------

Co-authored-by: Georgi Gerganov <redacted>
21 months agoggml : complete implementation of `GGML_OP_CONV_1D` (#523)
PAB [Thu, 28 Sep 2023 21:03:34 +0000 (23:03 +0200)]
ggml : complete implementation of `GGML_OP_CONV_1D` (#523)

* implementation

* fix wrong call to function

* matching closely ggml_conv_2d

* optimized conv_1d with stages 0 and 1

* working implementation

21 months agoci : add whisper test (#525)
Georgi Gerganov [Fri, 15 Sep 2023 17:58:43 +0000 (20:58 +0300)]
ci : add whisper test (#525)

ggml-ci

21 months agoexamples : fix compile warnings
Georgi Gerganov [Fri, 15 Sep 2023 17:46:00 +0000 (20:46 +0300)]
examples : fix compile warnings

21 months agosync : whisper.cpp (Metal + ggml sched_yield fix + reduce ggml-alloc size) (#522)
Georgi Gerganov [Fri, 15 Sep 2023 16:07:30 +0000 (19:07 +0300)]
sync : whisper.cpp (Metal + ggml sched_yield fix + reduce ggml-alloc size) (#522)

ggml-ci

21 months agoci : add Metal build (#514)
Diogo [Fri, 8 Sep 2023 16:54:30 +0000 (12:54 -0400)]
ci : add Metal build (#514)

* metal on mac

* remove apt-get

* added xcrun prefix

21 months agoci : add CLBlast build (#513)
Diogo [Fri, 8 Sep 2023 15:07:53 +0000 (11:07 -0400)]
ci : add CLBlast build (#513)

* added clblast test to ci

* moved threads to env

* changed name

* upgraded checkout to v3

21 months agocuda : suppress compiler warning of unused variables (#505)
Jiahao Li [Fri, 8 Sep 2023 15:01:21 +0000 (23:01 +0800)]
cuda : suppress compiler warning of unused variables (#505)

21 months agocmake : solve prob "clblast.h not found" (#506)
布客飞龙 [Fri, 8 Sep 2023 15:01:02 +0000 (23:01 +0800)]
cmake : solve prob "clblast.h not found" (#506)

21 months agoggml : mark ggml_format_name as a printf-like function (#508)
Cebtenzzre [Fri, 8 Sep 2023 14:58:01 +0000 (10:58 -0400)]
ggml : mark ggml_format_name as a printf-like function (#508)

21 months agoggml : gguf_context const-correctness (#509)
Cebtenzzre [Fri, 8 Sep 2023 14:57:35 +0000 (10:57 -0400)]
ggml : gguf_context const-correctness (#509)

21 months agosync : whisper (POSIX) (#511)
Georgi Gerganov [Fri, 8 Sep 2023 14:57:04 +0000 (17:57 +0300)]
sync : whisper (POSIX) (#511)

* sync : whisper (POSIX)

ggml-ci

* sync : llama (HBM + Metal + style)

ggml-ci

21 months agoFix SAM example mask output with latest ggml
YavorGIvanov [Fri, 8 Sep 2023 13:17:44 +0000 (16:17 +0300)]
Fix SAM example mask output with latest ggml

- I am not sure why this inplace removal causes the output to turn
  correct again. I spend some time debugging and trying different
things, but my assumption is that some dependency is not properly
propagated and the allocator doesn't know about some tensor and
therefore decided to free it and overwrite its memory
- I also added commented out build_forward_expand, which also fixes
the output, but I am still not sure why
- Additionally I am still trying to figure out why the
  ggml_allocr_alloc(..) calls after the ggml_conv_transpose_2d_p0 are
needed
- I guess I have to spend some time debugging the ggml allocator and
  figure out what wrong is happening in this operations. Probably
something wrong in the operation implementation that I am unable to
notice.

Fixes #510.

21 months agocuda : support flattened GLM-style rope to reduce kernel launch (#477)
Jiahao Li [Tue, 5 Sep 2023 18:11:11 +0000 (02:11 +0800)]
cuda : support flattened GLM-style rope to reduce kernel launch (#477)

21 months agowhisper : minor sync
Georgi Gerganov [Tue, 5 Sep 2023 13:37:55 +0000 (16:37 +0300)]
whisper : minor sync

21 months agosam : remove ggml_repeat and use inplace operation (#493)
Yavor Ivanov [Tue, 5 Sep 2023 11:40:17 +0000 (14:40 +0300)]
sam : remove ggml_repeat and use inplace operation (#493)

21 months agoggml : sync llama.cpp (view_src + alloc improvements) (#504)
Georgi Gerganov [Tue, 5 Sep 2023 11:38:30 +0000 (14:38 +0300)]
ggml : sync llama.cpp (view_src + alloc improvements) (#504)

ggml-ci

21 months agowhisper : sync (match OpenAI input, convert, new features) (#495)
Georgi Gerganov [Tue, 5 Sep 2023 10:55:06 +0000 (13:55 +0300)]
whisper : sync (match OpenAI input, convert, new features) (#495)

ggml-ci

22 months agoggml : fix L-BFGS linesearch loop (close #501)
Georgi Gerganov [Sat, 2 Sep 2023 07:07:04 +0000 (10:07 +0300)]
ggml : fix L-BFGS linesearch loop (close #501)

22 months agomnist : update the README (#498)
Radoslav Gerganov [Wed, 30 Aug 2023 11:48:16 +0000 (14:48 +0300)]
mnist : update the README (#498)

22 months agobuild : fix msvc warnings (#496)
Borislav Stanimirov [Tue, 29 Aug 2023 13:36:59 +0000 (16:36 +0300)]
build : fix msvc warnings (#496)

22 months agoCUDA: fix build and enable warnings (#494)
Cebtenzzre [Tue, 29 Aug 2023 12:34:59 +0000 (08:34 -0400)]
CUDA: fix build and enable warnings (#494)

* cmake : fix CUDA build

-Werror=vla needs to be passed to the host compiler.

* cmake : enable warnings for ggml-cuda.cu

* ggml : fix some unused variable warnings

22 months agoMerge pull request #485 from rgerganov/add-mnist-cnn
Radoslav Gerganov [Mon, 28 Aug 2023 21:44:44 +0000 (00:44 +0300)]
Merge pull request #485 from rgerganov/add-mnist-cnn

Add MNIST example with CNN

22 months agoAdd MNIST inference example with CNN
Radoslav Gerganov [Sun, 27 Aug 2023 17:46:51 +0000 (20:46 +0300)]
Add MNIST inference example with CNN

Add one more implementation for MNIST which uses Conv2D layers, ref:
https://keras.io/examples/vision/mnist_convnet/. It achieves ~99%
accuracy on the MNIST test set and also performs better for user inputs.
This implementation expects a model in GGUF format. You can get one with
the 'mnist-cnn.py' script. Example usage:

$ ./mnist-cnn.py train mnist-cnn-model
...
Keras model saved to 'mnist-cnn-model'

$ ./mnist-cnn.py convert mnist-cnn-model
...
Model converted and saved to 'mnist-cnn-model.gguf'

$ ./mnist-cnn mnist-cnn-model.gguf models/mnist/t10k-images.idx3-ubyte

22 months agosam : use ggml-alloc (#490)
Yavor Ivanov [Mon, 28 Aug 2023 12:40:23 +0000 (15:40 +0300)]
sam : use ggml-alloc (#490)

22 months agocmake : enable some basic warnings globally (#482)
Cebtenzzre [Mon, 28 Aug 2023 11:44:18 +0000 (07:44 -0400)]
cmake : enable some basic warnings globally (#482)

* cmake : make -Werror=vla global

* cmake : make -Wuninitialized global (part of -Wall)

* tests : fix some -Wunused warnings

This flag is not enabled by default. There are still some warnings
remaining.

* cmake : make -Wsign-compare global (part of -Wall)

* cmake : make -Wall global (minus -Wunused)

* cmake : make -Wstrict-prototypes global

* cmake : add -Wpedantic -Wformat=2 globally

---------

Co-authored-by: Georgi Gerganov <redacted>
22 months agotests : undefine NDEBUG so the asserts always work (#481)
Cebtenzzre [Mon, 28 Aug 2023 11:36:58 +0000 (07:36 -0400)]
tests : undefine NDEBUG so the asserts always work (#481)

22 months agocmake : fix MSVC build (#479)
Cebtenzzre [Mon, 28 Aug 2023 11:36:16 +0000 (07:36 -0400)]
cmake : fix MSVC build (#479)

* examples : fix use of M_PI on MSVC

* cmake : make -Werror=vla global

* tests : fix CPU feature options on MSVC

* tests : fix __m256 casts on MSVC

22 months agoggml : sync llama.cpp (gguf + metal + ROCm + etc.) (#489)
Georgi Gerganov [Mon, 28 Aug 2023 11:31:13 +0000 (14:31 +0300)]
ggml : sync llama.cpp (gguf + metal + ROCm + etc.) (#489)

* ggml : sync llama.cpp (gguf + metal + ROCm + etc.)

ggml-ci

* cuda : sync rope updates

ggml-ci

22 months agocmake : add WebAssembly check (#487)
Ivan Stepanov [Mon, 28 Aug 2023 09:34:08 +0000 (12:34 +0300)]
cmake : add WebAssembly check (#487)

Ensured that CPU-specific flags are not set when targeting WebAssembly using Emscripten in the CMake script.

22 months agoggml : sync with sam.cpp (add SAM Vit H & L model support and fix SAM's output) ...
Yavor Ivanov [Mon, 28 Aug 2023 08:33:55 +0000 (11:33 +0300)]
ggml : sync with sam.cpp (add SAM Vit H & L model support and fix SAM's output)  (#476)

* Add support for Vit H and Vit L SAM model checkpoints

* Add "eps" argument to ggml_norm and fix all examples

* Fix bias addition for ConvTranspose2D layers in SAM example

* Fix build when GGML_ALLOCATOR_DEBUG is enabled

* Use op params for the stride in CONV_TRANSPOSE_2D

Needed in order for the operation to work with ggml-alloc as
the previous implementation used ggml_new_i32, which uses strach buffers

We should remove new_i32 and new_f32 I think. new_f32 is used in a lot
of places.

22 months agogpt-2 : use ggml-alloc (#486)
slaren [Mon, 28 Aug 2023 08:31:39 +0000 (10:31 +0200)]
gpt-2 : use ggml-alloc (#486)

* gpt-2 : use ggml-alloc

* move function comment to gpt2_eval

* gpt-2 : clarifying comment

---------

Co-authored-by: Georgi Gerganov <redacted>
22 months agoggml : fix instructions for using data pointer
Georgi Gerganov [Fri, 25 Aug 2023 13:56:09 +0000 (16:56 +0300)]
ggml : fix instructions for using data pointer

22 months agocmake : fix MSVC building with CUDA (#424)
Jeffrey Quesnelle [Tue, 22 Aug 2023 10:40:28 +0000 (03:40 -0700)]
cmake : fix MSVC building with CUDA (#424)

22 months agoggml : sync new operators from stable-diffusion.cpp (#461)
leejet [Tue, 22 Aug 2023 10:39:31 +0000 (18:39 +0800)]
ggml : sync new operators from stable-diffusion.cpp (#461)

* ggml : add ggml_group_norm

* ggml : add ggml_upscale

* ggml : add ggml_concat

* ggml : match code style

---------

Co-authored-by: Georgi Gerganov <redacted>
22 months agoMerge pull request #449 from ochafik/python-stubs
Olivier Chafik [Tue, 22 Aug 2023 10:29:00 +0000 (11:29 +0100)]
Merge pull request #449 from ochafik/python-stubs

Add python example w/ cffi-generated bindings

22 months agopython: regenerate bindings + cosmetic cleanups
Olivier Chafik [Tue, 22 Aug 2023 09:52:03 +0000 (10:52 +0100)]
python: regenerate bindings + cosmetic cleanups

22 months agostarcoder : fix starcoder/convert-hf-to-ggml.py to handle current-folder output file...
Brad Ito [Tue, 22 Aug 2023 09:34:07 +0000 (02:34 -0700)]
starcoder : fix starcoder/convert-hf-to-ggml.py to handle current-folder output file - as in README example (#458)

22 months agocuda : add alibi op (#457)
Jiahao Li [Tue, 22 Aug 2023 09:33:27 +0000 (17:33 +0800)]
cuda : add alibi op (#457)

22 months agoggml : rename xPos variables to unify coding style
Georgi Gerganov [Tue, 22 Aug 2023 09:02:00 +0000 (12:02 +0300)]
ggml : rename xPos variables to unify coding style

ggml-ci

22 months agoggml : implementation of xPos RoPE (#441); also extends ggml_rope_back with additiona...
Jan Ploski [Tue, 22 Aug 2023 08:45:20 +0000 (10:45 +0200)]
ggml : implementation of xPos RoPE (#441); also extends ggml_rope_back with additional parameters (breaking API change); does not include CUDA version (#442)

22 months agoggml : sync latest llama.cpp (GGUF) (#470)
Georgi Gerganov [Tue, 22 Aug 2023 08:39:04 +0000 (11:39 +0300)]
ggml : sync latest llama.cpp (GGUF) (#470)

* ggml : sync latest llama.cpp (GGUF)

ggml-ci

* ggml : sync GPU backends

ggml-ci

* ggml : sync ggml-alloc

ggml-ci

* ggml : remove obosolete constant arrays (type traits)

ggml-ci

22 months agoggml : improve ADD_REL_POS perf in SAM by doing it inplace + broadcast BLAS mul_mat...
Yavor Ivanov [Mon, 21 Aug 2023 12:31:27 +0000 (15:31 +0300)]
ggml : improve ADD_REL_POS perf in SAM by doing it inplace + broadcast BLAS mul_mat (#466)

* Improve ADD_REL_POS perf in SAM by doing it inplace

- Add unit tests for the ADD_REL_POS operation
- I am not sure if this is valid implementation as we reuse the src0
  memory in order to avoid copying it
- When running SAM with the "Example output" command, image, point and
  16 threads, this reduces the cumulative time of the ADD_REL_POS operation
  from 1000-1100 ms to 180-200ms
- There is further room for optimization in the access patterns used in
  the implementation of the opration

* Add non-inplace version for the GGML_OP_ADD_REL_POS

* Fix map_unary warnings and refactor LayerNorm2d + remove ggml_cont in it

* Fix Mac printf format warnings

* sam : add ggml_graph_print() comment

* ggml : add broadcast support for BLAS ggml_mul_mat() (#460)

* Remove not needed build_forward_expand from add-rel-pos unit test

---------

Co-authored-by: Georgi Gerganov <redacted>
22 months agoUpdate README to point to SAM example
YavorGIvanov [Fri, 18 Aug 2023 11:59:51 +0000 (14:59 +0300)]
Update README to point to SAM example

22 months agoexamples : add sample SAM inference (#74)
Georgi Gerganov [Fri, 18 Aug 2023 11:50:25 +0000 (14:50 +0300)]
examples : add sample SAM inference (#74)

* sam : image + prompt encoder, store embeddings

* sam : add the dense img pe in SAM state (#401)

* Add SAM decoder & output masks as png (#418)

* Add loading of decoder layers in Model

* Multiply by hypernet_layer_cnt for ctx_size on model load

* Add decoder layers to py conversion script

* Fix wrong and reversed tensor sizes for decoder

* Add decoder transformer implementation

* Add decoder hypernet and iou prediction mlps

* Add transpose convolution operation and unit test

* Finish mask decoder and write the decoder output in the model state

* Output masks to png after removing padding and upsampling to original size

- Also filter based on the iou treshold
- Additionally filtering based on the stability score and crop boxes
should be done

* Add stb image write in order to output masks from SAM

* Add transpose convolution 2d name and symbol to ggml ops static arrays

* Comment out debug print in transpose convolution test to fix compilation

ggml-ci

* Multithread GGML_OP_ADD_REL_POS operation

* ggml : fix GGML_OP_NAME array

* Disable and comment out debug prints in SAM example

* Add README for the SAM example

* Calculate & filter based on stability score and calculate bounding box

ggml-ci

---------

Co-authored-by: Yavor Ivanov <redacted>
22 months agozig : update `build.zig` file to make it work with Zig version 0.11.0 (#450)
Metal Whale [Wed, 16 Aug 2023 19:57:56 +0000 (04:57 +0900)]
zig : update `build.zig` file to make it work with Zig version 0.11.0 (#450)

22 months agoexamples : fix tensor name access (#443)
klosax [Wed, 16 Aug 2023 19:50:49 +0000 (21:50 +0200)]
examples : fix tensor name access (#443)

* fix-examples : wrong tensor name access

* fix-examples : wrong tensor name access

* fix-examples : wrong tensor name access

* fix-examples : wrong tensor name access

* fix-examples : wrong tensor name access

* fix-examples : wrong tensor name access

* fix-examples : wrong tensor name access

22 months agoggml : backport ggml-alloc from llama.cpp (#433)
Sam Spilsbury [Wed, 16 Aug 2023 19:44:18 +0000 (22:44 +0300)]
ggml : backport ggml-alloc from llama.cpp (#433)

* ggml: add graph tensor allocator (#2411)

Backport a113689571420fb4d6540f1a324d12965781356a from llama.cpp

* ggml-alloc: Don't try to re-use buffers of external tensors

They might be weights that came from another context, so we
have no control over them (and they might be re-used elsewhere
so writing to them would be a bad idea).

* ggml-alloc: Fix some compile errors when GGML_ALLOCATOR_DEBUG is on

---------

Co-authored-by: slaren <redacted>
22 months agoAdded some tests to python example + fixed numpy on scalar tensors
ochafik [Mon, 14 Aug 2023 01:17:29 +0000 (02:17 +0100)]
Added some tests to python example + fixed numpy on scalar tensors

22 months agoSimple python stub (*.pyi) generator for cffi
ochafik [Sun, 13 Aug 2023 18:05:57 +0000 (19:05 +0100)]
Simple python stub (*.pyi) generator for cffi

22 months agoAdd python example w/ cffi-generated bindings
ochafik [Sun, 13 Aug 2023 16:37:03 +0000 (17:37 +0100)]
Add python example w/ cffi-generated bindings

Add python example w/ cffi-generated bindings

Features:

- Seamless copies between tensors (ggml & numpy alike) with automatic (de/re)quantization
- Access to full C API (incl. CUDA, MPI, OpenCL, Metal, alloc... and any local API changes)
- Trivial regeneration with `python regenerate.py` (uses llama.cpp headers by default, README.md for options)

22 months agoreadme : add stable-diffusion example (#447)
leejet [Sun, 13 Aug 2023 18:50:48 +0000 (02:50 +0800)]
readme : add stable-diffusion example (#447)

22 months agoggml : mul mat tweaks (#439)
Georgi Gerganov [Mon, 7 Aug 2023 12:11:38 +0000 (15:11 +0300)]
ggml : mul mat tweaks (#439)

ggml-ci

22 months agoggml : pad result of ggml_nbytes()
Georgi Gerganov [Mon, 7 Aug 2023 10:58:02 +0000 (13:58 +0300)]
ggml : pad result of ggml_nbytes()

ggml-ci

22 months agoggml : sync llama.cpp (memory allocator + cuda + metal)
Georgi Gerganov [Mon, 7 Aug 2023 09:09:58 +0000 (12:09 +0300)]
ggml : sync llama.cpp (memory allocator + cuda  + metal)

ggml-ci

22 months agocmake : add avx compile options on Windows (synced from llama.cpp) (#435)
Jiahao Li [Sun, 6 Aug 2023 07:22:25 +0000 (15:22 +0800)]
cmake : add avx compile options on Windows (synced from llama.cpp) (#435)

23 months agocmake : fix msvc cuda build - no need to specify stdlib (#428)
Borislav Stanimirov [Thu, 3 Aug 2023 08:03:49 +0000 (11:03 +0300)]
cmake : fix msvc cuda build - no need to specify stdlib (#428)

23 months agotests : fixed windows build (#426)
Borislav Stanimirov [Thu, 3 Aug 2023 08:03:24 +0000 (11:03 +0300)]
tests : fixed windows build (#426)

23 months agoMerge pull request #422 from ggerganov/ggml-map-custom-new
slaren [Tue, 1 Aug 2023 10:15:46 +0000 (12:15 +0200)]
Merge pull request #422 from ggerganov/ggml-map-custom-new

ggml : add ggml_map_custom1-3

23 months agotest-customop.c : more comments
slaren [Mon, 31 Jul 2023 18:48:52 +0000 (20:48 +0200)]
test-customop.c : more comments

23 months agofix formatting
slaren [Mon, 31 Jul 2023 09:48:44 +0000 (11:48 +0200)]
fix formatting

23 months agoggml : add ggml_map_custom1-3
slaren [Sun, 30 Jul 2023 15:59:51 +0000 (17:59 +0200)]
ggml : add ggml_map_custom1-3

23 months agostarcoder : fix unused variable warnings (#416)
johnson442 [Wed, 26 Jul 2023 05:14:56 +0000 (06:14 +0100)]
starcoder : fix unused variable warnings (#416)

23 months agoggml : sync llama.cpp (#415)
Georgi Gerganov [Tue, 25 Jul 2023 15:28:22 +0000 (18:28 +0300)]
ggml : sync llama.cpp (#415)

- faster graph build
- inference speed-ups across GPU backends
- activation functions relax constraints

ggml-ci

23 months agoreadme : add chatglm example (#414)
klosax [Tue, 25 Jul 2023 15:20:14 +0000 (17:20 +0200)]
readme : add chatglm example (#414)

23 months agotests : remove unnecessary funcs
Georgi Gerganov [Mon, 24 Jul 2023 11:24:53 +0000 (14:24 +0300)]
tests : remove unnecessary funcs

23 months agostarcoder : fix windows build, fix cast warnings (#411)
Borislav Stanimirov [Mon, 24 Jul 2023 10:46:22 +0000 (13:46 +0300)]
starcoder : fix windows build, fix cast warnings (#411)

23 months agocmake : add metal kernel to target resources when built as shared library (#403)
Andrei [Sun, 23 Jul 2023 19:44:54 +0000 (15:44 -0400)]
cmake : add metal kernel to target resources when built as shared library (#403)

* Add GGML_METAL option to compile metal support.

* Add metal option

* Add metal sources

* Add current source directory

* Fix typo

23 months agoggml : refactor unary ops (#405)
Ivan Zdane [Sun, 23 Jul 2023 19:44:13 +0000 (15:44 -0400)]
ggml : refactor unary ops (#405)

* Add gitignore rule for temporary vim files

* ggml: refactor implementation of unary ops

* backends : adapt to ggml_unary_op

* ggml : fix assert number of ops

* ggml : hide ggml_set_unary_op from public API

---------

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