]> git.djapps.eu Git - pkg/ggml/sources/ggml/commit
ggml/examples: add backend support for numerical optimization (#949)
authorJohannes Gäßler <redacted>
Fri, 20 Sep 2024 12:36:38 +0000 (14:36 +0200)
committerGitHub <redacted>
Fri, 20 Sep 2024 12:36:38 +0000 (14:36 +0200)
commite7b23907cb2816e9951fe9b524d7127ab777297a
tree26566481b8f04c762af9261e7141bd9d05ee1c2c
parentea40f60c22ce4f5066fbb21e8c825d828e84c529
ggml/examples: add backend support for numerical optimization (#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>
33 files changed:
examples/mnist/README.md
examples/mnist/mnist-common.cpp
examples/mnist/mnist-common.h
examples/mnist/mnist-eval.cpp
examples/mnist/mnist-train-cnn.py
examples/mnist/mnist-train-fc.py
examples/mnist/mnist-train.cpp
include/ggml-backend.h
include/ggml.h
src/ggml-backend-impl.h
src/ggml-backend.c
src/ggml-cann.cpp
src/ggml-cuda.cu
src/ggml-cuda/binbcast.cu
src/ggml-cuda/binbcast.cuh
src/ggml-cuda/cross-entropy-loss.cu
src/ggml-cuda/cross-entropy-loss.cuh
src/ggml-cuda/opt-step-adamw.cu [new file with mode: 0644]
src/ggml-cuda/opt-step-adamw.cuh [new file with mode: 0644]
src/ggml-cuda/out-prod.cu [new file with mode: 0644]
src/ggml-cuda/out-prod.cuh [new file with mode: 0644]
src/ggml-cuda/unary.cu
src/ggml-cuda/unary.cuh
src/ggml-kompute.cpp
src/ggml-metal.m
src/ggml-rpc.cpp
src/ggml-sycl.cpp
src/ggml-vulkan.cpp
src/ggml.c
tests/test-backend-ops.cpp
tests/test-grad0.cpp
tests/test-mul-mat0.c
tests/test1.c