]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
ggml/examples: add backend support for numerical optimization (ggml/949)
authorJohannes Gäßler <redacted>
Fri, 20 Sep 2024 16:04:44 +0000 (19:04 +0300)
committerGeorgi Gerganov <redacted>
Fri, 20 Sep 2024 18:15:05 +0000 (21:15 +0300)
commit424c5d00a9b97dd5559635872db9b57f87c23b02
tree6f3a1a31269e26c2ac6c650aeecd8d713357317d
parenta6809c6a2e8163cba296d4cc0c5cd4bbc8073638
ggml/examples: add backend support for numerical optimization (ggml/949)

* CUDA eval works

* stochastic gradient descent op

* Adam except decay

* CUDA CROSS_ENTROPY_LOSS_BACK

* CUDA mnist-fc training works

* backend CLI arg

* refactor gguf load

* remove sched from opt_step_adam

* implement l1 regularization (weight decay)

* extra call to add optimizer

* initialize gradients with ggml_graph_reset

* gradient accumulation

* increment iter per eval instead of epoch

* adjust backend interfaces

* fix ggml_graph_reset without backend

* fix ggml graph export/import

* fixup

* rename

* revert ggml_opt changes

* more general CUDA repeat_back

* update documentation, fix CNN

* validation split

* add clarifying comment

* optimize PyTorch training

* adjust buffer size, thread count

* fix 0.0f validation split

* Update examples/mnist/mnist-common.cpp

Co-authored-by: Georgi Gerganov <redacted>
* fix gradient accumulation

* tensor flag for accumulators -> tensor hash set

* Update include/ggml.h

Co-authored-by: slaren <redacted>
* Update tests/test-backend-ops.cpp

Co-authored-by: slaren <redacted>
* Update tests/test-backend-ops.cpp

Co-authored-by: slaren <redacted>
* fix test prints

* Update src/ggml-backend.c

Co-authored-by: Georgi Gerganov <redacted>
* better CUDA support for noncontiguous out_prod

* add comment

---------

Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: slaren <redacted>
24 files changed:
ggml/include/ggml-backend.h
ggml/include/ggml.h
ggml/src/ggml-backend-impl.h
ggml/src/ggml-backend.c
ggml/src/ggml-cann.cpp
ggml/src/ggml-cuda.cu
ggml/src/ggml-cuda/binbcast.cu
ggml/src/ggml-cuda/binbcast.cuh
ggml/src/ggml-cuda/cross-entropy-loss.cu
ggml/src/ggml-cuda/cross-entropy-loss.cuh
ggml/src/ggml-cuda/opt-step-adamw.cu [new file with mode: 0644]
ggml/src/ggml-cuda/opt-step-adamw.cuh [new file with mode: 0644]
ggml/src/ggml-cuda/out-prod.cu [new file with mode: 0644]
ggml/src/ggml-cuda/out-prod.cuh [new file with mode: 0644]
ggml/src/ggml-cuda/unary.cu
ggml/src/ggml-cuda/unary.cuh
ggml/src/ggml-kompute.cpp
ggml/src/ggml-metal.m
ggml/src/ggml-rpc.cpp
ggml/src/ggml-sycl.cpp
ggml/src/ggml-vulkan.cpp
ggml/src/ggml.c
tests/test-backend-ops.cpp
tests/test-grad0.cpp