Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: temporary disable warm up for deepseek-r1 #379

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/llama_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ bool AreAllElementsInt32(const Json::Value& arr) {
return true;
}

std::string ToLower(const std::string& s) {
std::string data = s;
std::transform(data.begin(), data.end(), data.begin(),
[](unsigned char c) { return std::tolower(c); });
return data;
}

struct InferenceState {
int task_id;
LlamaServerContext& llama;
Expand Down Expand Up @@ -726,7 +733,9 @@ bool LlamaEngine::LoadModelImpl(std::shared_ptr<Json::Value> json_body) {
// For model like nomic-embed-text-v1.5.f16.gguf, etc, we don't need to warm up model.
// So we use this variable to differentiate with other models
if (server_map_[model_id].ctx.model_type == ModelType::kLlm) {
WarmUpModel(model_id);
if (ToLower(model_id).find("deepseek-r1") == std::string::npos) {
WarmUpModel(model_id);
}
}
return true;
}
Expand Down Expand Up @@ -846,6 +855,11 @@ void LlamaEngine::HandleInferenceImpl(

if (auto content = get_message(message["content"]); !content.empty()) {
formatted_output += role + content;
if (input_role == "assistant" &&
(ToLower(completion.model_id).find("deepseek-r1") !=
std::string::npos)) {
formatted_output += "<|end▁of▁sentence|>";
}
}
}
formatted_output += si.ai_prompt;
Expand Down
Loading