-
Notifications
You must be signed in to change notification settings - Fork 6k
[docs] Simplify loading guide #2694
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
Conversation
The documentation is not available anymore as the PR was closed or merged. |
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.
This is just a draft because I have some questions about variants
:)
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.
Nice cleanup!
I really like the new "explained" doc. But I would request @patrickvonplaten to take a closer look in case I missed anything.
Hmm not too happy about the changes here. I see the benefit of simplifying the loading doc - however all the info that is deleted is very important for users. I don't think we should do a split (loading / conceptual guide here). I think we should leave everything on the loading page (which is visited a lot) and just split everything into "basic" and "advanced" use cases. I don't think it makes sense to add a now "explanatory guide" here. IMO many users just want a quick look-up they can visit quickly to see how variants work instead of having to read through a guide/tutorial. I see |
Thanks for the feedback! I've refactored to keep everything on one page (I'll delete the "explained" page once we're happy with this), and split it into practical stuff at the top and explanatory things at the bottom. I think the practical steps are important for the quick look-up without necessarily needing to know how the folder is structured and the details of the But if they are interested, I added a I think all the info should still be on the page, but feel free to let me know if I'm missing anything! |
Ready for final review @stevhliu - should we move out of draft mode? |
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.
Looks nice! Could we just add some more specification about the difference between variant and torch_dtype?
A checkpoint stored in [torch's half-precision / float16 format](https://pytorch.org/blog/accelerating-training-on-nvidia-gpus-with-pytorch-automatic-mixed-precision/) requires only half the bandwith and storage when downloading the checkpoint, | ||
**but** cannot be used when continuing training or when running the checkpoint on CPU. | ||
Similarly the *non-exponential-averaged* (or non-EMA) version of the checkpoint should be used when continuing fine-tuning of the model checkpoint, **but** should not be used when using the checkpoint for inference. | ||
Load a variant by specifying the `variant` argument in [`DiffusionPipeline.from_pretrained`], and the `torch_dtype` if the variant is a different floating point type. 🧨 Diffusers won't download a variant unless it is explicitly specified, so you don't have to worry about downloading and caching more checkpoints than you need. |
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.
Here we need to be more precise I think.
variant
-> this just defines what files should be loaded
torch_dtype
-> this defines into what torch_dtype
the weights should be converted to.
Can we maybe try to say something along the following:
Load a variant by specifying the `variant` argument in [`DiffusionPipeline.from_pretrained`], and the `torch_dtype` if the variant is a different floating point type. 🧨 Diffusers won't download a variant unless it is explicitly specified, so you don't have to worry about downloading and caching more checkpoints than you need. | |
Load a variant by specifying the `variant` argument in [`DiffusionPipeline.from_pretrained`]. 🧨 Diffusers won't download a variant unless it is explicitly specified, so you don't have to worry about unnecessarily downloading and caching more checkpoints than you need. | |
The `torch_dtype` argument is unrelated to the `variant` argument and decides which floating point precision the loaded checkpoints should have. If you want to save bandwidth by loading a `"fp16"` variant, you should also define `torch_dtype=torch.float16` as otherwise the fp16 weights will be converted to the default fp32 precision. Note that you can also load the original checkpoint without setting a variant and then converting it to float16 precision by passing `torch_dtype=torch.float16`. In this case you downloaded float32 weights and converted them to float16 after loading. |
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.
It would be great if the reader could understand the difference between torch_dtype
and variant
here (they are completely orthogonal.
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.
Thanks for the explanation, this is super helpful!
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.
Looks good to me!
* simplify loading guide * apply feedbacks * clarify variants * clarify torch_dtype and variant * remove conceptual pipeline doc
* simplify loading guide * apply feedbacks * clarify variants * clarify torch_dtype and variant * remove conceptual pipeline doc
* simplify loading guide * apply feedbacks * clarify variants * clarify torch_dtype and variant * remove conceptual pipeline doc
This PR moves the high-level explanations in the loading guide into a separate Conceptual Guide so users can focus on executing the code more quickly. The explanatory guide is linked for users who are interested in learning more about what's happening.