MCPcopy Create free account
hub / github.com/antirez/ds4 / json_write_token

Function json_write_token

ds4_cli.c:597–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595 int generated = 0;
596 const bool speculative_argmax = cfg->gen.temperature <= 0.0f &&
597 ((ds4_engine_mtp_draft_tokens(engine) > 1 &&
598 getenv("DS4_MTP_SPEC_DISABLE") == NULL) ||
599 cli_splitkv_spec_requested());
600 const bool greedy_argmax = cfg->gen.temperature <= 0.0f &&
601 cli_greedy_argmax_requested(speculative_argmax);
602 bool have_greedy_next = false;
603 int greedy_next = -1;
604 const double t_decode0 = cli_now_sec();
605 while (generated < max_tokens && !cli_interrupt_requested()) {
606 int token;
607 if (greedy_argmax && have_greedy_next) {
608 token = greedy_next;
609 have_greedy_next = false;
610 } else {
611 token = ds4_session_sample(session, cfg->gen.temperature, 0,
612 cfg->gen.top_p, cfg->gen.min_p, &rng);
613 }

Callers 2

run_logits_dumpFunction · 0.85
run_logprob_dumpFunction · 0.85

Calls 2

ds4_token_textFunction · 0.85
json_write_stringFunction · 0.70

Tested by

no test coverage detected