[`from_pretrained`] Small refactor `from_pretrained`: move around unrelated stuff (#41445)
* drafts
* up
* simplify modeling utils
* more simplifications
* type kwargs
* up
* move more accelerate related stuff
* safeguarding?
* nits
* remove func when func is NOPE
* more
* nits
* styling
* yups
* up
* ups
* revert
* protect trainer utils iport
* fix doc
* Update src/transformers/integrations/peft.py
Co-authored-by: Cyril Vallez <cyril.vallez@huggingface.co>
* review
* update
* ?
* fixx
* update
* super small update
* ups
* style
* this is stupid
* :facepalm: well this was the issue
* small nit
* fix
* nit
* damn the missing return
* one last stupid fix
---------
Co-authored-by: Cyril Vallez <cyril.vallez@huggingface.co>