-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from glucauze/v1.2.1
v1.2.1 experimental gpu option
- Loading branch information
Showing
22 changed files
with
396 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
numpy==1.25.1 | ||
Pillow==10.0.0 | ||
pydantic==1.10.9 | ||
Requests==2.31.0 | ||
safetensors==0.3.1 | ||
numpy | ||
Pillow | ||
pydantic | ||
Requests | ||
safetensors>=0.3.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
layout: default | ||
--- | ||
<article class="post"> | ||
|
||
<header class="post-header"> | ||
<h1 class="post-title">{{ page.title | escape }}</h1> | ||
</header> | ||
|
||
<div class="post-content"> | ||
{{ content | toc }} | ||
</div> | ||
|
||
</article> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,62 @@ | ||
import launch | ||
import os | ||
import pkg_resources | ||
import sys | ||
import pkg_resources | ||
from modules import shared | ||
from packaging.version import parse | ||
|
||
|
||
def check_install() -> None: | ||
use_gpu = getattr( | ||
shared.cmd_opts, "faceswaplab_gpu", False | ||
) or shared.opts.data.get("faceswaplab_use_gpu", False) | ||
|
||
req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt") | ||
if use_gpu and sys.platform != "darwin": | ||
req_file = os.path.join( | ||
os.path.dirname(os.path.realpath(__file__)), "requirements-gpu.txt" | ||
) | ||
else: | ||
req_file = os.path.join( | ||
os.path.dirname(os.path.realpath(__file__)), "requirements.txt" | ||
) | ||
|
||
print("Checking faceswaplab requirements") | ||
with open(req_file) as file: | ||
for package in file: | ||
def is_installed(package: str) -> bool: | ||
package_name = package.split("==")[0].split(">=")[0].strip() | ||
try: | ||
python = sys.executable | ||
package = package.strip() | ||
installed_version = parse( | ||
pkg_resources.get_distribution(package_name).version | ||
) | ||
except pkg_resources.DistributionNotFound: | ||
return False | ||
|
||
if not launch.is_installed(package.split("==")[0]): | ||
print(f"Install {package}") | ||
launch.run_pip( | ||
f"install {package}", f"sd-webui-faceswaplab requirement: {package}" | ||
) | ||
elif "==" in package: | ||
package_name, package_version = package.split("==") | ||
installed_version = pkg_resources.get_distribution(package_name).version | ||
if installed_version != package_version: | ||
print( | ||
f"Install {package}, {installed_version} vs {package_version}" | ||
) | ||
if "==" in package: | ||
required_version = parse(package.split("==")[1]) | ||
return installed_version == required_version | ||
elif ">=" in package: | ||
required_version = parse(package.split(">=")[1]) | ||
return installed_version >= required_version | ||
else: | ||
return True | ||
|
||
print("Checking faceswaplab requirements") | ||
with open(req_file) as file: | ||
for package in file: | ||
try: | ||
package = package.strip() | ||
|
||
if not is_installed(package): | ||
print(f"Install {package}") | ||
launch.run_pip( | ||
f"install {package}", | ||
f"sd-webui-faceswaplab requirement: changing {package_name} version from {installed_version} to {package_version}", | ||
f"sd-webui-faceswaplab requirement: {package}", | ||
) | ||
|
||
except Exception as e: | ||
print(e) | ||
print(f"Warning: Failed to install {package}, faceswaplab will not work.") | ||
raise e | ||
except Exception as e: | ||
print(e) | ||
print( | ||
f"Warning: Failed to install {package}, faceswaplab will not work." | ||
) | ||
raise e | ||
|
||
|
||
check_install() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cython | ||
dill | ||
ifnude | ||
insightface==0.7.3 | ||
onnx>=1.14.0 | ||
opencv-python | ||
pandas | ||
pydantic | ||
safetensors | ||
onnxruntime>=1.15.0 | ||
onnxruntime-gpu>=1.15.0 |
Oops, something went wrong.