mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix library problems in preload_modules
This commit is contained in:
parent
ab2b5a691d
commit
ef24d76adc
@ -6,6 +6,7 @@
|
|||||||
#
|
#
|
||||||
# Coauthor: Kevin Turner http://github.com/keturn
|
# Coauthor: Kevin Turner http://github.com/keturn
|
||||||
#
|
#
|
||||||
|
print('Loading Python libraries...\n')
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
@ -17,15 +18,14 @@ from pathlib import Path
|
|||||||
import traceback
|
import traceback
|
||||||
import getpass
|
import getpass
|
||||||
import requests
|
import requests
|
||||||
|
import clip
|
||||||
|
import transformers
|
||||||
|
import torch
|
||||||
|
transformers.logging.set_verbosity_error()
|
||||||
|
|
||||||
# deferred loading so that help message can be printed quickly
|
# deferred loading so that help message can be printed quickly
|
||||||
def load_libs():
|
def load_libs():
|
||||||
print('Loading Python libraries...\n')
|
pass
|
||||||
import clip
|
|
||||||
import transformers
|
|
||||||
import torch
|
|
||||||
import zipfile
|
|
||||||
transformers.logging.set_verbosity_error()
|
|
||||||
|
|
||||||
#--------------------------globals--
|
#--------------------------globals--
|
||||||
Model_dir = './models/ldm/stable-diffusion-v1/'
|
Model_dir = './models/ldm/stable-diffusion-v1/'
|
||||||
@ -473,12 +473,14 @@ def download_codeformer():
|
|||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
def download_clipseg():
|
def download_clipseg():
|
||||||
print('Installing clipseg model for text-based masking...',end='')
|
print('Installing clipseg model for text-based masking...',end='')
|
||||||
|
import zipfile
|
||||||
try:
|
try:
|
||||||
model_url = 'https://owncloud.gwdg.de/index.php/s/ioHbRzFx6th32hn/download'
|
model_url = 'https://owncloud.gwdg.de/index.php/s/ioHbRzFx6th32hn/download'
|
||||||
model_dest = 'src/clipseg/clipseg_weights.zip'
|
model_dest = 'src/clipseg/clipseg_weights.zip'
|
||||||
weights_dir = 'src/clipseg/weights'
|
weights_dir = 'src/clipseg/weights'
|
||||||
if not os.path.exists(weights_dir):
|
if not os.path.exists(weights_dir):
|
||||||
os.makedirs(os.path.dirname(model_dest), exist_ok=True)
|
os.makedirs(os.path.dirname(model_dest), exist_ok=True)
|
||||||
|
if not os.path.exists('src/clipseg/weights/rd64-uni-refined.pth'):
|
||||||
request.urlretrieve(model_url,model_dest)
|
request.urlretrieve(model_url,model_dest)
|
||||||
with zipfile.ZipFile(model_dest,'r') as zip:
|
with zipfile.ZipFile(model_dest,'r') as zip:
|
||||||
zip.extractall('src/clipseg')
|
zip.extractall('src/clipseg')
|
||||||
|
Loading…
Reference in New Issue
Block a user