Files
openVLA-Qwen2-0.5B/playground/remove_mid_ckpt.py
T
hanluzhi0429@gmail.com 4f8972e88a Initial commit
2025-04-13 09:30:46 +08:00

36 lines
1.1 KiB
Python

import os
import shutil
import glob
def remove_checkpoints(directory, pattern):
# Walk through the directory
for root, dirs, files in os.walk(directory):
# Use glob to find paths matching the pattern
for file_path in glob.glob(os.path.join(root, pattern)):
# Check if it is a directory
if "llava-1.6-mistral-7b" in file_path:
continue
if os.path.isdir(file_path):
# Remove the directory
print(f"Removing {file_path}")
input("Press Enter to continue...")
shutil.rmtree(file_path)
print(f"Removed directory: {file_path}")
else:
print(f"Removing {file_path}")
input("Press Enter to continue...")
# Remove the file
os.remove(file_path)
print(f"Removed file: {file_path}")
# Directory containing the checkpoints
directory = "/mnt/bn/vl-research/checkpoints/feng/"
# Pattern to match in the file names
pattern = "global_step*"
# Call the function
remove_checkpoints(directory, pattern)