-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun.py
More file actions
72 lines (57 loc) · 2.12 KB
/
run.py
File metadata and controls
72 lines (57 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# ruff: noqa: E402
import argparse
import os
import time
import torch
# This addresses the OpenMP runtime conflict.
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
# Disables experimental Metal ops
os.environ["EZSYNTH_SKIP_METAL"] = "1"
os.environ["EZSYNTH_SKIP_METAL_VERBOSE"] = "0"
from ezsynth.project import Project
def main():
"""
Main entry point for running the Ezsynth v2 pipeline.
Parses command-line arguments, initializes a Project, and runs it.
"""
parser = argparse.ArgumentParser(
description="Run the Ezsynth v2 video-to-video synthesis pipeline.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
"--config",
type=str,
required=True,
help="Path to the project configuration YAML file.",
)
args = parser.parse_args()
# --- Welcome Message & Environment Check ---
print("========================================")
print(" Starting Ezsynth v2 ")
print("========================================")
if torch.cuda.is_available():
print(f"CUDA is available. Using GPU: {torch.cuda.get_device_name(0)}")
else:
print("CUDA not found. Running on CPU. This will be very slow.")
start_time = time.time()
try:
# --- Project Initialization ---
print(f"\nLoading project with configuration: {args.config}")
project = Project(config_path=args.config)
# --- Pipeline Execution ---
print("\nStarting Ezsynth v2 pipeline...")
project.run()
except FileNotFoundError as e:
print(f"\n[ERROR] A required file or directory was not found: {e}")
print("Please check the paths in your configuration file.")
except Exception as e:
print(f"\n[ERROR] An unexpected error occurred: {e}")
import traceback
traceback.print_exc()
finally:
end_time = time.time()
print("\n----------------------------------------")
print(f"Pipeline finished in {end_time - start_time:.2f} seconds.")
print("========================================")
if __name__ == "__main__":
main()