Add `keep_in_fp32_modules` support (#20683)
* add `keep_in_fp32_modules` support
* pass it as class attribute
* few modifs
- make tests `slow`
- fix logic
* better logic
* fix failing test
* `bfloat16` support
* Update src/transformers/modeling_utils.py
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
* fix
* simplify tests
* simplify tests
* fix test
* modify message
* more checks
* fix failing tests
* add more conditions
- add `is_accelerate_available`
- fixes pipleine tests that failed
* add suggestions
* Update src/transformers/modeling_utils.py
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
* fix failing `bnb` test
* add last safety checker
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>