diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Add documentation for `subfolder` argument to `ModelMixin.from_pretrained`

Open hysts opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

The ModelMixin.from_pretrained has a keyword argument subfolder, but it's not documented in its docstring and it's hard for newcomers to know how to load models from HF Model Hub in case the model is saved with pipeline.

For example, when a DDPM model is trained with using pipeline, the weight will be saved in <output_dir>/unet. https://github.com/huggingface/diffusers/blob/92b6dbba1a25ed27b0bae38b089715132c7e6bcc/src/diffusers/pipeline_utils.py#L112 See this model repo for example: https://huggingface.co/ceyda/ddpm-ema-butterflies-64/tree/main

I checked the implementation of .from_pretrained and found out that such models can be loaded with

model = Unet2DModel.from_pretrained(repo_id, subfolder='unet')

but it took some time, and other people might also wonder how to load them.

Describe the solution you'd like It'd be nice if the subfolder argument were documented in the docstring.

hysts avatar Aug 14 '22 06:08 hysts

Thanks a lot for the issue @hysts!

We're actively working on getting the documentation ready - it's indeed an important component that is missing at the moment! I fully agree that everything regarding ModelMixin and ConfigMixin has to be better documented :-)

patrickvonplaten avatar Aug 14 '22 12:08 patrickvonplaten

This is indeed still missing - opening a PR now

patrickvonplaten avatar Sep 13 '22 15:09 patrickvonplaten