Skip to content

Commit 28211a4

Browse files
SunMarcsayakpaul
andauthored
Apply suggestions from code review
Co-authored-by: Sayak Paul <[email protected]>
1 parent 52c7104 commit 28211a4

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/diffusers/loaders/single_file_model.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,7 @@ def from_single_file(cls, pretrained_model_link_or_path_or_dict: Optional[str] =
404404
model.eval()
405405

406406
if device_map is not None:
407-
device_map_kwargs = {
408-
"device_map": device_map,
409-
}
407+
device_map_kwargs = {"device_map": device_map}
410408
dispatch_model(model, **device_map_kwargs)
411409

412410
return model

src/diffusers/models/modeling_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,13 @@ def no_init_weights():
235235
def _skip_init(*args, **kwargs):
236236
pass
237237

238-
# # Save the original initialization functions
238+
# Save the original initialization functions
239239
for name, init_func in TORCH_INIT_FUNCTIONS.items():
240240
setattr(torch.nn.init, name, _skip_init)
241241
try:
242242
yield
243243
finally:
244-
# # Restore the original initialization functions
244+
# Restore the original initialization functions
245245
for name, init_func in TORCH_INIT_FUNCTIONS.items():
246246
setattr(torch.nn.init, name, init_func)
247247

0 commit comments

Comments
 (0)