Skip to content

Commit

Permalink
Revert "Debugging, will revert"
Browse files Browse the repository at this point in the history
This reverts commit 9d0d307.
  • Loading branch information
a8nova committed May 5, 2024
1 parent 9d0d307 commit 782e41f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/transformers/modeling_tf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2475,6 +2475,7 @@ def save_pretrained(
output_model_file = os.path.join(save_directory, weights_name)

shards, index = tf_shard_checkpoint(self.weights, max_shard_size, weights_name=weights_name)
logger.info(f"shards {shards}\nindex {index}")
# Clean the folder from a previous save
for filename in os.listdir(save_directory):
full_filename = os.path.join(save_directory, filename)
Expand All @@ -2493,9 +2494,6 @@ def save_pretrained(
state_dict = {strip_model_name_and_prefix(w.name): w.value() for w in self.weights}
safe_save_file(state_dict, output_model_file, metadata={"format": "tf"})
else:
import shutil
total, used, free = shutil.disk_usage(output_model_file)
logger.info(f"Before save: Disk total: {total / (1024**3)} GB, Used: {used / (1024**3)} GB, Free: {free / (1024**3)} GB")
self.save_weights(output_model_file)
logger.info(f"Model weights saved in {output_model_file}")
else:
Expand Down

0 comments on commit 782e41f

Please sign in to comment.