-
Notifications
You must be signed in to change notification settings - Fork 6.1k
misc fixes #2282
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
misc fixes #2282
Conversation
@@ -65,7 +68,7 @@ | |||
type=str, | |||
help=( | |||
"The prediction type that the model was trained on. Use 'epsilon' for Stable Diffusion v1.X and Stable" | |||
" Siffusion v2 Base. Use 'v-prediction' for Stable Diffusion v2." | |||
" Diffusion v2 Base. Use 'v_prediction' for Stable Diffusion v2." |
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.
elif self.config.prediction_type == "v_prediction": |
The scheduler takes 'v_prediction'
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!
|
||
from ...configuration_utils import ConfigMixin, register_to_config | ||
from ...schedulers.scheduling_utils import SchedulerMixin | ||
|
||
|
||
warnings.filterwarnings("ignore") |
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 warning filter will apply globally because this module ends up being imported at diffusers/__init__.py
The documentation is not available anymore as the PR was closed or merged. |
if prediction_type == "v-prediction": | ||
prediction_type = "v_prediction" |
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.
Just in case because of previous script docs
@@ -305,7 +305,6 @@ def step( | |||
prev_sample = alpha_prod_t_prev ** (0.5) * pred_original_sample + pred_sample_direction | |||
|
|||
if eta > 0: | |||
# randn_like does not support generator https://github.com/pytorch/pytorch/issues/27072 |
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.
left over comment before we switched to rand_tensor
if "DIFFUSERS_TEST_DEVICE" in os.environ: | ||
torch_device = os.environ["DIFFUSERS_TEST_DEVICE"] | ||
|
||
if is_torch_higher_equal_than_1_12: | ||
# Some builds of torch 1.12 don't have the mps backend registered. See #892 for more details | ||
mps_backend_registered = hasattr(torch.backends, "mps") | ||
torch_device = "mps" if (mps_backend_registered and torch.backends.mps.is_available()) else torch_device | ||
available_backends = ["cuda", "cpu", "mps"] | ||
if torch_device not in available_backends: | ||
raise ValueError( | ||
f"unknown torch backend for diffusers tests: {torch_device}. Available backends are:" | ||
f" {available_backends}" | ||
) | ||
logger.info(f"torch_device overrode to {torch_device}") |
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.
It can be helpful to force the tests to run on a particular device -- i.e. I use this snippet when I want to force the tests to run on the cpu when I'm using a macbook or a machine with cuda
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.
Looks good to me!
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.
LGTM, thanks!
@@ -65,7 +68,7 @@ | |||
type=str, | |||
help=( | |||
"The prediction type that the model was trained on. Use 'epsilon' for Stable Diffusion v1.X and Stable" | |||
" Siffusion v2 Base. Use 'v-prediction' for Stable Diffusion v2." | |||
" Diffusion v2 Base. Use 'v_prediction' for Stable Diffusion v2." |
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!
if "DIFFUSERS_TEST_DEVICE" in os.environ: | ||
torch_device = os.environ["DIFFUSERS_TEST_DEVICE"] | ||
|
||
if is_torch_higher_equal_than_1_12: | ||
# Some builds of torch 1.12 don't have the mps backend registered. See #892 for more details | ||
mps_backend_registered = hasattr(torch.backends, "mps") | ||
torch_device = "mps" if (mps_backend_registered and torch.backends.mps.is_available()) else torch_device | ||
available_backends = ["cuda", "cpu", "mps"] | ||
if torch_device not in available_backends: | ||
raise ValueError( | ||
f"unknown torch backend for diffusers tests: {torch_device}. Available backends are:" | ||
f" {available_backends}" | ||
) | ||
logger.info(f"torch_device overrode to {torch_device}") |
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.
Looks good to me!
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.
Thank you!
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.
Thanks!
Co-authored-by: Patrick von Platen <[email protected]>
Co-authored-by: Patrick von Platen <[email protected]>
Few misc fixes :)