-
Notifications
You must be signed in to change notification settings - Fork 512
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
Add LCM to DIFFUSERS_TASKS_TO_MODEL_LOADERS #1762
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -188,7 +188,9 @@ class TasksManager: | |||
|
||||
_DIFFUSERS_TASKS_TO_MODEL_LOADERS = { | ||||
"stable-diffusion": "StableDiffusionPipeline", | ||||
"stable-diffusion-xl": "StableDiffusionXLImg2ImgPipeline", | ||||
"stable-diffusion-xl": "StableDiffusionXLPipeline", | ||||
"stable-diffusion-xl-refiner": "StableDiffusionXLImg2ImgPipeline", | ||||
"latent-consistency": "LatentConsistencyModelPipeline", | ||||
Comment on lines
+192
to
+193
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you extend on why this is needed ? To my knowledge this shouldn't be needed (both pipelines can be correctly loaded using the current There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also at the moment inferred task for optimum/optimum/exporters/tasks.py Line 1564 in dedb852
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is necessary to correctly determine the model class from task. Hybrid quantization supports the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure that we need it in the TaskManager, from what I see it's only needed to get the class to load the model in the optimum-intel CLI for diffusers models, could we move it in optimum-intel directly instead ? We could get this information by combining the task (text-to-image, image-to-image, inpaint, ..) and the architecture (SD, SDXL, LCMs, ..) using the model's config There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you suggesting to remove only the As far as I understand, there are no |
||||
} | ||||
|
||||
_TIMM_TASKS_TO_MODEL_LOADERS = { | ||||
|
@@ -1561,7 +1563,12 @@ def _infer_task_from_model_name_or_path( | |||
|
||||
if library_name == "diffusers": | ||||
class_name = model_info.config["diffusers"]["class_name"] | ||||
inferred_task_name = "stable-diffusion-xl" if "StableDiffusionXL" in class_name else "stable-diffusion" | ||||
if "LatentConsistency" in class_name: | ||||
inferred_task_name = "latent-consistency" | ||||
elif "StableDiffusionXL" in class_name: | ||||
inferred_task_name = f"stable-diffusion-xl{'-refiner' if 'Img2Img' in class_name else ''}" | ||||
else: | ||||
inferred_task_name = "stable-diffusion" | ||||
elif library_name == "timm": | ||||
inferred_task_name = "image-classification" | ||||
else: | ||||
|
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.
_optional_components
was introduced in diffusers v0.22.0 https://github.com/huggingface/diffusers/blob/v0.22.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L144, so we would need to upgradeDIFFUSERS_MINIMUM_VERSION
as well to avoid any potential issue when loading a SDXL model (which don't have optional components)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.
DIFFUSERS_MINIMUM_VERSION was upgraded