Skip to content

Commit

Permalink
feat: client support prompt input with slo_ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzhuofu committed Sep 10, 2024
1 parent 132f68f commit c57b3ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions inference/incr_decoding/incr_decoding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,14 @@ void FlexFlow::top_level_task(Task const *task,
/*ignore_comments */ true);
std::vector<GenerationRequest> requests;
for (auto &prompt : prompt_json) {
std::string text = prompt.get<std::string>();
printf("Prompt[%d]: %s\n", total_num_requests, text.c_str());
std::string text = prompt["prompt"].get<std::string>();
double slo_ratio = prompt["slo_ratio"].get<double>();
printf("Prompt[%d] with slo %.3f: %s\n",
total_num_requests,
slo_ratio,
text.c_str());
total_num_requests++;
requests.push_back(GenerationRequest(text, 1.0));
requests.push_back(GenerationRequest(text, slo_ratio));
}
ConstantEmissionMachine emission_machine(1.0);
std::vector<GenerationResult> result =
Expand Down
10 changes: 7 additions & 3 deletions inference/spec_infer/spec_infer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,14 @@ void FlexFlow::top_level_task(Task const *task,

std::vector<GenerationRequest> requests;
for (auto &prompt : prompt_json) {
std::string text = prompt.get<std::string>();
printf("Prompt[%d]: %s\n", total_num_requests, text.c_str());
std::string text = prompt["prompt"].get<std::string>();
double slo_ratio = prompt["slo_ratio"].get<double>();
printf("Prompt[%d] with slo %.3f: %s\n",
total_num_requests,
slo_ratio,
text.c_str());
total_num_requests++;
requests.push_back(GenerationRequest(text, 1.0));
requests.push_back(GenerationRequest(text, slo_ratio));
}
ConstantEmissionMachine emission_machine(1.0);
tree_model.generate(requests, emission_machine);
Expand Down

0 comments on commit c57b3ee

Please sign in to comment.