Unverified Commit ebb62e88 authored by Younes Belkada's avatar Younes Belkada Committed by GitHub
Browse files

[`bnb`] Fix bnb serialization issue with new release (#24416)

* fix bnb issue

* fixup

* revert and do simple patching instead

* add more details
parent 652ece07
...@@ -305,7 +305,12 @@ def shard_checkpoint( ...@@ -305,7 +305,12 @@ def shard_checkpoint(
storage_id_to_block = {} storage_id_to_block = {}
for key, weight in state_dict.items(): 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 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: if storage_id in storage_id_to_block:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment