Skip to content

Commit

Permalink
correct solution to crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Lincoln Stein authored and hipsterusername committed Aug 25, 2023
1 parent 3d2a5b2 commit a8eae4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
16 changes: 4 additions & 12 deletions invokeai/backend/install/invokeai_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@

# TO DO - Move all the frontend code into invokeai.frontend.install
from invokeai.frontend.install.widgets import (
SingleSelectColumns,
SingleSelectColumnsSimple,
MultiSelectColumns,
CenteredButtonPress,
Expand Down Expand Up @@ -409,7 +408,7 @@ def create(self):
SingleSelectColumnsSimple,
columns=len(DEVICE_CHOICES),
values=DEVICE_CHOICES,
value=DEVICE_CHOICES.index(device),
value=[DEVICE_CHOICES.index(device)],
begin_entry_at=3,
relx=30,
max_height=2,
Expand All @@ -429,7 +428,7 @@ def create(self):
SingleSelectColumnsSimple,
columns=len(ATTENTION_CHOICES),
values=ATTENTION_CHOICES,
value=ATTENTION_CHOICES.index(attention_type),
value=[ATTENTION_CHOICES.index(attention_type)],
begin_entry_at=3,
max_height=2,
relx=30,
Expand All @@ -451,14 +450,13 @@ def create(self):
SingleSelectColumnsSimple,
columns=len(ATTENTION_SLICE_CHOICES),
values=ATTENTION_SLICE_CHOICES,
value=ATTENTION_SLICE_CHOICES.index(attention_slice_size),
value=[ATTENTION_SLICE_CHOICES.index(attention_slice_size)],
relx=30,
hidden=attention_type != "sliced",
max_height=2,
max_width=110,
scroll_exit=True,
)

self.add_widget_intelligent(
npyscreen.TitleFixedText,
name="Model RAM cache size (GB). Make this at least large enough to hold a single full model.",
Expand Down Expand Up @@ -609,13 +607,7 @@ def marshall_arguments(self):
new_opts.precision = PRECISION_CHOICES[self.precision.value[0]]
new_opts.device = DEVICE_CHOICES[self.device.value[0]]
new_opts.attention_type = ATTENTION_CHOICES[self.attention_type.value[0]]

# some sort of bug in npyscreen?
attention_slice_value = self.attention_slice_size.value
if type(attention_slice_value) == list:
attention_slice_value = attention_slice_value[0]
new_opts.attention_slice_size = ATTENTION_SLICE_CHOICES[attention_slice_value]

new_opts.attention_slice_size = ATTENTION_SLICE_CHOICES[self.attention_slice_size.value[0]]
generation_options = [GENERATION_OPT_CHOICES[x] for x in self.generation_options.value]
for v in GENERATION_OPT_CHOICES:
setattr(new_opts, v, v in generation_options)
Expand Down
7 changes: 4 additions & 3 deletions invokeai/frontend/install/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,15 @@ def h_select(self, ch):


class SingleSelectColumnsSimple(SelectColumnBase, SingleSelectWithChanged):
"""Row of radio buttons. Spacebar to select."""

def __init__(self, screen, columns: int = 1, values: list = [], **keywords):
self.columns = columns
self.value_cnt = len(values)
self.rows = math.ceil(self.value_cnt / self.columns)
self.on_changed = None
super().__init__(screen, values=values, **keywords)

def when_value_edited(self):
self.h_select(self.cursor_line)

def h_cursor_line_right(self, ch):
self.h_exit_down("bye bye")

Expand All @@ -282,6 +281,8 @@ def h_cursor_line_left(self, ch):


class SingleSelectColumns(SingleSelectColumnsSimple):
"""Row of radio buttons. When tabbing over a selection, it is auto selected."""

def when_cursor_moved(self):
self.h_select(self.cursor_line)

Expand Down

0 comments on commit a8eae4f

Please sign in to comment.