Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@ def gemini_zero_dpp(model: torch.nn.Module, placememt_policy: str = "auto"):


def main(args):
colossalai.launch_from_torch(config={})

if args.seed is not None:
gpc.set_seed(args.seed)
if args.seed is None:
colossalai.launch_from_torch(config={})
else:
colossalai.launch_from_torch(config={}, seed=args.seed)

if args.with_prior_preservation:
class_images_dir = Path(args.class_data_dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,10 @@ def __getitem__(self, i):

if self.center_crop:
crop = min(img.shape[0], img.shape[1])
(h, w,) = (
(
h,
w,
) = (
img.shape[0],
img.shape[1],
)
Expand Down
5 changes: 4 additions & 1 deletion examples/textual_inversion/textual_inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@ def __getitem__(self, i):

if self.center_crop:
crop = min(img.shape[0], img.shape[1])
(h, w,) = (
(
h,
w,
) = (
img.shape[0],
img.shape[1],
)
Expand Down
5 changes: 4 additions & 1 deletion examples/textual_inversion/textual_inversion_flax.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@ def __getitem__(self, i):

if self.center_crop:
crop = min(img.shape[0], img.shape[1])
(h, w,) = (
(
h,
w,
) = (
img.shape[0],
img.shape[1],
)
Expand Down
6 changes: 4 additions & 2 deletions src/diffusers/models/attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ def set_use_memory_efficient_attention_xformers(self, use_memory_efficient_atten
if use_memory_efficient_attention_xformers:
if not is_xformers_available():
raise ModuleNotFoundError(
"Refer to https://github.com/facebookresearch/xformers for more information on how to install"
" xformers",
(
"Refer to https://github.com/facebookresearch/xformers for more information on how to install"
" xformers"
),
name="xformers",
)
elif not torch.cuda.is_available():
Expand Down
6 changes: 4 additions & 2 deletions src/diffusers/models/cross_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ def set_use_memory_efficient_attention_xformers(self, use_memory_efficient_atten
)
elif not is_xformers_available():
raise ModuleNotFoundError(
"Refer to https://github.com/facebookresearch/xformers for more information on how to install"
" xformers",
(
"Refer to https://github.com/facebookresearch/xformers for more information on how to install"
" xformers"
),
name="xformers",
)
elif not torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,11 @@ def step(
or isinstance(timestep, torch.LongTensor)
):
raise ValueError(
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
" `EulerDiscreteScheduler.step()` is not supported. Make sure to pass"
" one of the `scheduler.timesteps` as a timestep.",
(
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
" `EulerDiscreteScheduler.step()` is not supported. Make sure to pass"
" one of the `scheduler.timesteps` as a timestep."
),
)

if not self.is_scale_input_called:
Expand Down
8 changes: 5 additions & 3 deletions src/diffusers/schedulers/scheduling_euler_discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,11 @@ def step(
or isinstance(timestep, torch.LongTensor)
):
raise ValueError(
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
" `EulerDiscreteScheduler.step()` is not supported. Make sure to pass"
" one of the `scheduler.timesteps` as a timestep.",
(
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
" `EulerDiscreteScheduler.step()` is not supported. Make sure to pass"
" one of the `scheduler.timesteps` as a timestep."
),
)

if not self.is_scale_input_called:
Expand Down
6 changes: 4 additions & 2 deletions tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,10 @@ def test_scheduler_public_api(self):
)
self.assertTrue(
hasattr(scheduler, "scale_model_input"),
f"{scheduler_class} does not implement a required class method `scale_model_input(sample,"
" timestep)`",
(
f"{scheduler_class} does not implement a required class method `scale_model_input(sample,"
" timestep)`"
),
)
self.assertTrue(
hasattr(scheduler, "step"),
Expand Down