Skip to content

Commit

Permalink
fix: remove default variables in c headers (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
stduhpf authored Nov 24, 2024
1 parent c3eeb66 commit 53b415f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
10 changes: 8 additions & 2 deletions examples/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,8 @@ int main(int argc, const char* argv[]) {
params.style_ratio,
params.normalize_input,
params.input_id_images_path.c_str(),
params.skip_layers,
params.skip_layers.data(),
params.skip_layers.size(),
params.slg_scale,
params.skip_layer_start,
params.skip_layer_end);
Expand Down Expand Up @@ -991,7 +992,12 @@ int main(int argc, const char* argv[]) {
params.control_strength,
params.style_ratio,
params.normalize_input,
params.input_id_images_path.c_str());
params.input_id_images_path.c_str(),
params.skip_layers.data(),
params.skip_layers.size(),
params.slg_scale,
params.skip_layer_start,
params.skip_layer_end);
}
}

Expand Down
28 changes: 16 additions & 12 deletions stable-diffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ class StableDiffusionGGML {
int start_merge_step,
SDCondition id_cond,
std::vector<int> skip_layers = {},
float slg_scale = 2.5,
float slg_scale = 0,
float skip_layer_start = 0.01,
float skip_layer_end = 0.2) {
size_t steps = sigmas.size() - 1;
Expand Down Expand Up @@ -1162,7 +1162,7 @@ sd_image_t* generate_image(sd_ctx_t* sd_ctx,
bool normalize_input,
std::string input_id_images_path,
std::vector<int> skip_layers = {},
float slg_scale = 2.5,
float slg_scale = 0,
float skip_layer_start = 0.01,
float skip_layer_end = 0.2) {
if (seed < 0) {
Expand Down Expand Up @@ -1453,10 +1453,12 @@ sd_image_t* txt2img(sd_ctx_t* sd_ctx,
float style_ratio,
bool normalize_input,
const char* input_id_images_path_c_str,
std::vector<int> skip_layers,
float slg_scale,
float skip_layer_start,
float skip_layer_end) {
int* skip_layers = NULL,
size_t skip_layers_count = 0,
float slg_scale = 0,
float skip_layer_start = 0.01,
float skip_layer_end = 0.2) {
std::vector<int> skip_layers_vec(skip_layers, skip_layers + skip_layers_count);
LOG_DEBUG("txt2img %dx%d", width, height);
if (sd_ctx == NULL) {
return NULL;
Expand Down Expand Up @@ -1525,7 +1527,7 @@ sd_image_t* txt2img(sd_ctx_t* sd_ctx,
style_ratio,
normalize_input,
input_id_images_path_c_str,
skip_layers,
skip_layers_vec,
slg_scale,
skip_layer_start,
skip_layer_end);
Expand Down Expand Up @@ -1556,10 +1558,12 @@ sd_image_t* img2img(sd_ctx_t* sd_ctx,
float style_ratio,
bool normalize_input,
const char* input_id_images_path_c_str,
std::vector<int> skip_layers,
float slg_scale,
float skip_layer_start,
float skip_layer_end) {
int* skip_layers = NULL,
size_t skip_layers_count = 0,
float slg_scale = 0,
float skip_layer_start = 0.01,
float skip_layer_end = 0.2) {
std::vector<int> skip_layers_vec(skip_layers, skip_layers + skip_layers_count);
LOG_DEBUG("img2img %dx%d", width, height);
if (sd_ctx == NULL) {
return NULL;
Expand Down Expand Up @@ -1634,7 +1638,7 @@ sd_image_t* img2img(sd_ctx_t* sd_ctx,
style_ratio,
normalize_input,
input_id_images_path_c_str,
skip_layers,
skip_layers_vec,
slg_scale,
skip_layer_start,
skip_layer_end);
Expand Down
18 changes: 10 additions & 8 deletions stable-diffusion.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ SD_API sd_image_t* txt2img(sd_ctx_t* sd_ctx,
float style_strength,
bool normalize_input,
const char* input_id_images_path,
std::vector<int> skip_layers = {},
float slg_scale = 2.5,
float skip_layer_start = 0.01,
float skip_layer_end = 0.2);
int* skip_layers,
size_t skip_layers_count,
float slg_scale,
float skip_layer_start,
float skip_layer_end);

SD_API sd_image_t* img2img(sd_ctx_t* sd_ctx,
sd_image_t init_image,
Expand All @@ -190,10 +191,11 @@ SD_API sd_image_t* img2img(sd_ctx_t* sd_ctx,
float style_strength,
bool normalize_input,
const char* input_id_images_path,
std::vector<int> skip_layers = {},
float slg_scale = 2.5,
float skip_layer_start = 0.01,
float skip_layer_end = 0.2);
int* skip_layers,
size_t skip_layers_count,
float slg_scale,
float skip_layer_start,
float skip_layer_end);

SD_API sd_image_t* img2vid(sd_ctx_t* sd_ctx,
sd_image_t init_image,
Expand Down

0 comments on commit 53b415f

Please sign in to comment.