mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-09-25 12:40:41 +00:00
Compare commits
No commits in common. "50d640568388f876b0d63ee6ddb6bc86d997ec64" and "97d2990807fe6d558e395f8764198d7c7e7b411c" have entirely different histories.
50d6405683
...
97d2990807
@ -36,7 +36,6 @@ struct SDCliParams {
|
|||||||
SDMode mode = IMG_GEN;
|
SDMode mode = IMG_GEN;
|
||||||
std::string output_path = "output.png";
|
std::string output_path = "output.png";
|
||||||
int output_begin_idx = -1;
|
int output_begin_idx = -1;
|
||||||
int compression_quality = 90;
|
|
||||||
std::string image_path;
|
std::string image_path;
|
||||||
std::string metadata_format = "text";
|
std::string metadata_format = "text";
|
||||||
|
|
||||||
@ -100,10 +99,6 @@ struct SDCliParams {
|
|||||||
"--output-begin-idx",
|
"--output-begin-idx",
|
||||||
"starting index for output image sequence, must be non-negative (default 0 if specified %d in output path, 1 otherwise)",
|
"starting index for output image sequence, must be non-negative (default 0 if specified %d in output path, 1 otherwise)",
|
||||||
&output_begin_idx},
|
&output_begin_idx},
|
||||||
{"",
|
|
||||||
"--compression-quality",
|
|
||||||
"compression quality of video and JPEG / WebP images (90 by default)",
|
|
||||||
&compression_quality},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
options.bool_options = {
|
options.bool_options = {
|
||||||
@ -388,13 +383,11 @@ void step_callback(int step, int frame_count, sd_image_t* image, bool is_noisy,
|
|||||||
image->data,
|
image->data,
|
||||||
image->width,
|
image->width,
|
||||||
image->height,
|
image->height,
|
||||||
image->channel,
|
image->channel)) {
|
||||||
"",
|
|
||||||
cli_params->compression_quality)) {
|
|
||||||
LOG_ERROR("save preview image to '%s' failed", cli_params->preview_path.c_str());
|
LOG_ERROR("save preview image to '%s' failed", cli_params->preview_path.c_str());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (create_video_from_sd_images(cli_params->preview_path.c_str(), image, frame_count, cli_params->preview_fps, cli_params->compression_quality) != 0) {
|
if (create_video_from_sd_images(cli_params->preview_path.c_str(), image, frame_count, cli_params->preview_fps) != 0) {
|
||||||
LOG_ERROR("save preview video to '%s' failed", cli_params->preview_path.c_str());
|
LOG_ERROR("save preview video to '%s' failed", cli_params->preview_path.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -493,7 +486,7 @@ bool save_results(const SDCliParams& cli_params,
|
|||||||
std::string params = gen_params.embed_image_metadata
|
std::string params = gen_params.embed_image_metadata
|
||||||
? get_image_params(ctx_params, gen_params, metadata_seed, cli_params.mode)
|
? get_image_params(ctx_params, gen_params, metadata_seed, cli_params.mode)
|
||||||
: "";
|
: "";
|
||||||
const bool ok = write_image_to_file(path.string(), img.data, img.width, img.height, img.channel, params, cli_params.compression_quality);
|
const bool ok = write_image_to_file(path.string(), img.data, img.width, img.height, img.channel, params, 90);
|
||||||
LOG_INFO("save result image %d to '%s' (%s)", idx, path.string().c_str(), ok ? "success" : "failure");
|
LOG_INFO("save result image %d to '%s' (%s)", idx, path.string().c_str(), ok ? "success" : "failure");
|
||||||
return ok;
|
return ok;
|
||||||
};
|
};
|
||||||
@ -539,7 +532,7 @@ bool save_results(const SDCliParams& cli_params,
|
|||||||
std::string final_ext_lower = ext.string();
|
std::string final_ext_lower = ext.string();
|
||||||
std::transform(final_ext_lower.begin(), final_ext_lower.end(), final_ext_lower.begin(), ::tolower);
|
std::transform(final_ext_lower.begin(), final_ext_lower.end(), final_ext_lower.begin(), ::tolower);
|
||||||
const bool mux_audio = generated_audio != nullptr && (final_ext_lower == ".avi" || final_ext_lower == ".webm");
|
const bool mux_audio = generated_audio != nullptr && (final_ext_lower == ".avi" || final_ext_lower == ".webm");
|
||||||
if (create_video_from_sd_images(video_path.string().c_str(), results, num_results, gen_params.fps, cli_params.compression_quality, mux_audio ? generated_audio : nullptr) == 0) {
|
if (create_video_from_sd_images(video_path.string().c_str(), results, num_results, gen_params.fps, 90, mux_audio ? generated_audio : nullptr) == 0) {
|
||||||
LOG_INFO("save result video to '%s'", video_path.string().c_str());
|
LOG_INFO("save result video to '%s'", video_path.string().c_str());
|
||||||
if (generated_audio != nullptr && !mux_audio) {
|
if (generated_audio != nullptr && !mux_audio) {
|
||||||
fs::path wav_path = video_path;
|
fs::path wav_path = video_path;
|
||||||
|
|||||||
@ -835,9 +835,6 @@ std::vector<uint8_t> create_mjpg_avi_from_sd_images_to_vector(sd_image_t* images
|
|||||||
const uint32_t audio_byte_rate = has_audio ? static_cast<uint32_t>(audio->sample_rate * audio_block_align) : 0;
|
const uint32_t audio_byte_rate = has_audio ? static_cast<uint32_t>(audio->sample_rate * audio_block_align) : 0;
|
||||||
const uint32_t audio_data_size = has_audio ? static_cast<uint32_t>(audio_pcm.size()) : 0;
|
const uint32_t audio_data_size = has_audio ? static_cast<uint32_t>(audio_pcm.size()) : 0;
|
||||||
|
|
||||||
if (mjpg_quality != quality)
|
|
||||||
LOG_DEBUG("create_mjpg_avi...(): compression quality was limited from %i to %i", quality, mjpg_quality);
|
|
||||||
|
|
||||||
std::vector<uint8_t> avi_data;
|
std::vector<uint8_t> avi_data;
|
||||||
avi_data.reserve(static_cast<size_t>(num_images) * 1024);
|
avi_data.reserve(static_cast<size_t>(num_images) * 1024);
|
||||||
|
|
||||||
|
|||||||
@ -269,13 +269,9 @@ namespace LLM {
|
|||||||
if ((arch == LLMArch::QWEN3 || arch == LLMArch::QWEN3_VL) && config.num_layers == 28) {
|
if ((arch == LLMArch::QWEN3 || arch == LLMArch::QWEN3_VL) && config.num_layers == 28) {
|
||||||
config.num_heads = 16;
|
config.num_heads = 16;
|
||||||
}
|
}
|
||||||
if (arch == LLMArch::QWEN3_VL &&
|
if (arch == LLMArch::QWEN3_VL && config.num_layers == 50 && config.hidden_size == 5120) {
|
||||||
(config.num_layers == 50 || config.num_layers == 64) &&
|
config.num_heads = 64;
|
||||||
config.hidden_size == 5120) {
|
config.final_norm = false;
|
||||||
config.num_heads = 64;
|
|
||||||
if (config.num_layers == 50) {
|
|
||||||
config.final_norm = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (detected_vision_layers > 0) {
|
if (detected_vision_layers > 0) {
|
||||||
config.vision.num_layers = detected_vision_layers;
|
config.vision.num_layers = detected_vision_layers;
|
||||||
|
|||||||
@ -2670,9 +2670,7 @@ public:
|
|||||||
denoised = denoised * denoise_mask + init_latent * (1.0f - denoise_mask);
|
denoised = denoised * denoise_mask + init_latent * (1.0f - denoise_mask);
|
||||||
}
|
}
|
||||||
if (sd_should_preview_denoised() && preview.callback != nullptr) {
|
if (sd_should_preview_denoised() && preview.callback != nullptr) {
|
||||||
if (step % sd_get_preview_interval() == 0) {
|
preview_image(step, denoised, version, preview.mode, preview.callback, preview.data, false);
|
||||||
preview_image(step, denoised, version, preview.mode, preview.callback, preview.data, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
report_sample_progress(step, steps, &last_progress_us);
|
report_sample_progress(step, steps, &last_progress_us);
|
||||||
sd::guidance::GuiderOutput output;
|
sd::guidance::GuiderOutput output;
|
||||||
@ -2681,9 +2679,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sd_should_preview_noisy() && preview.callback != nullptr) {
|
if (sd_should_preview_noisy() && preview.callback != nullptr) {
|
||||||
if (step % sd_get_preview_interval() == 0) {
|
preview_image(step, noised_input, version, preview.mode, preview.callback, preview.data, true);
|
||||||
preview_image(step, noised_input, version, preview.mode, preview.callback, preview.data, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sd::Tensor<float> cond_out;
|
sd::Tensor<float> cond_out;
|
||||||
@ -2893,9 +2889,7 @@ public:
|
|||||||
denoised = denoised * denoise_mask + init_latent * (1.0f - denoise_mask);
|
denoised = denoised * denoise_mask + init_latent * (1.0f - denoise_mask);
|
||||||
}
|
}
|
||||||
if (sd_should_preview_denoised() && preview.callback != nullptr) {
|
if (sd_should_preview_denoised() && preview.callback != nullptr) {
|
||||||
if (step % sd_get_preview_interval() == 0) {
|
preview_image(step, denoised, version, preview.mode, preview.callback, preview.data, false);
|
||||||
preview_image(step, denoised, version, preview.mode, preview.callback, preview.data, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
report_sample_progress(step, steps, &last_progress_us);
|
report_sample_progress(step, steps, &last_progress_us);
|
||||||
output.pred = denoised;
|
output.pred = denoised;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user