-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
303 additions
and
67 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
src/airunner/widgets/memory_preferences/memory_preferences_widget.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
from airunner.widgets.base_widget import BaseWidget | ||
from airunner.widgets.memory_preferences.templates.memory_preferences_ui import Ui_memory_preferences | ||
|
||
|
||
class MemoryPreferencesWidget(BaseWidget): | ||
widget_class_ = Ui_memory_preferences | ||
|
||
def __init__(self, **kwargs): | ||
super().__init__(**kwargs) | ||
|
||
self.ui.use_accelerated_transformers.blockSignals(True) | ||
self.ui.use_attention_slicing.blockSignals(True) | ||
self.ui.use_enable_sequential_cpu_offload.blockSignals(True) | ||
self.ui.enable_model_cpu_offload.blockSignals(True) | ||
self.ui.use_lastchannels.blockSignals(True) | ||
self.ui.use_tf32.blockSignals(True) | ||
self.ui.use_tiled_vae.blockSignals(True) | ||
self.ui.use_enable_vae_slicing.blockSignals(True) | ||
|
||
self.ui.use_accelerated_transformers.setChecked(self.settings_manager.memory_settings.use_accelerated_transformers is True) | ||
self.ui.use_attention_slicing.setChecked(self.settings_manager.memory_settings.use_attention_slicing is True) | ||
self.ui.use_enable_sequential_cpu_offload.setChecked( | ||
self.settings_manager.memory_settings.use_enable_sequential_cpu_offload is True) | ||
self.ui.enable_model_cpu_offload.setChecked( | ||
self.settings_manager.memory_settings.enable_model_cpu_offload is True | ||
) | ||
self.ui.use_lastchannels.setChecked(self.settings_manager.memory_settings.use_last_channels is True) | ||
self.ui.use_tf32.setChecked(self.settings_manager.memory_settings.use_tf32 is True) | ||
self.ui.use_tiled_vae.setChecked(self.settings_manager.memory_settings.use_tiled_vae is True) | ||
self.ui.use_enable_vae_slicing.setChecked(self.settings_manager.memory_settings.use_enable_vae_slicing is True) | ||
|
||
self.ui.use_accelerated_transformers.blockSignals(False) | ||
self.ui.use_attention_slicing.blockSignals(False) | ||
self.ui.use_enable_sequential_cpu_offload.blockSignals(False) | ||
self.ui.enable_model_cpu_offload.blockSignals(False) | ||
self.ui.use_lastchannels.blockSignals(False) | ||
self.ui.use_tf32.blockSignals(False) | ||
self.ui.use_tiled_vae.blockSignals(False) | ||
self.ui.use_enable_vae_slicing.blockSignals(False) | ||
|
||
def action_toggled_tile_vae(self, val): | ||
self.settings_manager.set_value("memory_settings.use_tiled_vae", val) | ||
|
||
def action_toggled_tf32(self, val): | ||
self.settings_manager.set_value("memory_settings.use_tf32", val) | ||
|
||
def action_toggled_last_memory(self, val): | ||
self.settings_manager.set_value("memory_settings.use_last_channels", val) | ||
|
||
def action_toggled_vae_slicing(self, val): | ||
self.settings_manager.set_value("memory_settings.use_enable_vae_slicing", val) | ||
|
||
def action_toggled_sequential_cpu_offload(self, val): | ||
self.settings_manager.set_value("memory_settings.use_enable_sequential_cpu_offload", val) | ||
|
||
def action_toggled_attention_slicing(self, val): | ||
self.settings_manager.set_value("memory_settings.use_attention_slicing", val) | ||
|
||
def action_toggled_accelerated_transformers(self, val): | ||
self.settings_manager.set_value("memory_settings.use_accelerated_transformers", val) | ||
|
||
def action_button_clicked_optimize_memory_settings(self): | ||
self.ui.use_accelerated_transformers.setChecked(True) | ||
self.ui.use_attention_slicing.setChecked(False) | ||
self.ui.use_lastchannels.setChecked(True) | ||
self.ui.use_enable_sequential_cpu_offload.setChecked(False) | ||
self.ui.enable_model_cpu_offload.setChecked(False) | ||
self.ui.use_tf32.setChecked(False) | ||
self.ui.use_tiled_vae.setChecked(True) | ||
self.ui.use_enable_vae_slicing.setChecked(True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.