| 425 | } |
| 426 | |
| 427 | bool has_budget(gpt_params &global_params) { |
| 428 | n_remaining = -1; |
| 429 | if(params.n_predict != -1) |
| 430 | { |
| 431 | n_remaining = params.n_predict - n_decoded; |
| 432 | } |
| 433 | else if (global_params.n_predict != -1) |
| 434 | { |
| 435 | n_remaining = global_params.n_predict - n_decoded; |
| 436 | } |
| 437 | return n_remaining > 0 || n_remaining == -1; // no budget || limitless |
| 438 | } |
| 439 | |
| 440 | bool available() const { |
| 441 | return state == IDLE && command == NONE; |