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, inrun_train()File “/vast/home/mayolo/original_mae/small_VITMAEBase.py”, line 96, in run_trainaccelerator.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_modelstate_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_shardsreturn 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_factoryif 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?
2024-08-04T12:41:01Z
I ran into the same error and fixed it by updatinghuggingface_hubwith the command:pip install --upgrade huggingface_hub.