| 423 | } |
| 424 | |
| 425 | float learning_schedule( |
| 426 | int64_t step, |
| 427 | int64_t warmup_steps, |
| 428 | int64_t cos_decay_steps, |
| 429 | float learning_rate, |
| 430 | float overall_minimum, |
| 431 | float cos_decay_minimum, |
| 432 | float cos_decay_restart_step_mult, |
| 433 | bool enable_restart) { |
| 434 | |
| 435 | float result = |
| 436 | (step < warmup_steps) |
| 437 | ? (float) step / (float) warmup_steps |
| 438 | : enable_restart |
| 439 | ? cosine_decay_restart( |
| 440 | step - warmup_steps, |
| 441 | cos_decay_steps, |
| 442 | cos_decay_minimum, |
| 443 | cos_decay_restart_step_mult) |
| 444 | : cosine_decay( |
| 445 | step, |
| 446 | cos_decay_steps, |
| 447 | cos_decay_minimum); |
| 448 | |
| 449 | float min = overall_minimum / learning_rate; |
| 450 | result = min + result * (1.0f - min); |
| 451 | return result; |
| 452 | } |
| 453 | |
| 454 | static bool are_same_layout(struct ggml_tensor * a, struct ggml_tensor * b) { |
| 455 | GGML_ASSERT(a != NULL); |
no test coverage detected