Skip to content

Commit c64994d

Browse files
authored
fix: better progress display for second-order samplers (#834)
1 parent 5436f6b commit c64994d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

stable-diffusion.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,11 +1130,12 @@ class StableDiffusionGGML {
11301130
}
11311131
struct ggml_tensor* denoised = ggml_dup_tensor(work_ctx, x);
11321132

1133+
int64_t t0 = ggml_time_us();
1134+
11331135
auto denoise = [&](ggml_tensor* input, float sigma, int step) -> ggml_tensor* {
1134-
if (step == 1) {
1136+
if (step == 1 || step == -1) {
11351137
pretty_progress(0, (int)steps, 0);
11361138
}
1137-
int64_t t0 = ggml_time_us();
11381139

11391140
std::vector<float> scaling = denoiser->get_scalings(sigma);
11401141
GGML_ASSERT(scaling.size() == 3);
@@ -1288,8 +1289,9 @@ class StableDiffusionGGML {
12881289
}
12891290

12901291
int64_t t1 = ggml_time_us();
1291-
if (step > 0) {
1292-
pretty_progress(step, (int)steps, (t1 - t0) / 1000000.f);
1292+
if (step > 0 || step == -(int)steps) {
1293+
int showstep = std::abs(step);
1294+
pretty_progress(showstep, (int)steps, (t1 - t0) / 1000000.f / showstep);
12931295
// LOG_INFO("step %d sampling completed taking %.2fs", step, (t1 - t0) * 1.0f / 1000000);
12941296
}
12951297
if (denoise_mask != nullptr) {

0 commit comments

Comments
 (0)