mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
major installer work
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
mediapipe
|
||||
colormap
|
||||
invisible-watermark
|
||||
|
||||
Submodule extensions-builtin/sd-extension-aesthetic-scorer updated: 9978b44c0e...a35fb67ae9
Submodule extensions-builtin/sd-extension-system-info updated: 39296b6ae8...1574b974b3
Binary file not shown.
@@ -86,7 +86,7 @@ def run_extension_installer(dir):
|
||||
if __name__ == "__main__":
|
||||
setup.run_setup(False)
|
||||
setup.set_environment()
|
||||
# setup.check_torch()
|
||||
setup.check_torch()
|
||||
setup.log.info(f"Server arguments: {sys.argv[1:]}")
|
||||
import webui
|
||||
webui.webui()
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
import facexlib
|
||||
import gfpgan
|
||||
|
||||
import modules.face_restoration
|
||||
from modules import paths, shared, devices, modelloader
|
||||
|
||||
@@ -16,6 +13,8 @@ loaded_gfpgan_model = None
|
||||
|
||||
|
||||
def gfpgann():
|
||||
import facexlib
|
||||
import gfpgan
|
||||
global loaded_gfpgan_model
|
||||
global model_path
|
||||
if loaded_gfpgan_model is not None:
|
||||
@@ -76,8 +75,9 @@ def setup_model(dirname):
|
||||
os.makedirs(model_path)
|
||||
|
||||
try:
|
||||
from gfpgan import GFPGANer
|
||||
from facexlib import detection, parsing
|
||||
import gfpgan
|
||||
import facexlib
|
||||
|
||||
global user_path
|
||||
global have_gfpgan
|
||||
global gfpgan_constructor
|
||||
@@ -100,7 +100,7 @@ def setup_model(dirname):
|
||||
facexlib.parsing.load_file_from_url = facex_load_file_from_url2
|
||||
user_path = dirname
|
||||
have_gfpgan = True
|
||||
gfpgan_constructor = GFPGANer
|
||||
gfpgan_constructor = gfpgan.GFPGANer
|
||||
|
||||
class FaceRestorerGFPGAN(modules.face_restoration.FaceRestoration):
|
||||
def name(self):
|
||||
|
||||
+2
-3
@@ -12,7 +12,6 @@ import numpy as np
|
||||
import piexif
|
||||
import piexif.helper
|
||||
from PIL import Image, ImageFont, ImageDraw, PngImagePlugin, ExifTags
|
||||
from fonts.ttf import Roboto # pylint: disable=no-name-in-module
|
||||
import string
|
||||
import json
|
||||
import hashlib
|
||||
@@ -143,9 +142,9 @@ def draw_grid_annotations(im, width, height, hor_texts, ver_texts, margin=0):
|
||||
|
||||
def get_font(fontsize):
|
||||
try:
|
||||
return ImageFont.truetype(opts.font or Roboto, fontsize)
|
||||
return ImageFont.truetype(opts.font or 'javascript/roboto.ttf', fontsize)
|
||||
except Exception:
|
||||
return ImageFont.truetype(Roboto, fontsize)
|
||||
return ImageFont.truetype('javascript/roboto.ttf', fontsize)
|
||||
|
||||
def draw_texts(drawing, draw_x, draw_y, lines, initial_fnt, initial_fontsize):
|
||||
for i, line in enumerate(lines):
|
||||
|
||||
+1
-1
Submodule modules/lora updated: 5050971ac6...7ad7cac0c2
+8
-5
@@ -22,12 +22,15 @@ class MemUsageMonitor(threading.Thread):
|
||||
self.run_flag = threading.Event()
|
||||
self.data = defaultdict(int)
|
||||
|
||||
try:
|
||||
self.cuda_mem_get_info()
|
||||
torch.cuda.memory_stats(self.device)
|
||||
except Exception as e: # AMD or whatever
|
||||
print(f"Warning: caught exception '{e}', memory monitor disabled")
|
||||
if not torch.cuda.is_available():
|
||||
self.disabled = True
|
||||
else:
|
||||
try:
|
||||
self.cuda_mem_get_info()
|
||||
torch.cuda.memory_stats(self.device)
|
||||
except Exception as e: # AMD or whatever
|
||||
print(f"Torch exception: {e}")
|
||||
self.disabled = True
|
||||
|
||||
def cuda_mem_get_info(self):
|
||||
index = self.device.index if self.device.index is not None else torch.cuda.current_device()
|
||||
|
||||
@@ -4,7 +4,6 @@ import sys
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
from basicsr.utils.download_util import load_file_from_url
|
||||
from realesrgan import RealESRGANer
|
||||
|
||||
from modules.upscaler import Upscaler, UpscalerData
|
||||
from modules.shared import cmd_opts, opts
|
||||
@@ -37,6 +36,12 @@ class UpscalerRealESRGAN(Upscaler):
|
||||
if not self.enable:
|
||||
return img
|
||||
|
||||
try:
|
||||
from realesrgan import RealESRGANer
|
||||
except:
|
||||
print("Error importing Real-ESRGAN:", file=sys.stderr)
|
||||
return img
|
||||
|
||||
info = self.load_model(path)
|
||||
if not os.path.exists(info.local_data_path):
|
||||
print("Unable to load RealESRGAN model: %s" % info.name)
|
||||
@@ -125,5 +130,5 @@ def get_realesrgan_models(scaler):
|
||||
]
|
||||
return models
|
||||
except Exception as e:
|
||||
print("Error making Real-ESRGAN models list:", file=sys.stderr)
|
||||
shared.exception()
|
||||
print("Error creating Real-ESRGAN models list", file=sys.stderr)
|
||||
return []
|
||||
|
||||
@@ -3,7 +3,6 @@ import json
|
||||
import numpy as np
|
||||
import zlib
|
||||
from PIL import Image, PngImagePlugin, ImageDraw, ImageFont
|
||||
from fonts.ttf import Roboto
|
||||
import torch
|
||||
from modules.shared import opts
|
||||
|
||||
@@ -137,10 +136,9 @@ def caption_image_overlay(srcimage, title, footerLeft, footerMid, footerRight, t
|
||||
fontsize = 32
|
||||
if textfont is None:
|
||||
try:
|
||||
textfont = ImageFont.truetype(opts.font or Roboto, fontsize)
|
||||
textfont = opts.font or Roboto
|
||||
return ImageFont.truetype(opts.font or 'javascript/roboto.ttf', fontsize)
|
||||
except Exception:
|
||||
textfont = Roboto
|
||||
return ImageFont.truetype('javascript/roboto.ttf', fontsize)
|
||||
|
||||
factor = 1.5
|
||||
gradient = Image.new('RGBA', (1, image.size[1]), color=(0, 0, 0, 0))
|
||||
|
||||
+8
-8
@@ -1,3 +1,4 @@
|
||||
accelerate
|
||||
addict
|
||||
aenum
|
||||
aiohttp
|
||||
@@ -8,6 +9,7 @@ basicsr
|
||||
bitsandbytes
|
||||
blendmodes
|
||||
clean-fid
|
||||
clip
|
||||
easydev
|
||||
extcolors
|
||||
facexlib
|
||||
@@ -16,24 +18,28 @@ font-roboto
|
||||
fonts
|
||||
future
|
||||
gdown
|
||||
gfpgan
|
||||
GitPython
|
||||
httpcore
|
||||
inflection
|
||||
invisible-watermark
|
||||
jsonmerge
|
||||
kornia
|
||||
lark
|
||||
lmdb
|
||||
lpips
|
||||
numpy
|
||||
omegaconf
|
||||
opencv-contrib-python
|
||||
opencv-python
|
||||
piexif
|
||||
Pillow
|
||||
psutil
|
||||
pyyaml
|
||||
realesrgan
|
||||
requests
|
||||
resize-right
|
||||
rich
|
||||
safetensors
|
||||
scikit-image
|
||||
scipy
|
||||
tb_nightly
|
||||
@@ -44,22 +50,16 @@ torchdiffeq
|
||||
torchsde
|
||||
torchvision
|
||||
tqdm
|
||||
transformers
|
||||
voluptuous
|
||||
yapf
|
||||
|
||||
accelerate==0.18.0
|
||||
diffusers==0.14.0
|
||||
einops==0.4.1
|
||||
fastapi==0.94.0
|
||||
gfpgan==1.3.8
|
||||
GitPython==3.1.31
|
||||
gradio==3.23.0
|
||||
numexpr==2.8.4
|
||||
omegaconf==2.3.0
|
||||
pandas==1.5.3
|
||||
protobuf==3.20.3
|
||||
pytorch_lightning==1.9.4
|
||||
realesrgan==0.3.0
|
||||
safetensors==0.3.0
|
||||
tensorflow==2.12.0
|
||||
transformers==4.27.4
|
||||
|
||||
@@ -2,8 +2,9 @@ import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import subprocess
|
||||
import shutil
|
||||
import logging
|
||||
import subprocess
|
||||
from modules.cmd_args import parser
|
||||
|
||||
|
||||
@@ -140,6 +141,9 @@ def check_python():
|
||||
log.info(f'Python {platform.python_version()} on {platform.system()}')
|
||||
if not (sys.version_info.major == 3 and sys.version_info.minor in supported_minors):
|
||||
raise RuntimeError(f"Incompatible Python version: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} required 3.9-3.11")
|
||||
git_cmd = os.environ.get('GIT', "git")
|
||||
if shutil.which(git_cmd) is None:
|
||||
raise RuntimeError('Git not found')
|
||||
|
||||
|
||||
# check torch version
|
||||
@@ -150,14 +154,17 @@ def check_torch():
|
||||
log.info(f'Torch {torch.__version__}')
|
||||
if not torch.cuda.is_available():
|
||||
log.warning("Torch repoorts CUDA not available")
|
||||
if '--no-half' not in sys.argv:
|
||||
sys.argv.append('--no-half')
|
||||
else:
|
||||
log.info(f'Torch detected GPU: {torch.cuda.get_device_name(torch.cuda.current_device())}')
|
||||
if torch.version.cuda:
|
||||
log.info(f'Torch backend: nVidia CUDA {torch.version.cuda} cuDNN {torch.backends.cudnn.version()}')
|
||||
elif torch.version.hip:
|
||||
log.info(f'Torch backend: AMD ROCm HIP {torch.version.hip}')
|
||||
else:
|
||||
log.warning(f'Unknown Torch backend')
|
||||
for device in [torch.cuda.device(i) for i in range(torch.cuda.device_count())]:
|
||||
log.info(f'Torch detected GPU: {torch.cuda.get_device_name(device)} VRAM {round(torch.cuda.get_device_properties(device).total_memory / 1024 / 1024)} Arch {torch.cuda.get_device_capability(device)} Cores {torch.cuda.get_device_properties(device).multi_processor_count}')
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -168,11 +175,11 @@ def install_packages():
|
||||
gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379")
|
||||
clip_package = os.environ.get('CLIP_PACKAGE', "git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1")
|
||||
openclip_package = os.environ.get('OPENCLIP_PACKAGE', "git+https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b")
|
||||
xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.18')
|
||||
install(gfpgan_package)
|
||||
install(clip_package)
|
||||
install(openclip_package)
|
||||
try:
|
||||
xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers')
|
||||
install(f'--no-deps {xformers_package}')
|
||||
except Exception as e:
|
||||
log.error('Cannot install xformers package: {e}')
|
||||
@@ -216,7 +223,8 @@ def run_extension_installer(extension_dir):
|
||||
txt = result.stdout.decode(encoding="utf8", errors="ignore")
|
||||
if len(result.stderr) > 0:
|
||||
txt = txt + '\n' + result.stderr.decode(encoding="utf8", errors="ignore")
|
||||
log.error(f'Error running extension installer: {txt}')
|
||||
log.error(f'Error running extension installer: {path_installer}')
|
||||
log.debug(txt)
|
||||
except Exception as e:
|
||||
log.error(f'Exception running extension installer: {e}')
|
||||
|
||||
|
||||
@@ -61,16 +61,6 @@ else:
|
||||
|
||||
|
||||
def initialize():
|
||||
if torch.cuda.is_available():
|
||||
if torch.version.cuda: cuda_version = f'CUDA {torch.version.cuda} cuDNN {torch.backends.cudnn.version()}'
|
||||
elif torch.version.hip: cuda_version = f'HIP {torch.version.hip}'
|
||||
else: cuda_version = ''
|
||||
log.info(f'Torch {getattr(torch, "__long_version__", torch.__version__)} {cuda_version}')
|
||||
for device in [torch.cuda.device(i) for i in range(torch.cuda.device_count())]:
|
||||
log.info(f'GPU {torch.cuda.get_device_name(device)} VRAM {round(torch.cuda.get_device_properties(device).total_memory / 1024 / 1024)} Arch {torch.cuda.get_device_capability(device)} Cores {torch.cuda.get_device_properties(device).multi_processor_count}')
|
||||
else:
|
||||
log.info(f'Torch {getattr(torch, "__long_version__", torch.__version__)} running on CPU')
|
||||
|
||||
extensions.list_extensions()
|
||||
startup_timer.record("extensions")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user