Correct loading of models with shared tensors when using accelerator.load_state() (#2875)
* Enabled correct loading of models with shared tensors when using accelerator.load_state()
* removed unused import
* added a test for a model with shared weights
* removed unnecessary bits
* fixed linting errors