Update pipeline#56
Conversation
…ssues and temporary workarounds.
There was a problem hiding this comment.
Pull request overview
This pull request's title and description indicate it's a documentation update about Civitai API issues, but it actually contains substantial code changes to the pipeline system. The PR includes both README documentation updates about Civitai API bugs and extensive modifications to pipeline_easy.py including import reorganization, addition of ~50 new pipeline types, a new security feature for file format filtering, and multiple changes to pipeline mappings.
Changes:
- Added documentation in README.md about known Civitai API issues and workarounds
- Reorganized imports in pipeline_easy.py with better categorization and try-except blocks for optional pipelines
- Added support for numerous new pipeline types (Flux variants, Qwen, Kandinsky, Lumina, Sana, Wan, ZImage, etc.)
- Introduced
allow_unsafe_formatssecurity parameter to control whether .ckpt and .bin files are allowed (defaults to safetensors-only) - Updated pipeline mappings for text2image, image2image, and inpainting tasks with new model type support
- Added new video pipeline mappings (text2video, image2video, video2video)
- Fixed error message from "for_hf" to "from_huggingface"
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 12 comments.
| File | Description |
|---|---|
| README.md | Added documentation section about Civitai API specification changes causing search accuracy issues and missing results |
| src/auto_diffusers/pipeline_easy.py | Major refactoring: reorganized imports, added ~50 new pipeline types with optional import handling, introduced security filtering for file formats, updated pipeline mappings for various tasks, added video pipeline support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - Some search results not being returned | ||
| A temporary workaround has been implemented for the above issues, but since certain search results are still not returned, there is a possibility that some models may not be found. | ||
|
|
||
| link: [civitai/civitai#1757](https://github.com/civitai/civitai/issues/1757) |
There was a problem hiding this comment.
The colon after "link" is a full-width character (:) instead of a regular colon (:). This should use the standard ASCII colon for consistency.
| link: [civitai/civitai#1757](https://github.com/civitai/civitai/issues/1757) | |
| link: [civitai/civitai#1757](https://github.com/civitai/civitai/issues/1757) |
| def get_allowed_extensions(allow_unsafe_formats: bool = False) -> List[str]: | ||
| r""" | ||
| Get the list of allowed file extensions based on safety preferences. | ||
|
|
||
| Parameters: | ||
| allow_unsafe_formats (`bool`, *optional*, defaults to `False`): | ||
| If True, allows potentially unsafe formats (.ckpt, .bin) in addition to .safetensors. | ||
| If False (default), only allows .safetensors format for maximum security. | ||
|
|
||
| Returns: | ||
| `List[str]`: List of allowed file extensions. | ||
| """ | ||
| if allow_unsafe_formats: | ||
| return [".safetensors", ".ckpt", ".bin"] | ||
| else: | ||
| return [".safetensors"] |
There was a problem hiding this comment.
Missing documentation for the new allow_unsafe_formats parameter in the module-level docstring or user guide. This is a security-relevant parameter that changes the default behavior, and users should be clearly informed about:
- What makes
.ckptand.binformats "unsafe" (pickle deserialization risks) - The security implications of enabling this option
- When it might be necessary to use this option
- Best practices for using this parameter safely
| ("animatediff_v1", AnimateDiffPipeline), | ||
| ("animatediff_v2", AnimateDiffPipeline), | ||
| ("animatediff_v3", AnimateDiffPipeline), | ||
| ("auraflow", AuraFlowPipeline), | ||
| ("autoencoder-dc-f128c512", None), | ||
| ("autoencoder-dc-f32c32", None), | ||
| ("autoencoder-dc-f32c32-sana", None), | ||
| ("autoencoder-dc-f64c128", None), | ||
| ("chroma", ChromaPipeline), | ||
| ("cogview3", CogView3PlusPipeline), | ||
| ("cogview4", CogView4Pipeline), | ||
| ("cogview4-control", CogView4ControlPipeline), | ||
| ("controlnet", StableDiffusionControlNetPipeline), | ||
| ("controlnet_xl", StableDiffusionXLControlNetPipeline), | ||
| ("controlnet_xl_large", StableDiffusionXLControlNetPipeline), | ||
| ("controlnet_xl_mid", StableDiffusionXLControlNetPipeline), | ||
| ("controlnet_xl_small", StableDiffusionXLControlNetPipeline), | ||
| ("controlnet_xl_union", StableDiffusionXLControlNetUnionPipeline), | ||
| ("cosmos-1.0-t2w-7B", None), | ||
| ("cosmos-1.0-t2w-14B", None), | ||
| ("cosmos-1.0-v2w-7B", None), | ||
| ("cosmos-1.0-v2w-14B", None), | ||
| ("cosmos-2.0-t2i-2B", None), | ||
| ("cosmos-2.0-t2i-14B", None), | ||
| ("cosmos-2.0-v2w-2B", None), | ||
| ("cosmos-2.0-v2w-14B", None), | ||
| ("flux-2-dev", FluxPipeline), | ||
| ("flux-control", FluxControlPipeline), | ||
| ("flux-controlnet", FluxControlNetPipeline), | ||
| ("flux-depth", FluxPipeline), | ||
| ("flux-dev", FluxPipeline), | ||
| ("flux-fill", FluxPipeline), | ||
| ("flux-kontext", FluxKontextPipeline), | ||
| ("flux-schnell", FluxPipeline), | ||
| ("hidream", None), | ||
| ("hunyuan", HunyuanDiTPipeline), | ||
| ("hunyuan-video", None), | ||
| ("inpainting", None), | ||
| ("inpainting_v2", None), | ||
| ("inpainting", StableDiffusionInpaintPipeline), | ||
| ("inpainting_v2", StableDiffusionInpaintPipeline), | ||
| ("instruct-pix2pix", None), | ||
| ("kandinsky", KandinskyCombinedPipeline), | ||
| ("kandinsky22", KandinskyV22CombinedPipeline), | ||
| ("kandinsky3", Kandinsky3Pipeline), | ||
| ("lcm", LatentConsistencyModelPipeline), | ||
| ("lumina", LuminaPipeline), | ||
| ("lumina2", Lumina2Pipeline), | ||
| ("ltx-video", None), | ||
| ("ltx-video-0.9.1", None), | ||
| ("ltx-video-0.9.5", None), | ||
| ("ltx-video-0.9.7", None), | ||
| ("mochi-1-preview", None), | ||
| ("ovis", OvisImagePipeline), | ||
| ("pixart-alpha", PixArtAlphaPipeline), | ||
| ("pixart-sigma", PixArtSigmaPipeline), | ||
| ("playground-v2-5", StableDiffusionXLPipeline), | ||
| ("qwenimage", QwenImagePipeline), | ||
| ("qwenimage-controlnet", QwenImageControlNetPipeline), | ||
| ("sana", SanaPipeline), | ||
| ("sd3", StableDiffusion3Pipeline), | ||
| ("sd35_large", StableDiffusion3Pipeline), | ||
| ("sd35_medium", StableDiffusion3Pipeline), | ||
| ("sd3-controlnet", StableDiffusion3ControlNetPipeline), | ||
| ("stable_cascade_stage_b", None), | ||
| ("stable_cascade_stage_b_lite", None), | ||
| ("stable_cascade_stage_c", None), | ||
| ("stable_cascade_stage_c_lite", None), | ||
| ("upscale", StableDiffusionUpscalePipeline), | ||
| ("v1", StableDiffusionPipeline), | ||
| ("v2", StableDiffusionPipeline), | ||
| ("wan-i2v-14B", WanImageToVideoPipeline), | ||
| ("wan-t2v-1.3B", WanPipeline), | ||
| ("wan-t2v-14B", WanPipeline), | ||
| ("wan-vace-1.3B", WanVideoToVideoPipeline), | ||
| ("wan-vace-14B", WanVideoToVideoPipeline), | ||
| ("xl_base", StableDiffusionXLPipeline), | ||
| ("xl_inpaint", None), | ||
| ("xl_refiner", StableDiffusionXLPipeline), | ||
| ("z-image", ZImagePipeline), | ||
| ("z-image-controlnet", ZImageControlNetPipeline), | ||
| ("z-image-omni", ZImageOmniPipeline), | ||
| ("z-image-turbo", None), | ||
| ("z-image-turbo-controlnet", None), | ||
| ("z-image-turbo-controlnet-2.0", None), | ||
| ("z-image-turbo-controlnet-2.1", None), | ||
| ], |
There was a problem hiding this comment.
The removed entries for "xl_inpaint" in the text2image and image2image mappings (previously set to None) appear to be intentionally removed, but this entry is still present in the inpainting mapping at line 469 with a valid pipeline. This inconsistency could indicate that "xl_inpaint" was previously explicitly marked as unsupported for text2image and image2image tasks. The removal of these explicit None entries might cause the code to attempt to use a default or fallback behavior rather than explicitly indicating that these combinations are unsupported. Consider whether these None entries should be restored for clarity, or if the removal is intentional and the code handles missing entries appropriately.
| def get_allowed_extensions(allow_unsafe_formats: bool = False) -> List[str]: | ||
| r""" | ||
| Get the list of allowed file extensions based on safety preferences. | ||
|
|
||
| Parameters: | ||
| allow_unsafe_formats (`bool`, *optional*, defaults to `False`): | ||
| If True, allows potentially unsafe formats (.ckpt, .bin) in addition to .safetensors. | ||
| If False (default), only allows .safetensors format for maximum security. | ||
|
|
||
| Returns: | ||
| `List[str]`: List of allowed file extensions. | ||
| """ | ||
| if allow_unsafe_formats: | ||
| return [".safetensors", ".ckpt", ".bin"] | ||
| else: | ||
| return [".safetensors"] |
There was a problem hiding this comment.
The get_allowed_extensions function introduces a breaking change in default behavior. By default, when allow_unsafe_formats is False, only .safetensors files will be allowed. However, the global EXTENSION constant still includes all formats for backward compatibility. This creates confusion and potential runtime issues where existing code might fail to find models that use .ckpt or .bin formats unless users explicitly pass allow_unsafe_formats=True. Consider:
- Setting the default to
Trueto maintain backward compatibility, or - Adding a deprecation warning when unsafe formats are used, or
- Documenting this breaking change prominently in release notes and migration guides.
| StableDiffusion3Pipeline, | ||
| ) | ||
|
|
||
| # Flux pipelines (import separately to avoid Flax deprecation warnings) |
There was a problem hiding this comment.
The comment states that Flux pipelines are imported separately "to avoid Flax deprecation warnings". However, this rationale is unclear - the Flux pipelines in the diffusers library are for PyTorch, not Flax. If there's a specific issue causing deprecation warnings when importing Flux pipelines, it should be documented more clearly or reported upstream. The try-except import pattern is good practice for optional dependencies, but the justification should be accurate.
| # Flux pipelines (import separately to avoid Flax deprecation warnings) | |
| # Flux pipelines (optional: may not be available in all diffusers installations) |
| from diffusers import ( | ||
| AuraFlowPipeline, | ||
| ChromaPipeline, | ||
| CogView3PlusPipeline, | ||
| CogView4ControlPipeline, | ||
| CogView4Pipeline, | ||
| HunyuanDiTPipeline, | ||
| KandinskyCombinedPipeline, | ||
| KandinskyImg2ImgCombinedPipeline, | ||
| KandinskyImg2ImgPipeline, | ||
| KandinskyInpaintCombinedPipeline, | ||
| KandinskyInpaintPipeline, | ||
| KandinskyPipeline, | ||
| KandinskyV22CombinedPipeline, | ||
| KandinskyV22Img2ImgCombinedPipeline, | ||
| KandinskyV22Img2ImgPipeline, | ||
| KandinskyV22InpaintCombinedPipeline, | ||
| KandinskyV22InpaintPipeline, | ||
| KandinskyV22Pipeline, | ||
| Kandinsky3Img2ImgPipeline, | ||
| Kandinsky3Pipeline, | ||
| LatentConsistencyModelImg2ImgPipeline, | ||
| LatentConsistencyModelPipeline, | ||
| Lumina2Pipeline, | ||
| LuminaPipeline, | ||
| OvisImagePipeline, | ||
| PixArtAlphaPipeline, | ||
| PixArtSigmaPipeline, | ||
| QwenImageControlNetPipeline, | ||
| QwenImageEditInpaintPipeline, | ||
| QwenImageEditPipeline, | ||
| QwenImageEditPlusPipeline, | ||
| QwenImageImg2ImgPipeline, | ||
| QwenImageInpaintPipeline, | ||
| QwenImageLayeredPipeline, | ||
| QwenImagePipeline, | ||
| SanaPipeline, | ||
| StableDiffusion3ControlNetInpaintingPipeline, | ||
| StableDiffusion3ControlNetPipeline, | ||
| StableDiffusionXLControlNetUnionImg2ImgPipeline, | ||
| StableDiffusionXLControlNetUnionInpaintPipeline, | ||
| StableDiffusionXLControlNetUnionPipeline, | ||
| WanImageToVideoPipeline, | ||
| WanPipeline, | ||
| WanVideoToVideoPipeline, | ||
| ZImageControlNetInpaintPipeline, | ||
| ZImageControlNetPipeline, | ||
| ZImageImg2ImgPipeline, | ||
| ZImageOmniPipeline, | ||
| ZImagePipeline, | ||
| ) |
There was a problem hiding this comment.
Import of 'KandinskyImg2ImgPipeline' is not used.
Import of 'KandinskyInpaintPipeline' is not used.
Import of 'KandinskyPipeline' is not used.
Import of 'KandinskyV22Img2ImgPipeline' is not used.
Import of 'KandinskyV22InpaintPipeline' is not used.
Import of 'KandinskyV22Pipeline' is not used.
…n pipeline_easy.py
… in pipeline_easy.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…diffusers into update-pipeline
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request updates the
README.mdto inform users about known issues with the Civitai API due to recent specification changes. It explains the impact on search functionality and provides a link to the relevant issue for further details.Documentation update: