refactor: use localization keys for HF conversion

- reduce base class length
- reorganize English, French, and Simplified Chinese
This commit is contained in:
BuildTools 2024-08-05 19:21:30 -07:00
parent c0635936cc
commit 6070aac200
No known key found for this signature in database
GPG Key ID: 3270C066C15D530B
2 changed files with 505 additions and 576 deletions

View File

@ -837,15 +837,15 @@ def delete_lora_adapter_item(self, adapter_widget):
break
def browse_hf_model_input(self):
self.logger.info("Browsing for HuggingFace model directory")
self.logger.info(BROWSE_FOR_HF_MODEL_DIRECTORY)
model_dir = QFileDialog.getExistingDirectory(self, SELECT_HF_MODEL_DIRECTORY)
if model_dir:
self.hf_model_input.setText(os.path.abspath(model_dir))
def browse_hf_outfile(self):
self.logger.info("Browsing for HuggingFace to GGUF output file")
self.logger.info(BROWSE_FOR_HF_TO_GGUF_OUTPUT)
outfile, _ = QFileDialog.getSaveFileName(
self, "Select Output File", "", "GGUF Files (*.gguf)"
self, SELECT_OUTPUT_FILE, "", GGUF_FILES
)
if outfile:
self.hf_outfile.setText(os.path.abspath(outfile))
@ -1425,7 +1425,7 @@ def load_models(self):
# Add sharded models
for base_name, shards in sharded_models.items():
parent_item = QTreeWidgetItem(self.model_tree)
parent_item.setText(0, f"{base_name} (sharded)")
parent_item.setText(0, f"{base_name} ({SHARDED})")
# Sort shards by shard number and get the first one
first_shard = sorted(shards, key=lambda x: x[0])[0][1]
parent_item.setData(0, Qt.ItemDataRole.UserRole, first_shard)

File diff suppressed because it is too large Load Diff