AlUlkesh / sd_save_intermediate_images

Save intermediate images during the sampling process
The Unlicense
110 stars 17 forks source link

'=' alignment error #5

Closed vincnt0 closed 1 year ago

vincnt0 commented 1 year ago

Got this error:

in callback_state intermed_number = f"{intermed_number:0{digits}}" ValueError: '=' alignment not allowed in string format specifier

fixed it by removing the "0" in the format string in lines 149 and 153 :)

AlUlkesh commented 1 year ago

Thanks. Though I don't see yet, what the problem might be, the 0 should pad the number with leading zeroes.

Can you show me the final filename and one of the intermediates?

vincnt0 commented 1 year ago

Sure, here's some sample filenames: intermediates in folder "00536": "00536-005-2861772760-road in a peppermint forest, fantasy, digital art.png", "00536-010-2861772760-road in a peppermint forest, fantasy, digital art.png", etc. (counts correctly in steps of 5)

final image: "00536-2861772760-road in a peppermint forest, fantasy, digital art.png"

I'm also not exactly sure what is going on (why it works for you and not for me and why it apparently still pads with 0s even though i removed the 0), but according to this stackoverflow post, this "= alignment" implies that the function should expect numerical input instead of a string input:

So by specifying 0N as the “zero-padding to N width”, you have implied both “the input is a numeric type”, and “the zeros should go between the sign and the digits”. That latter implication is what is meant by '=' alignment.
Since the value "1" is not numeric, the “=”-alignment handling code raises that exception. The message is written expecting you know what it's talking about because you requested (by implication) the “=” alignment.

AlUlkesh commented 1 year ago

I just ran it through the debugger, but even when I put letters in the variable, I don't get any error.

Which version of python are you running?

haraldini commented 1 year ago

Getting the same issue. Python 3.9.12

AlUlkesh commented 1 year ago

Thanks, it was the python version. Apparently they have improved on that in 3.10.

I now coded it slightly different, which works on both versions.