danhtran2mind's picture
Upload 68 files
f56ede2 verified
raw
history blame contribute delete
816 Bytes
import os
import sys
import subprocess
def run_controlnet_training(args):
"""Run train_controlnet.py with the provided command-line arguments."""
# Path to train_controlnet.py
controlnet_script = os.path.join(os.path.dirname(__file__), "..",
"third_party", "diffusers", "examples", "controlnet", "train_controlnet.py")
# Construct the command: python + script path + arguments
command = [sys.executable, controlnet_script] + args
# Run the command
try:
subprocess.run(command, check=True)
except subprocess.CalledProcessError as e:
print(f"Error running train_controlnet.py: {e}", file=sys.stderr)
sys.exit(e.returncode)
if __name__ == "__main__":
run_controlnet_training(sys.argv[1:])