|
import argparse |
|
import os |
|
import subprocess |
|
|
|
def batch_lora_json_extraction(src_dir, lora_json_extractor_path): |
|
for file in os.listdir(src_dir): |
|
if file.endswith(".safetensors"): |
|
input_file = os.path.join(src_dir, file) |
|
output_file = os.path.join(src_dir, file.replace(".safetensors", ".json")) |
|
subprocess.run(["python", lora_json_extractor_path, input_file, output_file]) |
|
|
|
if __name__ == "__main__": |
|
parser = argparse.ArgumentParser(description="Batch extraction of .safetensors files using lora_json_extractor.py.") |
|
parser.add_argument("src_dir", help="Source directory containing .safetensors files.") |
|
parser.add_argument("lora_json_extractor_path", help="Path to lora_json_extractor.py script.") |
|
args = parser.parse_args() |
|
|
|
batch_lora_json_extraction(args.src_dir, args.lora_json_extractor_path) |
|
|