27 lines
1.0 KiB
Python
27 lines
1.0 KiB
Python
"""Create a private code copy; symlink only existing weights, never overwrite."""
|
|
|
|
import argparse
|
|
import shutil
|
|
from pathlib import Path
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--source", type=Path, default=Path("/opt/hel715-verify/LiveTalking"))
|
|
parser.add_argument("--destination", type=Path, required=True)
|
|
args = parser.parse_args()
|
|
source, destination = args.source.resolve(), args.destination.resolve()
|
|
assert source != destination and not destination.exists(), "Destination must be new"
|
|
|
|
|
|
def ignore(directory, names):
|
|
excluded = {n for n in names if n == "__pycache__" or n.endswith(".log")}
|
|
if Path(directory).resolve() == source:
|
|
excluded.update({"models", "data", ".git"})
|
|
return excluded
|
|
|
|
|
|
shutil.copytree(source, destination, ignore=ignore)
|
|
(destination / "models").symlink_to(source / "models", target_is_directory=True)
|
|
(destination / "data/avatars").mkdir(parents=True)
|
|
print("Private driver code:", destination)
|
|
print("Weights reused read-only by convention:", source / "models")
|