Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with random seed values #44

Closed
MoonRide303 opened this issue Aug 13, 2023 · 6 comments
Closed

Issues with random seed values #44

MoonRide303 opened this issue Aug 13, 2023 · 6 comments

Comments

@MoonRide303
Copy link
Collaborator

  1. Large random seed values are not workings - seems to be artificially capped at 65535 (in async_worker.py - it changes seed to random value from this tiny entropy range, when this threshold is exceeded). We should be able to generate like billions (int range) of different images for the same prompts if we wanted to, not just few thousands. People also might also have their favorite numbers they like to use as random seed, that are much bigger than mere 2**16. Both A1111 and ComfyUI allow much bigger values than 65535.
  2. With current implementation we don't have information about what seed was used to generate the image, when it was random value - it would be nice to have it displayed somewhere in the UI (per image, or at least for first image from the batch).
@MoonRide303
Copy link
Collaborator Author

MoonRide303 commented Aug 18, 2023

@lllyasviel I noticed you did initial version of fix in 1.0.35, but it could be improved a bit - instead of:

                def refresh_seed(r, s):
                    if r:
                        return random.randint(1, 1024*1024*1024)
                    else:
                        return s

in webui.py I'd go with

                def refresh_seed(r, s):
                    if r or not isinstance(s, int) or s < 0 or s > 2**63 - 1:
                        return random.randint(0, 2**63 - 1)
                    else:
                        return s

to refresh seed in case user entered value out of allowed range.

You could also bump max_seed in async_worker.py from 1024*1024*1024 to 2**63 - 1. People use 64-bit machines these days, and you already use similar values in core.py - I made all of them consistent, and staying in 0 to 2**63-1 range on my fork.

@lllyasviel
Copy link
Owner

negative or large seed will still work as they willl be preprocessed inner worker

@MoonRide303
Copy link
Collaborator Author

@lllyasviel They will work, but in your version they will be silently re-generated, and not displayed to the user in the UI.

@lllyasviel
Copy link
Owner

this impl cannot get same results from same negative number as seed

@MoonRide303
Copy link
Collaborator Author

MoonRide303 commented Aug 18, 2023

It just generates new seed (from valid range) when out-of-range number is entered.

@MoonRide303
Copy link
Collaborator Author

Works fine in v2.1.739 (seeds from 0 to 2 ** 63 - 1 are now supported).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants