MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / initialize

Method initialize

examples/server/server.cpp:579–605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577 }
578
579 void initialize() {
580 id_gen = 0;
581
582 // create slots
583 all_slots_are_idle = true;
584
585 const int32_t n_ctx_slot = n_ctx / params.n_parallel;
586
587 LOG_TEE("Available slots:\n");
588 for (int i = 0; i < params.n_parallel; i++)
589 {
590 llama_client_slot slot;
591
592 slot.id = i;
593 slot.n_ctx = n_ctx_slot;
594 slot.reset();
595
596 LOG_TEE(" -> Slot %i - max context: %i\n", slot.id, n_ctx_slot);
597 slots.push_back(slot);
598 }
599
600 batch = llama_batch_init(n_ctx, 0, params.n_parallel);
601
602 // empty system prompt
603 system_prompt = "";
604 system_tokens.clear();
605 }
606
607 std::vector<llama_token> tokenize(const json & json_prompt, bool add_bos) const
608 {

Callers 2

InFunction · 0.80
mainFunction · 0.80

Calls 4

llama_batch_initFunction · 0.50
resetMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected