Spaces:
Running
Running
ggml : make more compatible with c99 (#262)
Browse files
ggml.c
CHANGED
|
@@ -14,9 +14,10 @@
|
|
| 14 |
#include <stdint.h>
|
| 15 |
#include <stdio.h>
|
| 16 |
|
| 17 |
-
// if C99 - static_assert is
|
|
|
|
| 18 |
#ifndef static_assert
|
| 19 |
-
#define static_assert(cond, msg)
|
| 20 |
#endif
|
| 21 |
|
| 22 |
#if defined _MSC_VER || defined(__MINGW32__)
|
|
|
|
| 14 |
#include <stdint.h>
|
| 15 |
#include <stdio.h>
|
| 16 |
|
| 17 |
+
// if C99 - static_assert is noop
|
| 18 |
+
// ref: https://stackoverflow.com/a/53923785/4039976
|
| 19 |
#ifndef static_assert
|
| 20 |
+
#define static_assert(cond, msg) struct global_scope_noop_trick
|
| 21 |
#endif
|
| 22 |
|
| 23 |
#if defined _MSC_VER || defined(__MINGW32__)
|
ggml.h
CHANGED
|
@@ -681,34 +681,32 @@ struct ggml_opt_params {
|
|
| 681 |
bool print_forward_graph;
|
| 682 |
bool print_backward_graph;
|
| 683 |
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
| 690 |
-
|
| 691 |
-
|
| 692 |
-
|
| 693 |
-
|
| 694 |
-
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
|
| 702 |
-
|
| 703 |
-
|
| 704 |
-
|
| 705 |
-
|
| 706 |
-
|
| 707 |
-
|
| 708 |
-
|
| 709 |
-
|
| 710 |
-
} lbfgs;
|
| 711 |
-
};
|
| 712 |
};
|
| 713 |
|
| 714 |
struct ggml_opt_params ggml_opt_default_params(enum ggml_opt_type type);
|
|
|
|
| 681 |
bool print_forward_graph;
|
| 682 |
bool print_backward_graph;
|
| 683 |
|
| 684 |
+
// ADAM parameters
|
| 685 |
+
struct {
|
| 686 |
+
int n_iter;
|
| 687 |
+
|
| 688 |
+
float alpha; // learning rate
|
| 689 |
+
float beta1;
|
| 690 |
+
float beta2;
|
| 691 |
+
float eps; // epsilon for numerical stability
|
| 692 |
+
float eps_f; // epsilon for convergence test
|
| 693 |
+
float eps_g; // epsilon for convergence test
|
| 694 |
+
} adam;
|
| 695 |
+
|
| 696 |
+
// LBFGS parameters
|
| 697 |
+
struct {
|
| 698 |
+
int m; // number of corrections to approximate the inv. Hessian
|
| 699 |
+
int n_iter;
|
| 700 |
+
int max_linesearch;
|
| 701 |
+
|
| 702 |
+
float eps; // convergence tolerance
|
| 703 |
+
float ftol; // line search tolerance
|
| 704 |
+
float wolfe;
|
| 705 |
+
float min_step;
|
| 706 |
+
float max_step;
|
| 707 |
+
|
| 708 |
+
enum ggml_linesearch linesearch;
|
| 709 |
+
} lbfgs;
|
|
|
|
|
|
|
| 710 |
};
|
| 711 |
|
| 712 |
struct ggml_opt_params ggml_opt_default_params(enum ggml_opt_type type);
|