Add files via upload

This commit is contained in:
leafspark 2024-08-02 21:55:57 -07:00 committed by GitHub
parent 108e30f1f9
commit c6ae2e319c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 23 additions and 17 deletions

View File

@ -1,29 +1,24 @@
# AutoGGUF - automated GGUF model quantizer AutoGGUF - Automated GGUF Model Quantizer
This application provides a graphical user interface for quantizing GGUF models This application provides a graphical user interface for quantizing GGUF models
using the llama.cpp library. It allows users to download different versions of using the llama.cpp library. It allows users to download different versions of
llama.cpp, manage multiple backends, and perform quantization tasks with various llama.cpp, manage multiple backends, and perform quantization tasks with various
options. options.
**Main features**: Main features:
1. Download and manage llama.cpp backends 1. Download and manage llama.cpp backends
2. Select and quantize GGUF models 2. Select and quantize GGUF models
3. Configure quantization parameters 3. Configure quantization parameters
4. Monitor system resources during quantization 4. Monitor system resources during quantization
**Usage**: Usage:
1. Install dependencies, either using the `requirements.txt` file or `pip install PyQt6 requests psutil`. Run the main.py script to start the application.
2. Run the `run.bat` script to start the application, or run the command `python src/main.py`.
**Dependencies**: Dependencies:
- PyQt6 - PyQt6
- requests - requests
- psutil - psutil
**To be implemented:** Author: leafspark
- Actual progress bar tracking Version: 1.0.0
- Download safetensors from HF and convert to unquanted GGUF License: apache-2.0
- Specify multiple KV overrides
**User interface:**
![image](https://github.com/user-attachments/assets/b1b58cba-4314-479d-a1d8-21ca0b5a8935)

View File

@ -1,2 +1,3 @@
@echo off @echo off
set PYTHONIOENCODING=utf-8
python src/main.py python src/main.py

View File

@ -531,7 +531,7 @@ def show_task_details(self, item):
# Load existing content # Load existing content
if os.path.exists(task_item.log_file): if os.path.exists(task_item.log_file):
with open(task_item.log_file, 'r') as f: with open_file_safe(task_item.log_file, 'r') as f:
log_text.setPlainText(f.read()) log_text.setPlainText(f.read())
# Connect to the thread if it's still running # Connect to the thread if it's still running

View File

@ -11,7 +11,9 @@
import platform import platform
import requests import requests
import zipfile import zipfile
import traceback
from datetime import datetime from datetime import datetime
from imports_and_globals import open_file_safe
class QuantizationThread(QThread): class QuantizationThread(QThread):
output_signal = pyqtSignal(str) output_signal = pyqtSignal(str)
@ -32,7 +34,7 @@ def run(self):
try: try:
self.process = subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, self.process = subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
text=True, cwd=self.cwd) text=True, cwd=self.cwd)
with open(self.log_file, 'w') as log: with open_file_safe(self.log_file, 'w') as log:
for line in self.process.stdout: for line in self.process.stdout:
line = line.strip() line = line.strip()
self.output_signal.emit(line) self.output_signal.emit(line)
@ -40,7 +42,6 @@ def run(self):
log.flush() log.flush()
self.status_signal.emit("In Progress") self.status_signal.emit("In Progress")
self.parse_model_info(line) self.parse_model_info(line)
self.process.wait() self.process.wait()
if self.process.returncode == 0: if self.process.returncode == 0:
self.status_signal.emit("Completed") self.status_signal.emit("Completed")

View File

@ -18,4 +18,13 @@
def ensure_directory(path): def ensure_directory(path):
if not os.path.exists(path): if not os.path.exists(path):
os.makedirs(path) os.makedirs(path)
def open_file_safe(file_path, mode='r'):
encodings = ['utf-8', 'latin-1', 'ascii', 'utf-16']
for encoding in encodings:
try:
return open(file_path, mode, encoding=encoding)
except UnicodeDecodeError:
continue
raise ValueError(f"Unable to open file {file_path} with any of the encodings: {encodings}")