File tree Expand file tree Collapse file tree 1 file changed +0
-9
lines changed Expand file tree Collapse file tree 1 file changed +0
-9
lines changed Original file line number Diff line number Diff line change @@ -272,15 +272,6 @@ def save_pretrained(
272272
273273 weights_name = SAFETENSORS_WEIGHTS_NAME if safe_serialization else WEIGHTS_NAME
274274
275- # Clean the folder from a previous save
276- for filename in os .listdir (save_directory ):
277- full_filename = os .path .join (save_directory , filename )
278- # If we have a shard file that is not going to be replaced, we delete it, but only from the main process
279- # in distributed settings to avoid race conditions.
280- weights_no_suffix = weights_name .replace (".bin" , "" ).replace (".safetensors" , "" )
281- if filename .startswith (weights_no_suffix ) and os .path .isfile (full_filename ) and is_main_process :
282- os .remove (full_filename )
283-
284275 # Save the model
285276 save_function (state_dict , os .path .join (save_directory , weights_name ))
286277
You can’t perform that action at this time.
0 commit comments