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

View File

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

View File

@ -531,7 +531,7 @@ def show_task_details(self, item):
# Load existing content
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())
# Connect to the thread if it's still running

View File

@ -11,7 +11,9 @@
import platform
import requests
import zipfile
import traceback
from datetime import datetime
from imports_and_globals import open_file_safe
class QuantizationThread(QThread):
output_signal = pyqtSignal(str)
@ -32,7 +34,7 @@ def run(self):
try:
self.process = subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
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:
line = line.strip()
self.output_signal.emit(line)
@ -40,7 +42,6 @@ def run(self):
log.flush()
self.status_signal.emit("In Progress")
self.parse_model_info(line)
self.process.wait()
if self.process.returncode == 0:
self.status_signal.emit("Completed")

View File

@ -18,4 +18,13 @@
def ensure_directory(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}")