Accelerate.save_model() Error all of the sudden

This is my code that i use to save the model:

           accelerator.wait_for_everyone()
            save_directory= f"small_storage/vitmae_pretrained_{epoch+1}.model"
            accelerator.save_model(model=model,save_directory=save_directory)

and I get this error returned to me:

File “/vast/home/mayolo/original_mae/small_VITMAEBase.py”, line 138, in
run_train()
File “/vast/home/mayolo/original_mae/small_VITMAEBase.py”, line 96, in run_train
accelerator.save_model(model=model,save_directory=save_directory)
File “/vast/home/mayolo/.conda/envs/huggingface/lib/python3.9/site-packages/accelerate/accelerator.py”, line 2782, in save_model
state_dict_split = split_torch_state_dict_into_shards(
File “/vast/home/mayolo/.conda/envs/huggingface/lib/python3.9/site-packages/huggingface_hub/serialization/_torch.py”, line 86, in split_torch_state_dict_into_shards
return split_state_dict_into_shards_factory(
File “/vast/home/mayolo/.conda/envs/huggingface/lib/python3.9/site-packages/huggingface_hub/serialization/_base.py”, line 115, in split_state_dict_into_shards_factory
if tensor_size > max_shard_size:
TypeError: ‘>’ not supported between instances of ‘int’ and ‘str’

I’ve ran this code before a couple months ago and it worked perfectly fine. It just doesn’t anymore. I saw that I can use accelerate.save_state() but is there a way to not save the optimizer and just the model?

I ran into the same error and fixed it by updating huggingface_hub with the command: pip install --upgrade huggingface_hub.