mirror of
https://github.com/Pakobbix/StartUI-oobabooga-webui
synced 2025-11-09 21:49:39 +00:00
Compare commits
No commits in common. "d1de11ecf4ff34611e5ae6e4f2988a0195168883" and "58772e86f6a61072b55253a59110f941350df9a1" have entirely different histories.
d1de11ecf4
...
58772e86f6
45
StartUI.py
45
StartUI.py
@ -16,11 +16,6 @@ extensions_folder = "./text-generation-webui/extensions"
|
||||
loras_folder = "./text-generation-webui/loras"
|
||||
characters_folder = "./text-generation-webui/characters"
|
||||
|
||||
if getattr(sys, 'frozen', False):
|
||||
webui_file = sys._MEIPASS + '/webuiGUI.py'
|
||||
else:
|
||||
webui_file = 'webuiGUI.py'
|
||||
|
||||
# Get the current Max CPU threads to use, so the user can't exceed his thread count.
|
||||
max_threads = psutil.cpu_count(logical=True)
|
||||
|
||||
@ -159,7 +154,7 @@ class MainWindow(QMainWindow):
|
||||
self.Accelerate_settings_checkbox.stateChanged.connect(self.on_Accelerate_settings_checkbox_stateChanged)
|
||||
toolbar.addWidget(self.Accelerate_settings_checkbox)
|
||||
if platform.system() == 'Windows':
|
||||
self.Accelerate_settings_checkbox.setEnabled(False)
|
||||
#self.Accelerate_settings_checkbox.setEnabled(False)
|
||||
self.Accelerate_settings_checkbox.setToolTip("Accelerate is not Supported in Windows.")
|
||||
|
||||
################################################
|
||||
@ -1525,6 +1520,7 @@ class MainWindow(QMainWindow):
|
||||
"use_cpu": self.cpu_radio_button.isChecked(), # Save the state of the CPU radio button
|
||||
"use_auto": self.auto_radio_button.isChecked(), # Save the state of the auto device radio button
|
||||
"built_in_ram": self.ram_slider.value(), # Save the value of the built-in RAM slider
|
||||
#"prelayer": self.pre_layer_value_label.text(), # Saves the Prelayer value
|
||||
"use_8bit": self.use_8bit_checkbox.isChecked(), # Saves the state of the 8bit checkbox
|
||||
"no_stream": self.use_nostream_checkbox.isChecked(), # Saves the state of the no_stream checkbox
|
||||
"use_16bit": self.use_16bit_checkbox.isChecked(), # Saves the state of the use_16bit checkbox
|
||||
@ -1538,11 +1534,6 @@ class MainWindow(QMainWindow):
|
||||
"sdp_attention": self.use_sdp_attention_checkbox.isChecked(), # Saves the state of the sdp_attention checkbox
|
||||
"autogptq": self.use_autogptq_checkbox.isChecked(), # Saves the state of the autogptq checkbox
|
||||
"triton": self.use_triton_checkbox.isChecked(), # Saves the state of the triton checkbox
|
||||
"acceleration": self.Accelerate_settings_checkbox.isChecked(), # Saves the state of the Accelerate checkbox
|
||||
"use_4bit": self.accelerate4bit_checkbox.isChecked(), # Saves the state of the accelerate4bit checkbox
|
||||
"compute_dtype": self.accelerate4bit_compute_type_dropdown.currentText(), # Saves the state of the accelerate4bit_compute_type_dropdown
|
||||
"quant_type": self.accelerate4bit_quant_type_dropdown.currentText(), # Saves the state of the accelerate4bit_quant_type_dropdown
|
||||
"use_x2_quant": self.accelerate4bit_double_quant_checkbox.isChecked(), # Saves the state of the accelerate4bit_double_quant_checkbox
|
||||
"deepspeed": self.deepspeed_settings_checkbox.isChecked(), # Saves the state of the deepspeed checkbox
|
||||
"deepspeed_enabled": self.deepspeed_checkbox.isChecked(), # Saves the state of the deepspeed checkbox
|
||||
"deepspeed_gpu_num": self.deepspeed_gpu_num_spinbox.value(), # Saves the state of the deepspeed_gpu_num_spinbox
|
||||
@ -1612,6 +1603,7 @@ class MainWindow(QMainWindow):
|
||||
|
||||
def expression_check(self, command):
|
||||
selected_model = self.model_dropdown.currentText()
|
||||
#print(f"Selected model: {selected_model}")
|
||||
|
||||
# Use a regular expression to check if the selected model matches the pattern
|
||||
if re.search(r".*mpt.*7b", selected_model, re.IGNORECASE):
|
||||
@ -1657,8 +1649,9 @@ class MainWindow(QMainWindow):
|
||||
command += f" --model {chosen_model}"
|
||||
|
||||
# Add the chosen model type to the command
|
||||
chosen_model_type = self.model_type.currentText()
|
||||
if self.model_type.currentText() != "none" and self.model_dropdown.currentText() != "none":
|
||||
command += f" --model_type {self.model_type.currentText()}"
|
||||
command += f" --model_type {chosen_model_type}"
|
||||
|
||||
# Add loras to the command
|
||||
loras = [self.lora_list.item(i).text() for i in range(self.lora_list.count()) if self.lora_list.item(i).checkState() == Qt.Checked]
|
||||
@ -1667,18 +1660,22 @@ class MainWindow(QMainWindow):
|
||||
command += f" --lora {' '.join(loras)}"
|
||||
|
||||
# Add Characters to the command
|
||||
chosen_characters = self.character_to_load.currentText()
|
||||
if self.character_to_load.currentText() != "none":
|
||||
command += f" --character {self.character_to_load.currentText()}"
|
||||
command += f" --character {chosen_characters}"
|
||||
print(chosen_characters)
|
||||
|
||||
# Adds wbits to the command, if not "none"
|
||||
chosen_wbits = self.wbit_dropdown.currentText()
|
||||
if self.wbit_dropdown.currentText() != "none":
|
||||
if not self.cpu_radio_button.isChecked() and self.model_dropdown.currentText() != "none":
|
||||
command += f" --wbits {self.wbit_dropdown.currentText()}"
|
||||
command += f" --wbits {chosen_wbits}"
|
||||
|
||||
# Adds Groupsize to the command, if not "none"
|
||||
chosen_gsize = self.gsize_dropdown.currentText()
|
||||
if self.gsize_dropdown.currentText() != "none":
|
||||
if not self.cpu_radio_button.isChecked() and self.model_dropdown.currentText() != "none":
|
||||
command += f" --groupsize {self.gsize_dropdown.currentText()}"
|
||||
command += f" --groupsize {chosen_gsize}"
|
||||
|
||||
# Add the chosen mode to the command (Chat, cai-chat, notebook)
|
||||
chosen_mode = self.mode_dropdown.currentText()
|
||||
@ -1753,10 +1750,10 @@ class MainWindow(QMainWindow):
|
||||
if self.accelerate4bit_checkbox.isChecked():
|
||||
command += " --load-in-4bit"
|
||||
|
||||
if self.accelerate4bit_compute_type_dropdown.currentText() != "none":
|
||||
if self.accelerate4bit_compute_type_dropdown != "none":
|
||||
command += f" --compute_dtype {self.accelerate4bit_compute_type_dropdown.currentText()}"
|
||||
|
||||
if self.accelerate4bit_quant_type_dropdown.currentText() != "none":
|
||||
if self.accelerate4bit_quant_type_dropdown != "none":
|
||||
command += f" --quant_type {self.accelerate4bit_quant_type_dropdown.currentText()}"
|
||||
|
||||
if self.accelerate4bit_double_quant_checkbox.isChecked():
|
||||
@ -1808,6 +1805,7 @@ class MainWindow(QMainWindow):
|
||||
# If AutoGPTQ is checked
|
||||
if self.use_autogptq_checkbox.isChecked():
|
||||
command += " --autogptq"
|
||||
run_cmd_with_conda("pip install auto_gptq && exit")
|
||||
|
||||
# If triton is checked
|
||||
if self.use_triton_checkbox.isChecked():
|
||||
@ -1830,7 +1828,7 @@ class MainWindow(QMainWindow):
|
||||
command += f" --api-streaming-port {self.api_streaming_port_SpinBox.text()}"
|
||||
|
||||
# Just for debugging.
|
||||
print(f"Command generated: python {webui_file} {command}")
|
||||
print(f"Command generated: python webuiGUI.py {command}")
|
||||
|
||||
# Based on the Model that's chosen, we will take care of some necessary stuff.
|
||||
# Starts the webui in the conda env with the user given Options
|
||||
@ -1850,15 +1848,15 @@ class MainWindow(QMainWindow):
|
||||
|
||||
if not self.deepspeed_checkbox.isChecked():
|
||||
if self.use_8bit_checkbox.isChecked():
|
||||
run_cmd_with_conda(f"pip install accelerate && python {webui_file} {command}")
|
||||
run_cmd_with_conda(f"pip install accelerate && python webuiGUI.py {command}")
|
||||
else:
|
||||
run_cmd_with_conda(f"python {webui_file} {command}")
|
||||
run_cmd_with_conda(f"python webuiGUI.py {command}")
|
||||
|
||||
if self.use_autoclose_checkbox.isChecked():
|
||||
sys.exit()
|
||||
|
||||
def on_update_button_clicked(self):
|
||||
run_cmd_with_conda(f"python {webui_file} --update && exit")
|
||||
run_cmd_with_conda("python webuiGUI.py --update && exit")
|
||||
|
||||
def load_profile(self, profile_file):
|
||||
with open(profile_file, "r") as file:
|
||||
@ -1911,11 +1909,6 @@ class MainWindow(QMainWindow):
|
||||
self.use_sdp_attention_checkbox.setChecked(settings.get("sdp_attention", False))
|
||||
self.use_autogptq_checkbox.setChecked(settings.get("autogptq", False))
|
||||
self.use_triton_checkbox.setChecked(settings.get("triton", False))
|
||||
self.Accelerate_settings_checkbox.setChecked(settings.get("acceleration", False))
|
||||
self.accelerate4bit_checkbox.setChecked(settings.get("use_4bit", False))
|
||||
self.accelerate4bit_compute_type_dropdown.setCurrentText(settings.get("compute_dtype", ""))
|
||||
self.accelerate4bit_quant_type_dropdown.setCurrentText(settings.get("quant_type", ""))
|
||||
self.accelerate4bit_double_quant_checkbox.setChecked(settings.get("use_x2_quant", False))
|
||||
self.deepspeed_settings_checkbox.setChecked(settings.get("deepspeed", False))
|
||||
self.deepspeed_checkbox.setChecked(settings.get("deepspeed_enabled", False))
|
||||
self.deepspeed_gpu_num_spinbox.setValue(int(settings.get("deepspeed_gpu_num", 0)))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user