Skip to content

Commit a5aac6c

Browse files
committed
virtual environment 1.09
1 parent 5493eb6 commit a5aac6c

File tree

8 files changed

+79
-10
lines changed

8 files changed

+79
-10
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
venv/
2+
*.zip

CreateZip.ps1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
# Read VERSION from Python file
2+
$versionLine = Get-Content "EasyQuantizationGUI.py" | Select-String "VERSION = "
3+
if ($versionLine -match 'VERSION = "(.*?)"') {
4+
$version = $matches[1]
5+
Write-Host "Found version: $version"
6+
} else {
7+
Write-Host "WARNING: Version not found, using 'unknown'"
8+
$version = "unknown"
9+
}
10+
111
# Define the zip file name and subdirectory name
2-
$zipName = "EasyQuantizationGUI.zip"
12+
$zipName = "EasyQuantizationGUI_v$version.zip"
313
$subDirName = "EasyQuantizationGUI"
414

515
# Get the current directory

EasyQuantizationGUI.bat

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1-
python EasyQuantizationGUI.py
1+
@echo off
2+
REM Check if pip is installed and show output only if it needs to be installed
3+
python -m pip --version >nul 2>&1
4+
if %ERRORLEVEL% neq 0 (
5+
echo Installing pip...
6+
python -m ensurepip --default-pip
7+
) else (
8+
python -m pip install --upgrade pip >nul 2>&1
9+
)
10+
11+
REM Check if virtual environment exists, create if it doesn't
12+
if not exist "venv" (
13+
echo Creating virtual environment...
14+
python -m venv venv
15+
call venv\Scripts\activate
16+
echo Installing requirements...
17+
pip install -r requirements.txt
18+
echo Setup complete!
19+
echo.
20+
) else (
21+
call venv\Scripts\activate
22+
)
23+
24+
REM Run the application
25+
python EasyQuantizationGUI.py
26+
27+
REM Keep the window open if there's an error
28+
if %ERRORLEVEL% neq 0 (
29+
pause
30+
)

EasyQuantizationGUI.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
VERSION = "1.09"
2+
13
import sys
24
import subprocess
35
import importlib
@@ -142,7 +144,10 @@ def run_llama_quantize():
142144
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
143145
startupinfo.wShowWindow = subprocess.SW_HIDE
144146

145-
process = subprocess.Popen(["python", convert_py_path, "--src", input_file, "--dst", temp_gguf_file],
147+
# Get the Python executable path from the current environment
148+
pythonpath = sys.executable
149+
150+
process = subprocess.Popen([pythonpath, convert_py_path, "--src", input_file, "--dst", temp_gguf_file],
146151
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True,
147152
bufsize=1, universal_newlines=True, startupinfo=startupinfo)
148153

@@ -214,7 +219,7 @@ def main():
214219
global root, process_text, input_entry, output_entry, quantize_dropdown, run_button, quantize_level_var
215220
global input_browse, output_browse # Add these two variables
216221
root = tk.Tk()
217-
root.title("Easy Quantization GUI")
222+
root.title(f"Easy Quantization GUI v{VERSION}")
218223
root.geometry("800x600")
219224

220225
# Quantize level selection

convert.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ class ModelSD3(ModelTemplate):
3333
]
3434
keys_banned = ["transformer_blocks.0.attn.add_q_proj.weight",]
3535

36+
class ModelAura(ModelTemplate):
37+
arch = "aura"
38+
keys_detect = [
39+
("double_layers.3.modX.1.weight",),
40+
("joint_transformer_blocks.3.ff_context.out_projection.weight",),
41+
]
42+
keys_banned = ["joint_transformer_blocks.3.ff_context.out_projection.weight",]
43+
44+
class ModelLTXV(ModelTemplate):
45+
arch = "ltxv"
46+
keys_detect = [
47+
(
48+
"adaln_single.emb.timestep_embedder.linear_2.weight",
49+
"transformer_blocks.27.scale_shift_table",
50+
"caption_projection.linear_2.weight",
51+
)
52+
]
53+
3654
class ModelSDXL(ModelTemplate):
3755
arch = "sdxl"
3856
shape_fix = True
@@ -47,7 +65,7 @@ class ModelSDXL(ModelTemplate):
4765

4866
class ModelSD1(ModelTemplate):
4967
arch = "sd1"
50-
shape_fix = False
68+
shape_fix = True
5169
keys_detect = [
5270
("down_blocks.0.downsamplers.0.conv.weight",),
5371
(
@@ -57,7 +75,7 @@ class ModelSD1(ModelTemplate):
5775
]
5876

5977
# The architectures are checked in order and the first successful match terminates the search.
60-
arch_list = [ModelFlux, ModelSD3, ModelSDXL, ModelSD1]
78+
arch_list = [ModelFlux, ModelSD3, ModelAura, ModelLTXV, ModelSDXL, ModelSD1]
6179

6280
def is_model_arch(model, state_dict):
6381
# check if model is correct
@@ -99,13 +117,18 @@ def load_state_dict(path):
99117
state_dict = load_file(path)
100118

101119
# only keep unet with no prefix!
120+
prefix = None
121+
for pfx in ["model.diffusion_model.", "model."]:
122+
if any([x.startswith(pfx) for x in state_dict.keys()]):
123+
prefix = pfx
124+
break
125+
102126
sd = {}
103-
has_prefix = any(["model.diffusion_model." in x for x in state_dict.keys()])
104127
for k, v in state_dict.items():
105-
if has_prefix and "model.diffusion_model." not in k:
128+
if prefix and prefix not in k:
106129
continue
107-
if has_prefix:
108-
k = k.replace("model.diffusion_model.", "")
130+
if prefix:
131+
k = k.replace(prefix, "")
109132
sd[k] = v
110133

111134
return sd

ggml.dll

623 KB
Binary file not shown.

llama-quantize.exe

2.06 MB
Binary file not shown.

llama.dll

4.48 MB
Binary file not shown.

0 commit comments

Comments
 (0)