kovacsvi commited on
Commit
bf07f99
·
1 Parent(s): 8453705

delete unused model weights FIXED

Browse files
Files changed (1) hide show
  1. utils.py +12 -2
utils.py CHANGED
@@ -118,8 +118,18 @@ def df_h():
118
 
119
  def delete_unused_bin_files(model_id: str):
120
  target_path = f"/data/models--poltextlab--{model_id}"
121
- bin_files = glob.glob(f"{target_path}/**/*.bin", recursive=True)
122
- for file_path in bin_files:
 
 
 
 
 
 
 
 
 
 
123
  if os.path.isfile(file_path):
124
  print(f"Deleting: {file_path}")
125
  os.remove(file_path)
 
118
 
119
  def delete_unused_bin_files(model_id: str):
120
  target_path = f"/data/models--poltextlab--{model_id}"
121
+
122
+ # delete .bin files in blobs/
123
+ blob_bins = glob.glob(f"{target_path}/blobs/**/*.bin", recursive=True)
124
+
125
+ # delete .bin files in snapshots/, except config.json
126
+ snapshot_bins = glob.glob(f"{target_path}/snapshots/**/*.bin", recursive=True)
127
+
128
+ files_to_delete = blob_bins + snapshot_bins
129
+
130
+ for file_path in files_to_delete:
131
+ if os.path.basename(file_path) == "config.json":
132
+ continue
133
  if os.path.isfile(file_path):
134
  print(f"Deleting: {file_path}")
135
  os.remove(file_path)