-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[Draft] AutoPipeline #4131
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
[Draft] AutoPipeline #4131
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
|
Hey Yiyi, The idea was rather something like the following: class AutoPipelineForText2Image(ConfigMixin):
config_name = "model_index.json"
@classmethod
def from_pretrained(cls, pretrained_model_or_path, **kwargs):
config = cls.load_config(pretrained_model_or_path)
text_2_image_cls = _get_task_class(AUTO_TEXT2IMAGE_PIPELINES_MAPPING, config["_class_name"])
return text_2_image_cls.from_pretrained(pretrained_model_or_path, **kwargs)
@classmethod
def from_pipe(pipeline: DiffusionPipeline, **kwargs):
text_2_image_cls = get_task_class(AUTO_TEXT2IMAGE_PIPELINES_MAPPING, pipeline.config["_class_name"])
return text_2_image_cls(**pipeline.components)Note that AUTO_TEXT2IMAGE_PIPELINES_MAPPING = OrderedDict(
("stable-diffusion", StableDiffusionPipeline),
...
)and the function
Similarly we should imlpement img2img and inpaint. The important thing here is that Also could we move all this into a |
| return model | ||
|
|
||
|
|
||
| class AutoPipelineForTextToImage(DiffusionPipeline): |
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.
Hmm, I think it's nicer to have AutoPipelineForText2Image because otherwise AutoDiffusionPipeline is essentially the same as DiffusionPipeline
|
ohh so similar to Transformers |
Sure! The reason it should not inherit from
We want |
|
to be continued here #4138 |
Draft for AutoPipeline proposed here #3855
I followed similar patterns for handling compatible schedulers: we link the pipelines that share model checkpoints with a
_linked_pipelinesattribute and specify the task each pipeline can do with ataskattribute.In this PR so far, I only linked the StableDiffusion Pipelines (text2img, img2img, inpaint) - if the overall design is ok, I will link all other pipelines as well.
I followed the API proposed, but I think it will be easier if we only have one
AutoDiffusionpipeline and use ataskargument.