[FEAT] Model loading refactor (#10604)
* first draft model loading refactor
* revert name change
* fix bnb
* revert name
* fix dduf
* fix huanyan
* style
* Update src/diffusers/models/model_loading_utils.py
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
* suggestions from reviews
* Update src/diffusers/models/modeling_utils.py
Co-authored-by: YiYi Xu <yixu310@gmail.com>
* remove safetensors check
* fix default value
* more fix from suggestions
* revert logic for single file
* style
* typing + fix couple of issues
* improve speed
* Update src/diffusers/models/modeling_utils.py
Co-authored-by: Aryan <aryan@huggingface.co>
* fp8 dtype
* add tests
* rename resolved_archive_file to resolved_model_file
* format
* map_location default cpu
* add utility function
* switch to smaller model + test inference
* Apply suggestions from code review
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
* rm comment
* add log
* Apply suggestions from code review
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
* add decorator
* cosine sim instead
* fix use_keep_in_fp32_modules
* comm
---------
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Co-authored-by: YiYi Xu <yixu310@gmail.com>
Co-authored-by: Aryan <aryan@huggingface.co>