Skip to content

Uint32 Seed #62

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

Merged
merged 13 commits into from Jul 26, 2023
Merged

Uint32 Seed #62

merged 13 commits into from Jul 26, 2023

Conversation

ghost
Copy link

@ghost ghost commented Jul 4, 2023

Justification: The seed internally is changed between different number types with wildly different max values. This PR normalizes all of them to UInt32.

Earlier @pcuenca commented that the reason for the lower precision use of Double was to support the CompactSlider component and make it easier for a user to select a number.

In this submission the CompactSlider component has been swapped for a TextField.

[Feature extracted from larger PR #59 https://github.com//pull/59]

dolmere added 2 commits July 4, 2023 13:09
Justification: The seed internally is changed between different number types with wildly different max values. This PR normalizes all of them to UInt32.

Earlier @pcuenca commented that the reason for the lower precision use of Double was to support the CompactSlider component and make it easier for a user to select a number.

In this submission the CompactSlider component has been swapped for a TextField.

[Feature extracted from larger PR #59 #59]
@pcuenca
Copy link
Member

pcuenca commented Jul 12, 2023

There's a minor glitch in the UI: the left side of the seed box is slightly clipped. Probably trying to align it with the other controls (see Steps above) will fix it.

Screenshot 2023-07-12 at 20 29 00

@ghost
Copy link
Author

ghost commented Jul 12, 2023

A random seed is now achieved with a value of 0. If the value is zero then the TextField will clear to empty and the disclosure group title will be "Random Seed" If the value is 1 or more then the disclosure group title will change to "Seed." A tiny stepper has also been included to the right of the TextField indicating that the TextField accepts numeric values and allowing a quick tap or long press to increment/decrement the value.

Screenshot 2023-07-12 at 19 31 37

Align the leading edge of the new TextField for seed value with the other controls.
@ghost
Copy link
Author

ghost commented Jul 12, 2023

Minor UI glitch fixed with commit 0efb7ba

dolmere added 2 commits July 16, 2023 20:47
Added a docc compatible comment for PipelineState enum.
 Internal functions that do no need external access marked as fileprivate.
Copy link
Member

@pcuenca pcuenca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience! I think this is almost ready to go, I have some minor suggestions, and I think some casts are not necessary.

@pcuenca
Copy link
Member

pcuenca commented Jul 25, 2023

Long numbers are usually truncated. Can we artificially limit the upper range, or do you think it's important to allow any 32-bit value?

Screenshot 2023-07-25 at 19 02 04

(Also, maybe display seeds without delimiters)

dolmere and others added 6 commits July 25, 2023 18:30
remove leftover debug comment line

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
personal preference in how to casr/declare type. (style guide needed)

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
remove cast

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
remove seed greater than zero check

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
remove unnecessary cast

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
remove unnecessary cast

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
@ghost
Copy link
Author

ghost commented Jul 25, 2023

"Long numbers are usually truncated. Can we artificially limit the upper range, or do you think it's important to allow any 32-bit value?"
Yes I saw this issue but wanted to avoid too many changes in a single PR. It's related though.
In the latest commit you'll find a new util.swift func to convert a UInt32 to a truncated to 3 places String representation. Running it I find it doesn't really need any form of tap to reveal the full number since you can tap the "Set" button and see the full number in the TextField anyway.

- seedBinding in ControlsView doesn't return an empty string but rather just the generation.seed value which won't be a nil value.
- In StatusView when displaying the seed value it will be truncated to 3 places (1.134B, etc)
- Comment describing the contents of GenerationState.complete(,,,) removed.
- Addition of Double.reduceScale and general func formatLargeNumber(UInt32) -> String added to Utils
@ghost
Copy link
Author

ghost commented Jul 25, 2023

Screenshot 2023-07-25 at 19 19 52

@citruslab
Copy link

citruslab commented Jul 25, 2023 via email

@pcuenca caught an error in logic where the random seed trigger was being tested as "seed > 1" which would result in a seed of 0 or 1 generating a random seed. Changing to "seed > 0" (or seed >= 1) is the correct logic for 0 as random seed.
@pcuenca pcuenca merged commit 839c9ba into huggingface:main Jul 26, 2023
@pcuenca
Copy link
Member

pcuenca commented Jul 26, 2023

Thanks again @dolmere! 🙌

@ZachNagengast
Copy link
Contributor

Just noticed this feature, awesome work @dolmere!

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

Successfully merging this pull request may close these issues.

3 participants