Skip to content

Commit

Permalink
Remove dead code and fix f-string issue (#7720)
Browse files Browse the repository at this point in the history
* Remove dead code

* PylancereportGeneralTypeIssues: Strings nested within an f-string cannot use the same quote character as the f-string prior to Python 3.12.

* Remove dead code
  • Loading branch information
tolgacangoz authored May 8, 2024
1 parent 75aab34 commit c1c4269
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 11 deletions.
1 change: 0 additions & 1 deletion examples/community/checkpoint_merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ def merge(self, pretrained_model_name_or_path_list: List[Union[str, os.PathLike]
comparison_result &= self._compare_model_configs(config_dicts[idx - 1], config_dicts[idx])
if not force and comparison_result is False:
raise ValueError("Incompatible checkpoints. Please check model_index.json for the models.")
print(config_dicts[0], config_dicts[1])
print("Compatible model_index.json files found")
# Step 2: Basic Validation has succeeded. Let's download the models and save them into our local files.
cached_folders = []
Expand Down
8 changes: 0 additions & 8 deletions examples/community/latent_consistency_img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,6 @@ def prepare_latents(

return latents

if latents is None:
latents = torch.randn(shape, dtype=dtype).to(device)
else:
latents = latents.to(device)
# scale the initial noise by the standard deviation required by the scheduler
latents = latents * self.scheduler.init_noise_sigma
return latents

def get_w_embedding(self, w, embedding_dim=512, dtype=torch.float32):
"""
see https://github.com/google-research/vdm/blob/dc27b98a554f65cdc654b800da5aa1846545d41b/model_vdm.py#L298
Expand Down
2 changes: 1 addition & 1 deletion scripts/convert_zero123_to_diffusers.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def create_unet_diffusers_config(original_config, image_size: int, controlnet=Fa
assert "adm_in_channels" in unet_params
projection_class_embeddings_input_dim = unet_params["adm_in_channels"]
else:
raise NotImplementedError(f"Unknown conditional unet num_classes config: {unet_params["num_classes"]}")
raise NotImplementedError(f"Unknown conditional unet num_classes config: {unet_params['num_classes']}")

config = {
"sample_size": image_size // vae_scale_factor,
Expand Down
1 change: 0 additions & 1 deletion src/diffusers/image_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def __init__(
" if you intended to convert the image into RGB format, please set `do_convert_grayscale = False`.",
" if you intended to convert the image into grayscale format, please set `do_convert_rgb = False`",
)
self.config.do_convert_rgb = False

@staticmethod
def numpy_to_pil(images: np.ndarray) -> List[PIL.Image.Image]:
Expand Down

0 comments on commit c1c4269

Please sign in to comment.