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

Function dist_json_write_token

ds4_distributed.c:2848–2863  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2846}
2847
2848static void dist_json_write_token(FILE *fp, ds4_engine *engine, int token) {
2849 size_t n = 0;
2850 char *text = ds4_token_text(engine, token, &n);
2851 fprintf(fp, "{\"id\":%d,\"text\":", token);
2852 dist_json_write_string(fp, text ? text : "", text ? n : 0);
2853 fputs(",\"bytes\":[", fp);
2854 if (text) {
2855 for (size_t i = 0; i < n; i++) {
2856 if (i) fputc(',', fp);
2857 fprintf(fp, "%u", (unsigned)(unsigned char)text[i]);
2858 }
2859 }
2860 fputc(']', fp);
2861 fputc('}', fp);
2862 free(text);
2863}
2864
2865static int dist_write_logits_dump(
2866 ds4_dist_coordinator_state *state,

Callers 2

dist_write_logits_dumpFunction · 0.85
dist_write_logprobs_dumpFunction · 0.85

Calls 2

ds4_token_textFunction · 0.85
dist_json_write_stringFunction · 0.85

Tested by

no test coverage detected