Skip to content

Commit c95c6c5

Browse files
authored
Make the merge script work again (invoke-ai#4979)
## What type of PR is this? (check all applicable) - [ ] Refactor - [ ] Feature - [X] Bug Fix - [ ] Optimization - [ ] Documentation Update - [ ] Community Node Submission ## Have you discussed this change with the InvokeAI team? - [ ] Yes - [X] No, because n/a ## Have you updated all relevant documentation? - [X] Yes - [ ] No ## Description The introduction of `BaseModelType.Any` broke the code in the merge script which relied on sd-1 coming first in the BaseModelType enum. This assumption has been removed and the code should be less brittle now. ## Related Tickets & Documents <!-- For pull requests that relate or close an issue, please include them below. For example having the text: "closes invoke-ai#1234" would connect the current pull request to issue 1234. And when we merge the pull request, Github will automatically close the issue. --> - Related Issue # - Closes # ## QA Instructions, Screenshots, Recordings <!-- Please provide steps on how to test changes, any hardware or software specifications as well as any other pertinent information. --> ## Added/updated tests? - [ ] Yes - [ ] No : _please replace this line with details on why tests have not been included_ ## [optional] Are there any post deployment tasks we need to perform?
2 parents 48fc07e + d946cb7 commit c95c6c5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

invokeai/frontend/merge/merge_diffusers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def create(self):
131131
values=[
132132
"Models Built on SD-1.x",
133133
"Models Built on SD-2.x",
134+
"Models Built on SDXL",
134135
],
135136
value=[self.current_base],
136137
columns=4,
@@ -309,7 +310,7 @@ def validate_field_values(self) -> bool:
309310
else:
310311
return True
311312

312-
def get_model_names(self, base_model: Optional[BaseModelType] = None) -> List[str]:
313+
def get_model_names(self, base_model: BaseModelType = BaseModelType.StableDiffusion1) -> List[str]:
313314
model_names = [
314315
info["model_name"]
315316
for info in self.model_manager.list_models(model_type=ModelType.Main, base_model=base_model)
@@ -318,7 +319,8 @@ def get_model_names(self, base_model: Optional[BaseModelType] = None) -> List[st
318319
return sorted(model_names)
319320

320321
def _populate_models(self, value=None):
321-
base_model = tuple(BaseModelType)[value[0]]
322+
bases = ["sd-1", "sd-2", "sdxl"]
323+
base_model = BaseModelType(bases[value[0]])
322324
self.model_names = self.get_model_names(base_model)
323325

324326
models_plus_none = self.model_names.copy()

0 commit comments

Comments
 (0)