model.push_to_hub not working for gtr-large while loading with 8-bit using bnb
Author: nss-programmer
Pull request: no

### System Info

Issue :- I want to load gtr-large model in 8-bits using bitsandbytes and save it for future usage



model = T5ForConditionalGeneration.from_pretrained('sentence-transformers/gtr-t5-large',load_in_8bit=True)
model.push_to_hub("snigdhachandan/gtr_large_8bit")


Error :- 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/glide/anaconda/envs/llm/lib/python3.11/site-packages/transformers/utils/hub.py", line 814, in push_to_hub
    self.save_pretrained(work_dir, max_shard_size=max_shard_size, safe_serialization=safe_serialization)
  File "/glide/anaconda/envs/llm/lib/python3.11/site-packages/transformers/modeling_utils.py", line 1820, in save_pretrained
    shards, index = shard_checkpoint(state_dict, max_shard_size=max_shard_size, weights_name=weights_name)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/glide/anaconda/envs/llm/lib/python3.11/site-packages/transformers/modeling_utils.py", line 318, in shard_checkpoint
    storage_id = id_tensor_storage(weight)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/glide/anaconda/envs/llm/lib/python3.11/site-packages/transformers/pytorch_utils.py", line 290, in id_tensor_storage
    return tensor.device, storage_ptr(tensor), storage_size(tensor)
           ^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'device'


Transformers Version :- 4.30.2
Torch Version :- 2.0.1+cu117

### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

model = T5ForConditionalGeneration.from_pretrained('sentence-transformers/gtr-t5-large',load_in_8bit=True)
model.push_to_hub("snigdhachandan/gtr_large_8bit")

### Expected behavior

It should have been push to Huggingface Hub

Comments:
Hi @nss-programmer, thanks for raising this issue. 

There's been quite a few updates between bitsandbytes and transformers recently. Could you update your local transformers version to the most recent release `pip install --upgrade transformers` and try again? If that doesn't work, then could you try from source `pip install git+https://github.com/huggingface/transformers` and let us know if either of these work? This way, we can figure out if the issue has already been resolved. 

Could you also share more information about the running environment )run `transformers-cli env` in the terminal and copy-paste the output) specifically, the bitsandbytes and huggingface_hub versions installed? 

cc @younesbelkada 

Thanks for the ping! The issue you are describing is really close to what I have described in https://github.com/huggingface/transformers/pull/24416 I believe installing the lib from source as @amyeroberts mentioned should resolve it!

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.