rehost clip-interrogator and update installer

pull/1609/head
Vladimir Mandic 2023-07-07 21:54:21 -04:00
parent 0f4f8c6015
commit 5bf3d229d0
13 changed files with 48 additions and 39 deletions

2
.gitmodules vendored
View File

@ -18,7 +18,7 @@
ignore = dirty
[submodule "extensions-builtin/clip-interrogator-ext"]
path = extensions-builtin/clip-interrogator-ext
url = https://github.com/pharmapsychotic/clip-interrogator-ext.git
url = https://github.com/Dahvikiin/clip-interrogator-ext.git
ignore = dirty
[submodule "extensions-builtin/sd-webui-controlnet"]
path = extensions-builtin/sd-webui-controlnet

View File

@ -60,4 +60,6 @@ Tech that can be integrated as part of the core workflow...
- git-rebasin
- additional upscalers
- new image browser
- fp8
- `fp8`
- update `transformers`
- `git submodule set-url extensions-builtin/clip-interrogator-ext https://github.com/Dahvikiin/clip-interrogator-ext.git`

View File

@ -958,7 +958,7 @@ class LatentDiffusionV1(DDPMV1):
cond_list = [{'c_crossattn': [e]} for e in adapted_cond]
else:
cond_list = [cond for i in range(z.shape[-1])] # Todo make this more efficient
cond_list = [cond for i in range(z.shape[-1])]
# apply model by loop over crops
output_list = [self.model(z_list[i], t, **cond_list[i]) for i in range(z.shape[-1])]

@ -1 +1 @@
Subproject commit 123d1da15d802823480f8020312ce449523f10e2
Subproject commit 025dea96720197dd4486a5bb8e2f4d72a95a3088

@ -1 +1 @@
Subproject commit c0bf90052a14a104b2dbfd9b7e7818aae5ca5ae1
Subproject commit 6e31272e14308b4918f9785b1dda7cc1149e8838

@ -1 +1 @@
Subproject commit 5b13bfeeebee1fc984bfde4e3171b31e4eee5a6b
Subproject commit 9433a15b8965f9b0aa6a93cd44992f29de3f3e79

@ -1 +1 @@
Subproject commit 8198489fd42883d3af119e219c320ba4853802c8
Subproject commit 75ba093d46b37f2d01fa4207680a4fa6417b01c3

@ -1 +1 @@
Subproject commit 2785cbe61a61c137d4e980752771f6329b03612a
Subproject commit dd766de8629ee6035a734217e08c26cd1b08b2ab

View File

@ -208,25 +208,32 @@ def git(arg: str, folder: str = None, ignore: bool = False):
log.debug(f'Git output: {txt}')
return txt
# update switch to main branch as head can get detached and update repository
def update(folder):
# switch to main branch as head can get detached
def branch(folder):
if not os.path.exists(os.path.join(folder, '.git')):
return
branch = git('branch', folder)
if 'main' in branch:
branch = 'main'
elif 'master' in branch:
branch = 'master'
b = git('branch', folder)
if 'main' in b:
b = 'main'
elif 'master' in b:
b = 'master'
else:
branch = branch.split('\n')[0].replace('*', '').strip()
# log.debug(f'Setting branch: {folder} / {branch}')
git(f'checkout {branch}', folder)
b = b.split('\n')[0].replace('*', '').strip()
log.debug(f'Submodule: {folder} / {b}')
git(f'checkout {b}', folder, ignore=True)
return b
# update git repository
def update(folder, current_branch = False):
if current_branch:
git('pull --autostash --rebase --force', folder)
return
b = branch(folder)
if branch is None:
git('pull --autostash --rebase --force', folder)
else:
git(f'pull origin {branch} --autostash --rebase --force', folder)
# branch = git('branch', folder)
git(f'pull origin {b} --autostash --rebase --force', folder)
# clone git repository
@ -528,7 +535,7 @@ def install_submodules():
pr.enable()
log.info('Verifying submodules')
txt = git('submodule')
log.debug(f'Submodules list: {txt}')
# log.debug(f'Submodules list: {txt}')
if 'no submodule mapping found' in txt:
log.warning('Attempting repository recover')
git('add .')
@ -540,15 +547,16 @@ def install_submodules():
txt = git('submodule')
log.info('Continuing setup')
git('submodule --quiet update --init --recursive')
if args.upgrade:
log.info('Updating submodules')
submodules = txt.splitlines()
for submodule in submodules:
try:
name = submodule.split()[1].strip()
submodules = txt.splitlines()
for submodule in submodules:
try:
name = submodule.split()[1].strip()
if args.upgrade:
update(name)
except Exception:
log.error(f'Error updating submodule: {submodule}')
else:
branch(name)
except Exception:
log.error(f'Error updating submodule: {submodule}')
if args.profile:
print_profile(pr, 'Submodule')
@ -653,7 +661,7 @@ def check_version(offline=False, reset=True): # pylint: disable=unused-argument
try:
git('add .')
git('stash')
update('.')
update('.', current_branch=True)
# git('git stash pop')
ver = git('log -1 --pretty=format:"%h %ad"')
log.info(f'Upgraded to version: {ver}')

View File

@ -631,7 +631,7 @@ class LatentDiffusion(DDPM):
weighting = weighting * L_weighting
return weighting
def get_fold_unfold(self, x, kernel_size, stride, uf=1, df=1): # todo load once not every time, shorten code
def get_fold_unfold(self, x, kernel_size, stride, uf=1, df=1):
"""
:param x: img of size (bs, c, h, w)
:return: n img crops of size (n, bs, c, kernel_size[0], kernel_size[1])
@ -919,7 +919,7 @@ class LatentDiffusion(DDPM):
z_list = [z[:, :, :, :, i] for i in range(z.shape[-1])]
if self.cond_stage_key in ["image", "LR_image", "segmentation",
'bbox_img'] and self.model.conditioning_key: # todo check for completeness
'bbox_img'] and self.model.conditioning_key:
c_key = next(iter(cond.keys())) # get key
c = next(iter(cond.values())) # get value
assert (len(c) == 1) # todo extend to list with more than one elem
@ -973,12 +973,11 @@ class LatentDiffusion(DDPM):
cond_list = [{'c_crossattn': [e]} for e in adapted_cond]
else:
cond_list = [cond for i in range(z.shape[-1])] # Todo make this more efficient
cond_list = [cond for i in range(z.shape[-1])]
# apply model by loop over crops
output_list = [self.model(z_list[i], t, **cond_list[i]) for i in range(z.shape[-1])]
assert not isinstance(output_list[0],
tuple) # todo cant deal with multiple model outputs check this never happens
assert not isinstance(output_list[0], tuple)
o = torch.stack(output_list, axis=-1)
o = o * weighting

View File

@ -58,7 +58,7 @@ numba==0.57.0
pandas==1.5.3
protobuf==3.20.3
pytorch_lightning==1.9.4
transformers==4.26.1
transformers==4.30.2
timm==0.6.13
tomesd==0.1.3
urllib3==1.26.15

View File

@ -99,7 +99,7 @@ def get_matched_noise(_np_src_image, np_mask_rgb, noise_q=1, color_variation=0.0
shaped_noise_fft = _fft2(noise_rgb)
shaped_noise_fft[:, :, :] = np.absolute(shaped_noise_fft[:, :, :]) ** 2 * (src_dist ** noise_q) * src_phase # perform the actual shaping
brightness_variation = 0. # color_variation # todo: temporarily tieing brightness variation to color variation for now
brightness_variation = 0. # color_variation
contrast_adjusted_np_src = _np_src_image[:] * (brightness_variation + 1.) - brightness_variation * 2.
# scikit-image is used for histogram matching, very convenient!

2
wiki

@ -1 +1 @@
Subproject commit 28e3cc15ef4566564764fa73542ab6b00d2b0959
Subproject commit 503fa982cba22a33f3601f43fd255883167e421c