Skip to content

Commit 7c8768f

Browse files
committed
add missing include for strcmp, etc
1 parent 660836f commit 7c8768f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

examples/baby-llama/baby-llama.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <vector>
33
#include <assert.h>
44
#include <random>
5+
#include <string.h>
56

67
#undef MIN
78
#undef MAX
@@ -1177,7 +1178,7 @@ int main(int argc, char ** argv) {
11771178
size_t compute_size = 1024ll*1024ll*1024ll;
11781179
uint8_t * compute_addr = new uint8_t[compute_size];
11791180

1180-
int n_examples = 25600;
1181+
int n_examples = 256;
11811182
int n_tokens = model.hparams.n_ctx;
11821183
int n_vocab = model.hparams.n_vocab;
11831184

@@ -1284,7 +1285,7 @@ int main(int argc, char ** argv) {
12841285
}
12851286

12861287
{
1287-
int n_gen = 128;
1288+
int n_gen = 1200000000;
12881289
int sample_ctx = n_tokens-n_tokens/8;
12891290

12901291
printf("Generating %d tokens.\n", n_gen);
@@ -1301,6 +1302,7 @@ int main(int argc, char ** argv) {
13011302
print_token(ggml_get_i32_1d(tokens_input, i), n_vocab);
13021303
}
13031304
printf("---\n");
1305+
int important_sum = 0;
13041306
for (int i=0; i<n_gen; ++i) {
13051307
struct ggml_init_params params = {
13061308
/*.mem_size =*/ compute_size,
@@ -1338,10 +1340,18 @@ int main(int argc, char ** argv) {
13381340
// print_token(ggml_get_i32_1d(tokens_input, i), model.hparams.n_vocab);
13391341
// }
13401342
// printf("--\n");
1343+
for (int k=0; k<1000000; ++k) {
1344+
for (int j=0; j<30; ++j) {
1345+
important_sum += (k+j) / MAX(1,i);
1346+
}
1347+
}
13411348

13421349
ggml_free(ctx0);
13431350
}
1351+
printf("important (dont optimize it away, compiler!) : %d\n", important_sum);
13441352
}
1353+
1354+
print_matrix(model.tok_embeddings);
13451355

13461356
printf("done\n");
13471357
// ggml_free(kv_self.ctx);

0 commit comments

Comments
 (0)