mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-01 02:31:11 +06:00
[bnb
] Fix bnb serialization issue with new release (#24416)
* fix bnb issue * fixup * revert and do simple patching instead * add more details
This commit is contained in:
parent
652ece0710
commit
ebb62e8880
@ -305,7 +305,12 @@ def shard_checkpoint(
|
||||
storage_id_to_block = {}
|
||||
|
||||
for key, weight in state_dict.items():
|
||||
storage_id = id_tensor_storage(weight)
|
||||
# when bnb serialization is used the weights in the state dict can be strings
|
||||
# check: https://github.com/huggingface/transformers/pull/24416 for more details
|
||||
if isinstance(weight, str):
|
||||
continue
|
||||
else:
|
||||
storage_id = id_tensor_storage(weight)
|
||||
|
||||
# If a `weight` shares the same underlying storage as another tensor, we put `weight` in the same `block`
|
||||
if storage_id in storage_id_to_block:
|
||||
|
Loading…
Reference in New Issue
Block a user