huggingface / huggingface_hub

The official Python client for the Huggingface Hub.
https://huggingface.co/docs/huggingface_hub
Apache License 2.0
1.83k stars 471 forks source link

Support `max_shard_size` as string in `split_state_dict_into_shards_factory` #2286

Closed SunMarc closed 1 month ago

SunMarc commented 1 month ago

What does this PR do ?

This PR adds the possibility to pass a string for max_shard_size in split_state_dict_into_shards_factory. This makes the docstring consistant with the API. I also fixed a typo in the example split_torch_state_dict_into_shards.

Also, it would be great to change the version of the main branch to "0.24.0.dev0" as it is currently incompatible with the latest transformers that requires >= 0.23.0.

Note: It seems like I can't put Union[str, int] as it makes the quality test fail ?

HuggingFaceDocBuilderDev commented 1 month ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Wauplin commented 1 month ago

Thanks for the PR @SunMarc! Would you mind adding a few tests to it please? Just trying a few valid strings is fine.

it would be great to change the version of the main branch to "0.24.0.dev0" as it is currently incompatible with the latest transformers that requires >= 0.23.0.

Yes, sorry about that. I opened a PR today to fix this https://github.com/huggingface/huggingface_hub/pull/2287

It seems like I can't put Union[str, int] as it makes the quality test fail ?

I can have a look at this.

SunMarc commented 1 month ago

Done ! I've added a few tests.