forked from nikopueringer/CorridorKey
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.py
More file actions
72 lines (56 loc) · 2.08 KB
/
bootstrap.py
File metadata and controls
72 lines (56 loc) · 2.08 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
#!/usr/bin/env python3
###############################################################################
# CorridorKey for Nuke — Bootstrap
# Authored by: Ahmed Ramadan
# This software is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
# Full license text: https://creativecommons.org/licenses/by-nc-nd/4.0
# Repository: https://github.com/aramadan0096/CorridorKey-Nuke-Cattery
###############################################################################
"""
bootstrap.py
============
One-shot setup script: downloads the CorridorKey checkpoint and exports
the TorchScript model ready for Nuke.
Run from the repo root (via install.bat → start.bat, or directly):
uv run python bootstrap.py
Steps performed
---------------
1. uv run python nuke/download_checkpoint.py
Downloads CorridorKey_v1.0.pth (~300 MB) into
CorridorKey/CorridorKeyModule/checkpoints/
2. uv run python nuke/export_torchscript.py
Traces the real GreenFormer model and writes
Export/CorridorKey.pt
After bootstrap completes, open Nuke and follow the CatFileCreator
instructions printed by export_torchscript.py.
"""
import subprocess
import sys
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parent
def _run(cmd: list[str]) -> None:
sep = "=" * 62
print(f"\n{sep}")
print(f" {' '.join(cmd)}")
print(sep)
result = subprocess.run(cmd, cwd=str(REPO_ROOT))
if result.returncode != 0:
print(f"\n ERROR: command exited with code {result.returncode}.")
sys.exit(result.returncode)
def main() -> None:
print()
print("=" * 62)
print(" CorridorKey — Bootstrap")
print("=" * 62)
# Step 1 — download checkpoint
_run(["uv", "run", "python", "nuke/download_checkpoint.py"])
# Step 2 — export TorchScript
_run(["uv", "run", "python", "nuke/export_torchscript.py"])
print()
print("=" * 62)
print(" Bootstrap complete.")
print(" Export/CorridorKey.pt is ready for Nuke CatFileCreator.")
print("=" * 62)
print()
if __name__ == "__main__":
main()