Skip to content

Commit

Permalink
server: add more slg params
Browse files Browse the repository at this point in the history
  • Loading branch information
stduhpf committed Nov 5, 2024
1 parent c6356c7 commit 72c8d96
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion examples/server/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,10 +780,30 @@ void parseJsonPrompt(std::string json_str, SDParams* params) {
}
try {
std::string slg_scale = payload["slg_scale"];
params->slg_scale = stof(slg_scale);
params->slg_scale = stof(slg_scale);
} catch (...) {
}
// TODO: more slg settings (layers, start and end)
try {
std::vector<int> skip_layers = payload["skip_layers"].get<std::vector<int>>();
params->skip_layers.clear();
for (int i = 0; i < skip_layers.size(); i++) {
params->skip_layers.push_back(skip_layers[i]);
}
} catch (...) {
}
try {
// skip_layer_start
float skip_layer_start = payload["skip_layer_start"].get<float>();
params->skip_layer_start = skip_layer_start;
} catch (...) {
}
try {
// skip_layer_end
float skip_layer_end = payload["skip_layer_end"].get<float>();
params->skip_layer_end = skip_layer_end;
} catch (...) {
}
}

// https://github.com/comfyanonymous/ComfyUI/blob/master/comfy/latent_formats.py#L152-L169
Expand Down

0 comments on commit 72c8d96

Please sign in to comment.