-
Notifications
You must be signed in to change notification settings - Fork 6.5k
[Better scheduler docs] Improve usage examples of schedulers #890
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
Changes from all commits
32b2340
1a514b7
9b6e1dd
21f4bb6
3af5b75
38296c6
c02d166
905adc1
5738cda
b77c8de
efb4847
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,7 +72,7 @@ image.save("astronaut_rides_horse.png") | |
| # make sure you're logged in with `huggingface-cli login` | ||
| from diffusers import StableDiffusionPipeline, DDIMScheduler | ||
|
|
||
| scheduler = DDIMScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear", clip_sample=False, set_alpha_to_one=False) | ||
| scheduler = DDIMScheduler.from_config("CompVis/stable-diffusion-v1-4", subfolder="scheduler") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. scheduler_config does not specify values for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point! Wonder if we could somehow do this automatically - maybe just add those values there?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually opening a bigger issue for this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great catch! Yeah I noticed it's acutally not that easy - we'll need some more code changes here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be correct now by simply setting |
||
|
|
||
| pipe = StableDiffusionPipeline.from_pretrained( | ||
| "runwayml/stable-diffusion-v1-5", | ||
|
|
@@ -91,11 +91,7 @@ image.save("astronaut_rides_horse.png") | |
| # make sure you're logged in with `huggingface-cli login` | ||
| from diffusers import StableDiffusionPipeline, LMSDiscreteScheduler | ||
|
|
||
| lms = LMSDiscreteScheduler( | ||
| beta_start=0.00085, | ||
| beta_end=0.012, | ||
| beta_schedule="scaled_linear" | ||
| ) | ||
| lms = LMSDiscreteScheduler.from_config("CompVis/stable-diffusion-v1-4", subfolder="scheduler") | ||
|
|
||
| pipe = StableDiffusionPipeline.from_pretrained( | ||
| "runwayml/stable-diffusion-v1-5", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,6 +80,19 @@ def __init__( | |
| new_config["steps_offset"] = 1 | ||
| scheduler._internal_dict = FrozenDict(new_config) | ||
|
|
||
| if hasattr(scheduler.config, "clip_sample") and scheduler.config.clip_sample is True: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As soon as the 0.7.0 is out, we will add |
||
| deprecation_message = ( | ||
| f"The configuration file of this scheduler: {scheduler} has not set the configuration `clip_sample`." | ||
| " `clip_sample` should be set to False in the configuration file. Please make sure to update the" | ||
| " config accordingly as not setting `clip_sample` in the config might lead to incorrect results in" | ||
| " future versions. If you have downloaded this checkpoint from the Hugging Face Hub, it would be very" | ||
| " nice if you could open a Pull request for the `scheduler/scheduler_config.json` file" | ||
| ) | ||
| deprecate("clip_sample not set", "1.0.0", deprecation_message, standard_warn=False) | ||
| new_config = dict(scheduler.config) | ||
| new_config["clip_sample"] = False | ||
| scheduler._internal_dict = FrozenDict(new_config) | ||
|
|
||
| if safety_checker is None: | ||
| logger.warn( | ||
| f"You have disabled the safety checker for {self.__class__} by passing `safety_checker=None`. Ensure" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is both a config value and conflicts with
--pretrained_model_name_or_path, this was previously compatible with local and remote sd1.4 and sd1.5 in dreambooth, text_to_image, and textual inversion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @kjerk , would you like to open a PR to fix this ?