diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..64e80ad --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +venv/ +*.zip \ No newline at end of file diff --git a/CreateZip.ps1 b/CreateZip.ps1 index cefab0a..3b1a29c 100644 --- a/CreateZip.ps1 +++ b/CreateZip.ps1 @@ -1,5 +1,15 @@ +# Read VERSION from Python file +$versionLine = Get-Content "EasyQuantizationGUI.py" | Select-String "VERSION = " +if ($versionLine -match 'VERSION = "(.*?)"') { + $version = $matches[1] + Write-Host "Found version: $version" +} else { + Write-Host "WARNING: Version not found, using 'unknown'" + $version = "unknown" +} + # Define the zip file name and subdirectory name -$zipName = "EasyQuantizationGUI.zip" +$zipName = "EasyQuantizationGUI_v$version.zip" $subDirName = "EasyQuantizationGUI" # Get the current directory diff --git a/EasyQuantizationGUI.bat b/EasyQuantizationGUI.bat index 5ce1c9e..0ce4842 100644 --- a/EasyQuantizationGUI.bat +++ b/EasyQuantizationGUI.bat @@ -1 +1,30 @@ -python EasyQuantizationGUI.py \ No newline at end of file +@echo off +REM Check if pip is installed and show output only if it needs to be installed +python -m pip --version >nul 2>&1 +if %ERRORLEVEL% neq 0 ( + echo Installing pip... + python -m ensurepip --default-pip +) else ( + python -m pip install --upgrade pip >nul 2>&1 +) + +REM Check if virtual environment exists, create if it doesn't +if not exist "venv" ( + echo Creating virtual environment... + python -m venv venv + call venv\Scripts\activate + echo Installing requirements... + pip install -r requirements.txt + echo Setup complete! + echo. +) else ( + call venv\Scripts\activate +) + +REM Run the application +python EasyQuantizationGUI.py + +REM Keep the window open if there's an error +if %ERRORLEVEL% neq 0 ( + pause +) \ No newline at end of file diff --git a/EasyQuantizationGUI.py b/EasyQuantizationGUI.py index b6c238c..d31c79b 100644 --- a/EasyQuantizationGUI.py +++ b/EasyQuantizationGUI.py @@ -1,3 +1,5 @@ +VERSION = "1.09" + import sys import subprocess import importlib @@ -142,7 +144,10 @@ def run_llama_quantize(): startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW startupinfo.wShowWindow = subprocess.SW_HIDE - process = subprocess.Popen(["python", convert_py_path, "--src", input_file, "--dst", temp_gguf_file], + # Get the Python executable path from the current environment + pythonpath = sys.executable + + process = subprocess.Popen([pythonpath, convert_py_path, "--src", input_file, "--dst", temp_gguf_file], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1, universal_newlines=True, startupinfo=startupinfo) @@ -214,7 +219,7 @@ def main(): global root, process_text, input_entry, output_entry, quantize_dropdown, run_button, quantize_level_var global input_browse, output_browse # Add these two variables root = tk.Tk() - root.title("Easy Quantization GUI") + root.title(f"Easy Quantization GUI v{VERSION}") root.geometry("800x600") # Quantize level selection diff --git a/convert.py b/convert.py index 7c44c0d..d66ca1b 100644 --- a/convert.py +++ b/convert.py @@ -33,6 +33,24 @@ class ModelSD3(ModelTemplate): ] keys_banned = ["transformer_blocks.0.attn.add_q_proj.weight",] +class ModelAura(ModelTemplate): + arch = "aura" + keys_detect = [ + ("double_layers.3.modX.1.weight",), + ("joint_transformer_blocks.3.ff_context.out_projection.weight",), + ] + keys_banned = ["joint_transformer_blocks.3.ff_context.out_projection.weight",] + +class ModelLTXV(ModelTemplate): + arch = "ltxv" + keys_detect = [ + ( + "adaln_single.emb.timestep_embedder.linear_2.weight", + "transformer_blocks.27.scale_shift_table", + "caption_projection.linear_2.weight", + ) + ] + class ModelSDXL(ModelTemplate): arch = "sdxl" shape_fix = True @@ -47,7 +65,7 @@ class ModelSDXL(ModelTemplate): class ModelSD1(ModelTemplate): arch = "sd1" - shape_fix = False + shape_fix = True keys_detect = [ ("down_blocks.0.downsamplers.0.conv.weight",), ( @@ -57,7 +75,7 @@ class ModelSD1(ModelTemplate): ] # The architectures are checked in order and the first successful match terminates the search. -arch_list = [ModelFlux, ModelSD3, ModelSDXL, ModelSD1] +arch_list = [ModelFlux, ModelSD3, ModelAura, ModelLTXV, ModelSDXL, ModelSD1] def is_model_arch(model, state_dict): # check if model is correct @@ -99,13 +117,18 @@ def load_state_dict(path): state_dict = load_file(path) # only keep unet with no prefix! + prefix = None + for pfx in ["model.diffusion_model.", "model."]: + if any([x.startswith(pfx) for x in state_dict.keys()]): + prefix = pfx + break + sd = {} - has_prefix = any(["model.diffusion_model." in x for x in state_dict.keys()]) for k, v in state_dict.items(): - if has_prefix and "model.diffusion_model." not in k: + if prefix and prefix not in k: continue - if has_prefix: - k = k.replace("model.diffusion_model.", "") + if prefix: + k = k.replace(prefix, "") sd[k] = v return sd diff --git a/ggml.dll b/ggml.dll index c7416ab..8d07343 100644 Binary files a/ggml.dll and b/ggml.dll differ diff --git a/llama-quantize.exe b/llama-quantize.exe index 20a0ecf..183a9e7 100644 Binary files a/llama-quantize.exe and b/llama-quantize.exe differ diff --git a/llama.dll b/llama.dll index f39d84f..96d8a59 100644 Binary files a/llama.dll and b/llama.dll differ