| 18 | }; |
| 19 | |
| 20 | struct train_state * init_train_state() { |
| 21 | struct train_state * state = new struct train_state; |
| 22 | state->train_its = 0; |
| 23 | state->train_samples = 0; |
| 24 | state->train_tokens = 0; |
| 25 | state->train_epochs = 0; |
| 26 | state->shuffle_samples_hash = 0; |
| 27 | state->shuffle_sample_count = 0; |
| 28 | state->shuffle_next_sample = 0; |
| 29 | state->shuffle_rng_state_current = ""; |
| 30 | state->shuffle_rng_state_next = ""; |
| 31 | |
| 32 | state->opt = new struct ggml_opt_context; |
| 33 | state->opt->ctx = NULL; |
| 34 | state->opt->params = ggml_opt_default_params(GGML_OPT_ADAM); |
| 35 | state->opt->params.graph_size = LLAMA_TRAIN_MAX_NODES; |
| 36 | state->opt->loss_after = 0.0f; |
| 37 | |
| 38 | return state; |
| 39 | } |
| 40 | |
| 41 | void free_train_state(struct train_state * state) { |
| 42 | delete state->opt; |
no test coverage detected