"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "2f06f2bcd66917d878db04a3b8c79968b530255c"
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,6 +305,11 @@ def shard_checkpoint( ...@@ -305,6 +305,11 @@ 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():
# 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) 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`
......
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