|
|
|
import subprocess |
|
import os |
|
import torch |
|
|
|
if torch.cuda.is_available(): |
|
device="cuda" |
|
print("Using GPU") |
|
else: |
|
device="cpu" |
|
print("Using CPU") |
|
|
|
|
|
|
|
git_branch = os.getenv('git_branch') |
|
|
|
|
|
|
|
subprocess.run(["git", "clone", "https://github.com/facefusion/facefusion", "--branch", git_branch, "--single-branch"], check=True) |
|
|
|
os.chdir("facefusion") |
|
|
|
|
|
|
|
if device == "cuda": |
|
subprocess.run(["python", "install.py", "--onnxruntime", "cuda-11.8", "--skip-conda"], check=True) |
|
elif device == "cpu": |
|
subprocess.run(["python", "install.py", "--onnxruntime", "default", "--skip-conda"], check=True) |
|
|
|
|
|
|
|
if device == "cuda" and git_branch == "master": |
|
subprocess.run(["python", "run.py", "--execution-providers", "cuda"], check=True) |
|
elif device == "cpu" and git_branch == "master": |
|
subprocess.run(["python", "run.py", "--execution-providers", "cpu"], check=True) |
|
elif device == "cuda" and git_branch == "next": |
|
subprocess.run(["python", "facefusion.py", "run", "--execution-providers", "cuda"], check=True) |
|
elif device == "cpu" and git_branch == "next": |
|
subprocess.run(["python", "facefusion.py", "run", "--execution-providers", "cpu"], check=True) |