Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FLUX scheduler #2896

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions xinference/model/image/stable_diffusion/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,17 @@ def _get_scheduler(model: Any, sampler_name: str):
else:
raise ValueError(f"Unknown sampler: {sampler_name}")

@staticmethod
@contextlib.contextmanager
def _reset_when_done(model: Any, sampler_name: str):
def _reset_when_done(self, model: Any, sampler_name: str):
assert model is not None
if self._model_spec is None:
is_flux_sampler = False
else:
is_flux_sampler = "FLUX" in self._model_spec.model_name
scheduler = DiffusionModel._get_scheduler(model, sampler_name)
if scheduler:
# When the model is not flux
should_swap_scheduler = scheduler is not None and not is_flux_sampler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to name a better one, maybe ignore_setting_scheduler.

if should_swap_scheduler:
default_scheduler = model.scheduler
model.scheduler = scheduler
try:
Expand Down
Loading