jeqin
commited on
Commit
·
dbcf7a0
1
Parent(s):
a465481
update scritps
Browse files- download_models.py +19 -0
- test_configs.py +178 -0
- test_mlx.py +126 -0
download_models.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
from huggingface_hub import snapshot_download
|
| 3 |
+
from mlx_app.stable_diffusion.models import _MODELS
|
| 4 |
+
|
| 5 |
+
# HF_ENDPOINT=https://hf-mirror.com python download_models.py
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
for repo_id, items in _MODELS.items():
|
| 9 |
+
snapshot_download(repo_id, local_dir=f'../models/{repo_id}', local_dir_use_symlinks=False,
|
| 10 |
+
allow_patterns=list(items.values()))
|
| 11 |
+
|
| 12 |
+
# snapshot_download(repo_id, local_dir=local_path, local_dir_use_symlinks=False,
|
| 13 |
+
# ignore_patterns=[
|
| 14 |
+
# ".gitattributes", "*.bin", "*.onnx", "*.ckpt", "*.onnx_data", "*.png", "*.jpg", "*.md"
|
| 15 |
+
# ],
|
| 16 |
+
# allow_patterns=["text_encoder/model.safetensors"]
|
| 17 |
+
# )
|
| 18 |
+
|
| 19 |
+
|
test_configs.py
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
+
output = Path("./base_model_images")
|
| 4 |
+
if not output.exists():
|
| 5 |
+
output.mkdir(exist_ok=True, parents=True)
|
| 6 |
+
|
| 7 |
+
prompts = {
|
| 8 |
+
0: "astronaut riding a horse",
|
| 9 |
+
1: "a cute corgi",
|
| 10 |
+
2: "A cinematic shot of a baby racoon wearing an intricate italian priest robe",
|
| 11 |
+
3: "portrait photo of a girl, photograph, highly detailed face, depth of field, moody light, golden hair",
|
| 12 |
+
4: "A photo of beautiful mountain with realistic sunset and blue lake, highly detailed, masterpiece",
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
# base_models = ["sd1.5", "sd2", "realistic", "sdxl", "sdxl-turbo"]
|
| 16 |
+
# base_models = ["sdxl-turbo"]
|
| 17 |
+
# sd1.5 512, sd2 512, realistic 512, sdxl 1024, sdxl-turbo 512
|
| 18 |
+
base_models = {
|
| 19 |
+
"sd1.5": {
|
| 20 |
+
"img-size": 512,
|
| 21 |
+
# "steps": 40,
|
| 22 |
+
# "cfg": 1.2,
|
| 23 |
+
# "loras": [
|
| 24 |
+
# {
|
| 25 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/lcm-sdv15.safetensors",
|
| 26 |
+
# "trigger_words": ""
|
| 27 |
+
# },
|
| 28 |
+
# {
|
| 29 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/ColoringBook-sd15.safetensors",
|
| 30 |
+
# "trigger_words": "Coloring Book, ColoringBookAF"
|
| 31 |
+
# },
|
| 32 |
+
# {
|
| 33 |
+
# "lora-scale": 0.8,
|
| 34 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/lego-sd15.safetensors",
|
| 35 |
+
# "trigger_words": "LEGO Creator"
|
| 36 |
+
# }, {
|
| 37 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/toyglasses-sd15.safetensors",
|
| 38 |
+
# "trigger_words": "<lora:toyglasses:1>toyglasses"
|
| 39 |
+
# }, {
|
| 40 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/song_flower-sd15.safetensors",
|
| 41 |
+
# "trigger_words": "Song Dynasty flower and bird painting"
|
| 42 |
+
# }, {
|
| 43 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/3dillu-sd15.safetensors",
|
| 44 |
+
# "trigger_words": ""
|
| 45 |
+
# }, {
|
| 46 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/Icons-sd15.safetensors",
|
| 47 |
+
# "trigger_words": " icons, ios icon app",
|
| 48 |
+
# "lora-scale": 0.8,
|
| 49 |
+
# },{
|
| 50 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/CuteCartoon-sd15.safetensors",
|
| 51 |
+
# "trigger_words": "Cartoon,CuteCartoonAF",
|
| 52 |
+
# },
|
| 53 |
+
# ]
|
| 54 |
+
},
|
| 55 |
+
"sd2": {
|
| 56 |
+
# "steps": 40,
|
| 57 |
+
"img-size": 512,
|
| 58 |
+
# "loras": [
|
| 59 |
+
# {
|
| 60 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_2.1/ColoringBook-sd21.safetensors",
|
| 61 |
+
# "trigger_words": "ColoringBookAF",
|
| 62 |
+
# },
|
| 63 |
+
# {
|
| 64 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_2.1/TShirtDesign-sd21.safetensors",
|
| 65 |
+
# "trigger_words": "T Shirt Design, TShirtDesignAF",
|
| 66 |
+
# }, {
|
| 67 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_2.1/StudioGhibli-sd21.safetensors",
|
| 68 |
+
# "trigger_words": "Studio Ghibli, StdGBRedmAF",
|
| 69 |
+
# }, {
|
| 70 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_2.1/3D-sd21.safetensors",
|
| 71 |
+
# "trigger_words": "3D Render Style, 3DRenderAF",
|
| 72 |
+
# }, {
|
| 73 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_2.1/Stickers-sd21.safetensors",
|
| 74 |
+
# "trigger_words": " Sticker",
|
| 75 |
+
# },
|
| 76 |
+
# ]
|
| 77 |
+
},
|
| 78 |
+
"realistic": {
|
| 79 |
+
"img-size": 512,
|
| 80 |
+
# "steps": 20,
|
| 81 |
+
# "loras": [
|
| 82 |
+
# {
|
| 83 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/lego-sd15.safetensors",
|
| 84 |
+
# "trigger_words": "LEGO Creator",
|
| 85 |
+
# "lora-scale": 0.8, # Between 0.6-1.0, recommended to use 0.8.
|
| 86 |
+
# },
|
| 87 |
+
# {
|
| 88 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/toyglasses-sd15.safetensors",
|
| 89 |
+
# "trigger_words": "<lora:toyglasses:1>toyglasses"
|
| 90 |
+
# }, {
|
| 91 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/song_flower-sd15.safetensors",
|
| 92 |
+
# "trigger_words": "Song Dynasty flower and bird painting"
|
| 93 |
+
# }, {
|
| 94 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/3dillu-sd15.safetensors",
|
| 95 |
+
# "trigger_words": ""
|
| 96 |
+
# }, {
|
| 97 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/Icons-sd15.safetensors",
|
| 98 |
+
# "trigger_words": " icons, ios icon app",
|
| 99 |
+
# "lora-scale": 0.8,
|
| 100 |
+
# }, {
|
| 101 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_1.5/CuteCartoon-sd15.safetensors",
|
| 102 |
+
# "trigger_words": "Cartoon,CuteCartoonAF",
|
| 103 |
+
# },
|
| 104 |
+
# ],
|
| 105 |
+
},
|
| 106 |
+
"sdxl": {
|
| 107 |
+
# "steps": 40,
|
| 108 |
+
"img-size": 1024,
|
| 109 |
+
# "loras": [
|
| 110 |
+
# {
|
| 111 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/papercut_sdxl.safetensors",
|
| 112 |
+
# "trigger_words": "papercut style",
|
| 113 |
+
# },
|
| 114 |
+
# {
|
| 115 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/toy_face-sdxl.safetensors",
|
| 116 |
+
# "trigger_words": "toy_face",
|
| 117 |
+
# "lora-scale": 0.9,
|
| 118 |
+
# }, {
|
| 119 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/Products10k-sdxl.safetensors",
|
| 120 |
+
# "trigger_words": "",
|
| 121 |
+
# }, {
|
| 122 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/ikea_instructions-sdxl.safetensors",
|
| 123 |
+
# "trigger_words": "",
|
| 124 |
+
# }, {
|
| 125 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/Lego_sdxl.safetensors",
|
| 126 |
+
# "trigger_words": "LEGO MiniFig",
|
| 127 |
+
# }, {
|
| 128 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/lego_cinematic_sdxl.safetensors",
|
| 129 |
+
# "trigger_words": "Lego",
|
| 130 |
+
# }, {
|
| 131 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/Emojis-sdxl.safetensors",
|
| 132 |
+
# "trigger_words": "Emoji",
|
| 133 |
+
# }, {
|
| 134 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/MoviePoster-sdxl.safetensors",
|
| 135 |
+
# "trigger_words": "Movie Poster, MoviePosterAF",
|
| 136 |
+
# }, {
|
| 137 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/XboxAvatar-sdxl.safetensors",
|
| 138 |
+
# "trigger_words": "XBOX AVATAR",
|
| 139 |
+
# },
|
| 140 |
+
# ],
|
| 141 |
+
},
|
| 142 |
+
"sdxl-turbo": {
|
| 143 |
+
"img-size": 512,
|
| 144 |
+
# "steps": 4,
|
| 145 |
+
# "loras": [
|
| 146 |
+
# {
|
| 147 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/papercut_sdxl.safetensors",
|
| 148 |
+
# "trigger_words": "papercut style"
|
| 149 |
+
# },
|
| 150 |
+
# {
|
| 151 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/toy_face-sdxl.safetensors",
|
| 152 |
+
# "trigger_words": "toy_face",
|
| 153 |
+
# "lora-scale": 0.9,
|
| 154 |
+
# }, {
|
| 155 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/Products10k-sdxl.safetensors",
|
| 156 |
+
# "trigger_words": "",
|
| 157 |
+
# }, {
|
| 158 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/ikea_instructions-sdxl.safetensors",
|
| 159 |
+
# "trigger_words": "",
|
| 160 |
+
# }, {
|
| 161 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/Lego_sdxl.safetensors",
|
| 162 |
+
# "trigger_words": "LEGO MiniFig",
|
| 163 |
+
# }, {
|
| 164 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/lego_cinematic_sdxl.safetensors",
|
| 165 |
+
# "trigger_words": "Lego",
|
| 166 |
+
# }, {
|
| 167 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/Emojis-sdxl.safetensors",
|
| 168 |
+
# "trigger_words": "Emoji",
|
| 169 |
+
# }, {
|
| 170 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/MoviePoster-sdxl.safetensors",
|
| 171 |
+
# "trigger_words": "Movie Poster, MoviePosterAF",
|
| 172 |
+
# }, {
|
| 173 |
+
# "lora": "/Users/jeqin/work/code/sd/models/lora_xl/XboxAvatar-sdxl.safetensors",
|
| 174 |
+
# "trigger_words": "XBOX AVATAR",
|
| 175 |
+
# },
|
| 176 |
+
# ]
|
| 177 |
+
}
|
| 178 |
+
}
|
test_mlx.py
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import re
|
| 3 |
+
import subprocess
|
| 4 |
+
import csv
|
| 5 |
+
from subprocess import CompletedProcess
|
| 6 |
+
|
| 7 |
+
from test_configs import *
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def cmd(command: str, check=True, capture_output=False) -> CompletedProcess:
|
| 11 |
+
print(command)
|
| 12 |
+
if capture_output:
|
| 13 |
+
ret = subprocess.run(command, shell=True, check=check, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
| 14 |
+
universal_newlines=True)
|
| 15 |
+
else:
|
| 16 |
+
ret = subprocess.run(command, shell=True, check=check)
|
| 17 |
+
print(ret.stdout)
|
| 18 |
+
return ret
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def parse_log(output):
|
| 22 |
+
"""output example:
|
| 23 |
+
"""
|
| 24 |
+
model_name = re.search(r"model: (.+)", output).group(1)
|
| 25 |
+
steps = re.search(r"steps: (.+)", output).group(1)
|
| 26 |
+
cfg_weight = re.search(r"cfg_weight: (.+)", output).group(1)
|
| 27 |
+
img_size = re.search(r"img-size: (.+)", output).group(1)
|
| 28 |
+
img_number = re.search(r"image number: (.+)", output).group(1)
|
| 29 |
+
load_model_time = re.search(r"load model time: (.+)", output).group(1)
|
| 30 |
+
preload_model = re.search(r"preload model time: (.+)", output).group(1)
|
| 31 |
+
update_lora_time = re.search(r"update lora time: (.+)", output).group(1)
|
| 32 |
+
quantize_time = re.search(r"quantize time: (.+)", output).group(1)
|
| 33 |
+
generate_time = re.search(r"generate image time: (.+)", output).group(1)
|
| 34 |
+
total_time = re.search(r"total time: (.+)", output).group(1)
|
| 35 |
+
out_image = re.search(r"save image to: (.+)", output).group(1)
|
| 36 |
+
out_image = '/'.join(out_image.split("/")[-2:])
|
| 37 |
+
out_image_size = re.search(r"output image size: \((.+)\)", output).group(1)
|
| 38 |
+
out_image_size = out_image_size.replace(', ', '*')
|
| 39 |
+
return (model_name, steps, cfg_weight, img_size, img_number, load_model_time,
|
| 40 |
+
preload_model, update_lora_time, quantize_time, generate_time, total_time, out_image, out_image_size)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def _get_cmd(prompt, **kwargs):
|
| 44 |
+
base_cmd = f'python mlx_app/txt2image_lora.py "{prompt}"'
|
| 45 |
+
for k, v in kwargs.items():
|
| 46 |
+
if v is True:
|
| 47 |
+
base_cmd += f" --{k}"
|
| 48 |
+
else:
|
| 49 |
+
base_cmd += f" --{k} {v}"
|
| 50 |
+
return base_cmd
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def test_lora(result):
|
| 54 |
+
commands = {
|
| 55 |
+
"no_lora": [],
|
| 56 |
+
"no_trigger": [],
|
| 57 |
+
"with_trigger": []
|
| 58 |
+
}
|
| 59 |
+
for model, config in base_models.items():
|
| 60 |
+
loras = config.pop("loras")
|
| 61 |
+
for l in loras:
|
| 62 |
+
trigger_words = l.get("trigger_words")
|
| 63 |
+
lora_name = l.get("lora").split('/')[-1].split('.')[0]
|
| 64 |
+
for i, p in prompts.items():
|
| 65 |
+
# 1. run with no lora
|
| 66 |
+
# paras = {"model": model, "output": str(output / model / f"{lora_name}-{i}-a_no_lora.png")}
|
| 67 |
+
# paras.update(config)
|
| 68 |
+
# commands["no_lora"].append(_get_cmd(p, **paras))
|
| 69 |
+
#
|
| 70 |
+
# # 2. run with lora, but no trigger words
|
| 71 |
+
# paras = {"model": model, "output": str(output / model / f"{lora_name}-{i}-b_no_trigger.png")}
|
| 72 |
+
# paras.update(config)
|
| 73 |
+
# paras["lora"] = l.get("lora")
|
| 74 |
+
# if l.get("lora-scale"):
|
| 75 |
+
# paras["lora-scale"] = l.get("lora-scale")
|
| 76 |
+
# commands["no_trigger"].append(_get_cmd(p, **paras))
|
| 77 |
+
|
| 78 |
+
# 3. run with lora, with trigger words
|
| 79 |
+
paras = {"model": model, "output": str(output / f"{model}-{lora_name}-{i}-c_with_trigger.png"),
|
| 80 |
+
"n_images": 4}
|
| 81 |
+
paras.update(config)
|
| 82 |
+
paras["lora"] = l.get("lora")
|
| 83 |
+
if l.get("lora-scale"):
|
| 84 |
+
paras["lora-scale"] = l.get("lora-scale")
|
| 85 |
+
p = f"{p}, {trigger_words}"
|
| 86 |
+
commands["with_trigger"].append(_get_cmd(p, **paras))
|
| 87 |
+
|
| 88 |
+
for _, cmds in commands.items():
|
| 89 |
+
for c in cmds:
|
| 90 |
+
try:
|
| 91 |
+
ret = cmd(c, capture_output=True)
|
| 92 |
+
result.append(parse_log(ret.stdout))
|
| 93 |
+
except Exception as e:
|
| 94 |
+
print("Exception: ", e)
|
| 95 |
+
return result
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def test_base_model(result: list):
|
| 99 |
+
for model, config in base_models.items():
|
| 100 |
+
for i, p in prompts.items():
|
| 101 |
+
paras = {"model": model, "output": str(output / f"{model}_{i}.png"), "n_images": 4, "decoding_batch_size": 4}
|
| 102 |
+
paras.update(config)
|
| 103 |
+
command = _get_cmd(p, **paras)
|
| 104 |
+
try:
|
| 105 |
+
ret = cmd(command, capture_output=True)
|
| 106 |
+
result.append(parse_log(ret.stdout))
|
| 107 |
+
except Exception as e:
|
| 108 |
+
print("Exception: ", e)
|
| 109 |
+
return result
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
def main():
|
| 113 |
+
result = [
|
| 114 |
+
['model name', 'steps', 'cfg_weight', 'img size', 'img number', 'load model', 'preload model', 'update lora',
|
| 115 |
+
'quantize', 'generate image', 'total time', 'output image', 'output image size']
|
| 116 |
+
]
|
| 117 |
+
result = test_base_model(result)
|
| 118 |
+
# result = test_lora(result)
|
| 119 |
+
|
| 120 |
+
with open("result_mlx.csv", 'w', newline='') as f:
|
| 121 |
+
writer = csv.writer(f)
|
| 122 |
+
writer.writerows(result)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
if __name__ == '__main__':
|
| 126 |
+
main()
|