fix clip package

This commit is contained in:
Vladimir Mandic
2023-04-15 21:24:06 -04:00
parent 4955a90c7b
commit 353eb9b019
6 changed files with 55 additions and 48 deletions
+27 -23
View File
@@ -19,14 +19,15 @@ If you are looking an amazing simple-to-use Stable Diffusion tool, I'd suggest [
### Fork does differ in few things
- New logger
- New installer
- New logger
- New error and exception handlers
- Built-in performance profiler
- Enhanced environment tuning
- Optimized startup and models lazy-loading
- Built-in performance profiler
- Updated libraries to latest known compatible versions
- Includes opinionated **System** and **Options** configuration
- Does not rely on `Accelerate` as it only affects distributed systems
- Optimized startup
Gradio web server will be initialized much earlier which model load is done in the background
Faster model loading plus ability to fallback on corrupt models
- Uses simplified folder structure
@@ -36,35 +37,18 @@ If you are looking an amazing simple-to-use Stable Diffusion tool, I'd suggest [
- Majority of settings configurable via UI without the need for command line flags
e.g, cross-optimization methods, system folders, etc.
### User Interface
- Includes updated **UI**: reskinned and reorganized
Black and orange dark theme with fixed width options panels and larger previews
### Optimizations
- Optimized for `Torch` 2.0
- Runs with `SDP` memory attention enabled by default if supported by system
*Note*: `xFormers` and other cross-optimization methods are still available
- Auto-adjust parameters when running on **CPU** or **CUDA**
*Note:* AMD and M1 platforms are supported, but without out-of-the-box optimizations
### Removed
- Drops compatibility with older versions of `python` and requires **3.9** or **3.10**
- Drops localizations
- Drops automated tests
### Integrated CLI/API tools
Fork adds extra functionality:
- New skin and UI layout
- Ships with set of **CLI** tools that rely on *SD API* for execution:
e.g. `generate`, `train`, `bench`, etc.
[Full list](<cli/>)
### Integrated Extensions
Hand-picked list of extensions that are deeply integrated into core workflows:
- [System Info](https://github.com/vladmandic/sd-extension-system-info)
- [ControlNet](https://github.com/Mikubill/sd-webui-controlnet)
- [Image Browser](https://github.com/AlUlkesh/stable-diffusion-webui-images-browser)
@@ -76,6 +60,26 @@ Fork adds extra functionality:
- [Steps Animation](https://github.com/vladmandic/sd-extension-steps-animation)
- [Seed Travel](https://github.com/yownas/seed_travel)
- [Model Keyword](https://github.com/mix1009/model-keyword)
- [Multi-Diffusion Upscaler](https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111)
### User Interface
- Includes updated **UI**: reskinned and reorganized
Black and orange dark theme with fixed width options panels and larger previews
### Removed
- Drops compatibility with older versions of `python` and requires **3.9** or **3.10**
- Drops localizations
### Integrated CLI/API tools
Fork adds extra functionality:
- New skin and UI layout
- Ships with set of **CLI** tools that rely on *SD API* for execution:
e.g. `generate`, `train`, `bench`, etc.
[Full list](<cli/>)
<br>
+2 -1
View File
@@ -7,7 +7,8 @@ Stuff to be fixed...
- Reconnect UI to ops in progress on browser restart
- Redo Extensions tab: see <https://vladmandic.github.io/sd-extension-manager/pages/extensions.html>
- Cleanup & integrate CSS into single file
- Replace EXIF metadata handler
- Allow user themes
- Replace PngInfo/EXIF metadata handler
- Pick & merge PRs from main repo
- Create new GitHub hooks/actions for CI/CD
- Investigate integration with `Torch-DirectML`
+1 -1
View File
@@ -9,7 +9,6 @@ basicsr
bitsandbytes
blendmodes
clean-fid
clip
easydev
extcolors
facexlib
@@ -29,6 +28,7 @@ lmdb
lpips
numpy
omegaconf
open-clip-torch
opencv-contrib-python
opencv-python
piexif
+23 -21
View File
@@ -51,11 +51,14 @@ def setup_logging(clean=False):
# check if package is installed
def installed(package):
def installed(package, friendly: str = None):
import pkg_resources
ok = True
try:
pkgs = [p for p in package.split() if not p.startswith('-') and not p.startswith('git+') and not p.startswith('http') and not p.startswith('=')]
if friendly:
pkgs = [friendly]
else:
pkgs = [p for p in package.split() if not p.startswith('-') and not p.startswith('git+') and not p.startswith('http') and not p.startswith('=')]
for pkg in pkgs:
p = pkg.split('==')
spec = pkg_resources.working_set.by_key.get(p[0], None) # more reliable than importlib
@@ -64,15 +67,15 @@ def installed(package):
if spec is None:
spec = pkg_resources.working_set.by_key.get(p[0].replace('_', '-'), None) # check name variations
ok = ok and spec is not None
if ok and len(p) > 1:
if ok:
version = pkg_resources.get_distribution(p[0]).version
ok = ok and version == p[1]
if not ok:
log.warning(f"Package wrong version found: {p[0]} {version} required {p[1]}")
# if ok:
# log.debug(f"Package already installed: {p[0]} {version}")
# else:
# log.debug(f"Package not installed: {p[0]} {version}")
log.debug(f"Package version found: {p[0]} {version}")
if len(p) > 1:
ok = ok and version == p[1]
if not ok:
log.warning(f"Package wrong version: {p[0]} required {p[1]}")
else:
log.debug(f"Package version not found: {p[0]}")
return ok
except ModuleNotFoundError:
log.debug(f"Package not installed: {pkgs}")
@@ -80,7 +83,7 @@ def installed(package):
# install package using pip if not already installed
def install(package):
def install(package, friendly: str = None):
def pip(arg: str):
log.debug(f"Running pip: {arg}")
result = subprocess.run(f'"{sys.executable}" -m pip {arg}', shell=True, check=False, env=os.environ, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -94,7 +97,7 @@ def install(package):
log.debug(f'Pip output: {txt}')
return txt
if not installed(package):
if not installed(package, friendly):
pip(f"install --upgrade {package}")
@@ -182,12 +185,12 @@ def check_torch():
# install required packages
def install_packages():
log.info('Installing packages')
gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379")
# gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379")
# openclip_package = os.environ.get('OPENCLIP_PACKAGE', "git+https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b")
# install(gfpgan_package, 'gfpgan')
# install(openclip_package, 'open-clip-torch')
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")
install(gfpgan_package)
install(clip_package)
install(openclip_package)
install(clip_package, 'clip')
try:
xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers')
install(f'--no-deps {xformers_package}')
@@ -310,7 +313,7 @@ def set_environment():
def check_extensions():
newest_all = 0
newest_all = os.path.getmtime('requirements.txt')
for folder in ['extensions-builtin', 'extensions']:
extensions_dir = os.path.join(os.path.dirname(__file__), folder)
extensions = list_extensions(extensions_dir)
@@ -369,9 +372,7 @@ def check_timestamp():
lines = f.readlines()
for line in lines:
if 'Setup complete without errors' in line:
setup_time = line.split(' ')[0]
return True
# setup_time = os.path.getmtime('setup.log')
setup_time = int(line.split(' ')[-1])
version_time = int(git('log -1 --pretty=format:"%at"'))
log.debug(f'Repository update time: {time.ctime(int(version_time))}')
if setup_time == -1:
@@ -380,6 +381,7 @@ def check_timestamp():
if setup_time < version_time:
return False
extension_time = check_extensions()
log.debug(f'Latest extensions time: {time.ctime(extension_time)}')
if setup_time < extension_time:
return False
return True