diff --git a/examples/baby-llama/baby-llama.cpp b/examples/baby-llama/baby-llama.cpp index 0f260d094..7e940bbea 100644 --- a/examples/baby-llama/baby-llama.cpp +++ b/examples/baby-llama/baby-llama.cpp @@ -1,13 +1,8 @@ #include "ggml.h" #include -#include +#include #include -#include - -#undef MIN -#undef MAX -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#include float frand() { return (float)rand()/(float)RAND_MAX; @@ -1068,7 +1063,7 @@ void get_example_targets(int example_id, struct ggml_tensor * tokens_input, stru float z = (y+1.0f)*0.5f; // scale to [0..1] z += (frand()-0.5f)*(randomness/n_vocab); z = (z < 0.0f) ? 0.0f : (z > 1.0f) ? 1.0f : z; // clamp to [0..1] - int token = MAX(1,MIN(1+(int)(z*(float)(n_vocab-1)), n_vocab-1)); + int token = std::max(1,std::min(1+(int)(z*(float)(n_vocab-1)), n_vocab-1)); ggml_set_f32_1d(targets, (i-1)*n_vocab + token, +1.0f); if (i