MCPcopy Create free account
hub / github.com/Luce-Org/lucebox-hub / get_feature_range

Method get_feature_range

server/src/common/dflash_draft_ipc.cpp:289–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287 }
288 std::fprintf(cmd, "propose %d %d %s\n", committed, ctx_len, path.c_str());
289 std::fflush(cmd);
290 int32_t status = -1;
291 bool ok = read_exact_fd(stream_fd, &status, sizeof(status)) && status == 0;
292 if (ok) {
293 hidden_out.assign(noise_expected, 0.0f);
294 ok = read_exact_fd(stream_fd, hidden_out.data(),
295 hidden_out.size() * sizeof(float));
296 }
297 std::remove(path.c_str());
298 if (!ok) {
299 std::fprintf(stderr, "draft-ipc propose failed status=%d\n", status);
300 }
301 return ok;
302#endif
303}
304
305bool DFlashDraftIpcClient::get_feature_range(int start_pos, int n_tokens,
306 std::vector<float> & out) {
307#if defined(_WIN32)
308 (void)start_pos; (void)n_tokens; (void)out;
309 return false;
310#else
311 FILE * cmd = process_.command_stream();
312 const int stream_fd = process_.stream_fd();
313 if (!active_ || !cmd || stream_fd < 0 || ring_cap_ <= 0 ||
314 start_pos < 0 || n_tokens <= 0 || n_tokens > ring_cap_) return false;
315 const size_t count =
316 (size_t)n_tokens * (size_t)n_target_layers_ * (size_t)hidden_size_;
317 std::fprintf(cmd, "get_feature_range %d %d\n", start_pos, n_tokens);

Callers 1

Calls 5

read_exact_fdFunction · 0.85
command_streamMethod · 0.45
stream_fdMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected