Skip to content

Commit

Permalink
update diffusers and register mask_processor
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Mandic <[email protected]>
  • Loading branch information
vladmandic committed Jan 6, 2025
1 parent 61f605b commit 19d56d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,15 @@ def check_python(supported_minors=[9, 10, 11, 12], reason=None):
def check_diffusers():
if args.skip_all or args.skip_git:
return
sha = '6dfaec348780c6153a4cfd03a01972a291d67f82' # diffusers commit hash
sha = 'b5726358cf125f2fa1a596dce321e91a225a57e4' # diffusers commit hash
pkg = pkg_resources.working_set.by_key.get('diffusers', None)
minor = int(pkg.version.split('.')[1] if pkg is not None else 0)
cur = opts.get('diffusers_version', '') if minor > 0 else ''
if (minor == 0) or (cur != sha):
log.info(f'Diffusers {"install" if minor == 0 else "upgrade"}: package={pkg} current={cur} target={sha}')
if minor > 0:
if minor == 0:
log.info(f'Diffusers install: commit={sha}')
else:
log.info(f'Diffusers update: package={pkg} current={cur} target={sha}')
pip('uninstall --yes diffusers', ignore=True, quiet=True, uv=False)
pip(f'install --upgrade git+https://github.com/huggingface/diffusers@{sha}', ignore=False, quiet=True, uv=False)
global diffusers_commit # pylint: disable=global-statement
Expand Down
3 changes: 3 additions & 0 deletions modules/sd_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,7 @@ def set_diffuser_pipe(pipe, new_pipe_type):
default_scheduler = getattr(pipe, "default_scheduler", None)
image_encoder = getattr(pipe, "image_encoder", None)
feature_extractor = getattr(pipe, "feature_extractor", None)
mask_processor = getattr(pipe, "mask_processor", None)

if new_pipe is None:
if hasattr(pipe, 'config'): # real pipeline which can be auto-switched
Expand Down Expand Up @@ -1289,6 +1290,8 @@ def set_diffuser_pipe(pipe, new_pipe_type):
new_pipe.image_encoder = image_encoder
if feature_extractor is not None:
new_pipe.feature_extractor = feature_extractor
if mask_processor is not None:
new_pipe.mask_processor = mask_processor
if new_pipe.__class__.__name__ in ['FluxPipeline', 'StableDiffusion3Pipeline']:
new_pipe.register_modules(image_encoder = image_encoder)
new_pipe.register_modules(feature_extractor = feature_extractor)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ invisible-watermark
pi-heif

# versioned
safetensors==0.4.5
safetensors==0.5.0
tensordict==0.1.2
peft==0.14.0
httpx==0.24.1
Expand Down

0 comments on commit 19d56d3

Please sign in to comment.