Upload 6 files
Browse files- app.py +21 -16
- constants.py +20 -15
- dc.py +43 -26
- llmdolphin.py +54 -0
- requirements.txt +1 -1
- utils.py +1 -1
app.py
CHANGED
@@ -4,7 +4,7 @@ import numpy as np
|
|
4 |
|
5 |
# DiffuseCraft
|
6 |
from dc import (infer, _infer, pass_result, get_diffusers_model_list, get_samplers, save_image_history,
|
7 |
-
get_vaes, enable_diffusers_model_detail, extract_exif_data,
|
8 |
preset_quality, preset_styles, process_style_prompt, get_all_lora_tupled_list, update_loras, apply_lora_prompt,
|
9 |
download_my_lora, search_civitai_lora, update_civitai_selection, select_civitai_lora, search_civitai_lora_json,
|
10 |
get_t2i_model_info, get_civitai_tag, CIVITAI_SORT, CIVITAI_PERIOD, CIVITAI_BASEMODEL,
|
@@ -217,7 +217,7 @@ with gr.Blocks(fill_width=True, elem_id="container", css=css, delete_cache=(60,
|
|
217 |
image_mask = gr.Image(label="Image Mask", type="filepath", height=384, sources=["upload", "clipboard"], show_share_button=False, elem_classes="image")
|
218 |
with gr.Row():
|
219 |
strength = gr.Slider(minimum=0.01, maximum=1.0, step=0.01, value=0.55, label="Strength",
|
220 |
-
info="This option adjusts the level of changes for img2img and
|
221 |
image_resolution = gr.Slider(minimum=64, maximum=2048, step=64, value=1024, label="Image Resolution",
|
222 |
info="The maximum proportional size of the generated image based on the uploaded image.")
|
223 |
with gr.Row():
|
@@ -289,13 +289,13 @@ with gr.Blocks(fill_width=True, elem_id="container", css=css, delete_cache=(60,
|
|
289 |
cm_btn_send_ip1.click(send_img, [img_source, img_result], [image_ip1, mask_ip1], queue=False, show_api=False)
|
290 |
cm_btn_send_ip2.click(send_img, [img_source, img_result], [image_ip2, mask_ip2], queue=False, show_api=False)
|
291 |
|
292 |
-
with gr.Tab("Hires fix / Detailfix"):
|
293 |
with gr.Accordion("Hires fix", open=True):
|
294 |
with gr.Row():
|
295 |
upscaler_model_path = gr.Dropdown(label="Upscaler", choices=UPSCALER_KEYS, value=UPSCALER_KEYS[0])
|
296 |
upscaler_increases_size = gr.Slider(minimum=1.1, maximum=4., step=0.1, value=1.2, label="Upscale by")
|
297 |
-
|
298 |
-
|
299 |
with gr.Row():
|
300 |
hires_steps = gr.Slider(minimum=0, value=30, maximum=100, step=1, label="Hires Steps")
|
301 |
hires_denoising_strength = gr.Slider(minimum=0.1, maximum=1.0, step=0.01, value=0.55, label="Hires Denoising Strength")
|
@@ -342,7 +342,13 @@ with gr.Blocks(fill_width=True, elem_id="container", css=css, delete_cache=(60,
|
|
342 |
mask_dilation_b = gr.Number(label="Mask dilation:", value=4, minimum=1)
|
343 |
mask_blur_b = gr.Number(label="Mask blur:", value=4, minimum=1)
|
344 |
mask_padding_b = gr.Number(label="Mask padding:", value=32, minimum=1)
|
345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
with gr.Tab("Translation Settings"):
|
347 |
chatbot = gr.Chatbot(render_markdown=False, visible=False) # component for auto-translation
|
348 |
chat_model = gr.Dropdown(choices=get_dolphin_models(), value=get_dolphin_models()[0][1], allow_custom_value=True, label="Model")
|
@@ -396,13 +402,13 @@ with gr.Blocks(fill_width=True, elem_id="container", css=css, delete_cache=(60,
|
|
396 |
value_threshold, distance_threshold, recolor_gamma_correction, tile_blur_sigma,
|
397 |
image_ip1, mask_ip1, model_ip1, mode_ip1, scale_ip1,
|
398 |
image_ip2, mask_ip2, model_ip2, mode_ip2, scale_ip2,
|
399 |
-
upscaler_model_path, upscaler_increases_size,
|
400 |
hires_sampler, hires_schedule_type, hires_guidance_scale, hires_prompt, hires_negative_prompt,
|
401 |
adetailer_inpaint_only, adetailer_verbose, adetailer_sampler, adetailer_active_a,
|
402 |
prompt_ad_a, negative_prompt_ad_a, strength_ad_a, face_detector_ad_a, person_detector_ad_a, hand_detector_ad_a,
|
403 |
mask_dilation_a, mask_blur_a, mask_padding_a, adetailer_active_b, prompt_ad_b, negative_prompt_ad_b, strength_ad_b,
|
404 |
face_detector_ad_b, person_detector_ad_b, hand_detector_ad_b, mask_dilation_b, mask_blur_b, mask_padding_b,
|
405 |
-
active_textual_inversion, gpu_duration, auto_trans, recom_prompt],
|
406 |
outputs=[result],
|
407 |
queue=True,
|
408 |
show_progress="full",
|
@@ -424,13 +430,13 @@ with gr.Blocks(fill_width=True, elem_id="container", css=css, delete_cache=(60,
|
|
424 |
value_threshold, distance_threshold, recolor_gamma_correction, tile_blur_sigma,
|
425 |
image_ip1, mask_ip1, model_ip1, mode_ip1, scale_ip1,
|
426 |
image_ip2, mask_ip2, model_ip2, mode_ip2, scale_ip2,
|
427 |
-
upscaler_model_path, upscaler_increases_size,
|
428 |
hires_sampler, hires_schedule_type, hires_guidance_scale, hires_prompt, hires_negative_prompt,
|
429 |
adetailer_inpaint_only, adetailer_verbose, adetailer_sampler, adetailer_active_a,
|
430 |
prompt_ad_a, negative_prompt_ad_a, strength_ad_a, face_detector_ad_a, person_detector_ad_a, hand_detector_ad_a,
|
431 |
mask_dilation_a, mask_blur_a, mask_padding_a, adetailer_active_b, prompt_ad_b, negative_prompt_ad_b, strength_ad_b,
|
432 |
face_detector_ad_b, person_detector_ad_b, hand_detector_ad_b, mask_dilation_b, mask_blur_b, mask_padding_b,
|
433 |
-
active_textual_inversion, gpu_duration, auto_trans, recom_prompt],
|
434 |
outputs=[result],
|
435 |
queue=False,
|
436 |
show_api=True,
|
@@ -462,13 +468,13 @@ with gr.Blocks(fill_width=True, elem_id="container", css=css, delete_cache=(60,
|
|
462 |
value_threshold, distance_threshold, recolor_gamma_correction, tile_blur_sigma,
|
463 |
image_ip1, mask_ip1, model_ip1, mode_ip1, scale_ip1,
|
464 |
image_ip2, mask_ip2, model_ip2, mode_ip2, scale_ip2,
|
465 |
-
upscaler_model_path, upscaler_increases_size,
|
466 |
hires_sampler, hires_schedule_type, hires_guidance_scale, hires_prompt, hires_negative_prompt,
|
467 |
adetailer_inpaint_only, adetailer_verbose, adetailer_sampler, adetailer_active_a,
|
468 |
prompt_ad_a, negative_prompt_ad_a, strength_ad_a, face_detector_ad_a, person_detector_ad_a, hand_detector_ad_a,
|
469 |
mask_dilation_a, mask_blur_a, mask_padding_a, adetailer_active_b, prompt_ad_b, negative_prompt_ad_b, strength_ad_b,
|
470 |
face_detector_ad_b, person_detector_ad_b, hand_detector_ad_b, mask_dilation_b, mask_blur_b, mask_padding_b,
|
471 |
-
active_textual_inversion, gpu_duration, auto_trans, recom_prompt],
|
472 |
outputs=[result],
|
473 |
queue=True,
|
474 |
show_progress="full",
|
@@ -651,16 +657,15 @@ with gr.Blocks(fill_width=True, elem_id="container", css=css, delete_cache=(60,
|
|
651 |
with gr.Tab("Upscaler"):
|
652 |
with gr.Row():
|
653 |
with gr.Column():
|
|
|
654 |
image_up_tab = gr.Image(label="Image", type="pil", sources=["upload"])
|
655 |
-
upscaler_tab = gr.Dropdown(label="Upscaler", choices=
|
656 |
upscaler_size_tab = gr.Slider(minimum=1., maximum=4., step=0.1, value=1.1, label="Upscale by")
|
657 |
generate_button_up_tab = gr.Button(value="START UPSCALE", variant="primary")
|
658 |
-
|
659 |
with gr.Column():
|
660 |
result_up_tab = gr.Image(label="Result", type="pil", interactive=False, format="png")
|
661 |
-
|
662 |
generate_button_up_tab.click(
|
663 |
-
fn=
|
664 |
inputs=[image_up_tab, upscaler_tab, upscaler_size_tab],
|
665 |
outputs=[result_up_tab],
|
666 |
)
|
|
|
4 |
|
5 |
# DiffuseCraft
|
6 |
from dc import (infer, _infer, pass_result, get_diffusers_model_list, get_samplers, save_image_history,
|
7 |
+
get_vaes, enable_diffusers_model_detail, extract_exif_data, process_upscale, UPSCALER_KEYS, FACE_RESTORATION_MODELS,
|
8 |
preset_quality, preset_styles, process_style_prompt, get_all_lora_tupled_list, update_loras, apply_lora_prompt,
|
9 |
download_my_lora, search_civitai_lora, update_civitai_selection, select_civitai_lora, search_civitai_lora_json,
|
10 |
get_t2i_model_info, get_civitai_tag, CIVITAI_SORT, CIVITAI_PERIOD, CIVITAI_BASEMODEL,
|
|
|
217 |
image_mask = gr.Image(label="Image Mask", type="filepath", height=384, sources=["upload", "clipboard"], show_share_button=False, elem_classes="image")
|
218 |
with gr.Row():
|
219 |
strength = gr.Slider(minimum=0.01, maximum=1.0, step=0.01, value=0.55, label="Strength",
|
220 |
+
info="This option adjusts the level of changes for img2img, repaint and inpaint.")
|
221 |
image_resolution = gr.Slider(minimum=64, maximum=2048, step=64, value=1024, label="Image Resolution",
|
222 |
info="The maximum proportional size of the generated image based on the uploaded image.")
|
223 |
with gr.Row():
|
|
|
289 |
cm_btn_send_ip1.click(send_img, [img_source, img_result], [image_ip1, mask_ip1], queue=False, show_api=False)
|
290 |
cm_btn_send_ip2.click(send_img, [img_source, img_result], [image_ip2, mask_ip2], queue=False, show_api=False)
|
291 |
|
292 |
+
with gr.Tab("Hires fix / Detailfix / Face restoration"):
|
293 |
with gr.Accordion("Hires fix", open=True):
|
294 |
with gr.Row():
|
295 |
upscaler_model_path = gr.Dropdown(label="Upscaler", choices=UPSCALER_KEYS, value=UPSCALER_KEYS[0])
|
296 |
upscaler_increases_size = gr.Slider(minimum=1.1, maximum=4., step=0.1, value=1.2, label="Upscale by")
|
297 |
+
upscaler_tile_size = gr.Slider(minimum=0, maximum=512, step=16, value=0, label="Upscaler Tile Size", info="0 = no tiling")
|
298 |
+
upscaler_tile_overlap = gr.Slider(minimum=0, maximum=48, step=1, value=8, label="Upscaler Tile Overlap")
|
299 |
with gr.Row():
|
300 |
hires_steps = gr.Slider(minimum=0, value=30, maximum=100, step=1, label="Hires Steps")
|
301 |
hires_denoising_strength = gr.Slider(minimum=0.1, maximum=1.0, step=0.01, value=0.55, label="Hires Denoising Strength")
|
|
|
342 |
mask_dilation_b = gr.Number(label="Mask dilation:", value=4, minimum=1)
|
343 |
mask_blur_b = gr.Number(label="Mask blur:", value=4, minimum=1)
|
344 |
mask_padding_b = gr.Number(label="Mask padding:", value=32, minimum=1)
|
345 |
+
with gr.Accordion("Face restoration", open=True, visible=True):
|
346 |
+
face_rest_options = [None] + FACE_RESTORATION_MODELS
|
347 |
+
with gr.Row():
|
348 |
+
face_restoration_model = gr.Dropdown(label="Face restoration model", choices=face_rest_options, value=face_rest_options[0])
|
349 |
+
face_restoration_visibility = gr.Slider(minimum=0., maximum=1., step=0.001, value=1., label="Visibility")
|
350 |
+
face_restoration_weight = gr.Slider(minimum=0., maximum=1., step=0.001, value=.5, label="Weight", info="(0 = maximum effect, 1 = minimum effect)")
|
351 |
+
|
352 |
with gr.Tab("Translation Settings"):
|
353 |
chatbot = gr.Chatbot(render_markdown=False, visible=False) # component for auto-translation
|
354 |
chat_model = gr.Dropdown(choices=get_dolphin_models(), value=get_dolphin_models()[0][1], allow_custom_value=True, label="Model")
|
|
|
402 |
value_threshold, distance_threshold, recolor_gamma_correction, tile_blur_sigma,
|
403 |
image_ip1, mask_ip1, model_ip1, mode_ip1, scale_ip1,
|
404 |
image_ip2, mask_ip2, model_ip2, mode_ip2, scale_ip2,
|
405 |
+
upscaler_model_path, upscaler_increases_size, upscaler_tile_size, upscaler_tile_overlap, hires_steps, hires_denoising_strength,
|
406 |
hires_sampler, hires_schedule_type, hires_guidance_scale, hires_prompt, hires_negative_prompt,
|
407 |
adetailer_inpaint_only, adetailer_verbose, adetailer_sampler, adetailer_active_a,
|
408 |
prompt_ad_a, negative_prompt_ad_a, strength_ad_a, face_detector_ad_a, person_detector_ad_a, hand_detector_ad_a,
|
409 |
mask_dilation_a, mask_blur_a, mask_padding_a, adetailer_active_b, prompt_ad_b, negative_prompt_ad_b, strength_ad_b,
|
410 |
face_detector_ad_b, person_detector_ad_b, hand_detector_ad_b, mask_dilation_b, mask_blur_b, mask_padding_b,
|
411 |
+
active_textual_inversion, face_restoration_model, face_restoration_visibility, face_restoration_weight, gpu_duration, auto_trans, recom_prompt],
|
412 |
outputs=[result],
|
413 |
queue=True,
|
414 |
show_progress="full",
|
|
|
430 |
value_threshold, distance_threshold, recolor_gamma_correction, tile_blur_sigma,
|
431 |
image_ip1, mask_ip1, model_ip1, mode_ip1, scale_ip1,
|
432 |
image_ip2, mask_ip2, model_ip2, mode_ip2, scale_ip2,
|
433 |
+
upscaler_model_path, upscaler_increases_size, upscaler_tile_size, upscaler_tile_overlap, hires_steps, hires_denoising_strength,
|
434 |
hires_sampler, hires_schedule_type, hires_guidance_scale, hires_prompt, hires_negative_prompt,
|
435 |
adetailer_inpaint_only, adetailer_verbose, adetailer_sampler, adetailer_active_a,
|
436 |
prompt_ad_a, negative_prompt_ad_a, strength_ad_a, face_detector_ad_a, person_detector_ad_a, hand_detector_ad_a,
|
437 |
mask_dilation_a, mask_blur_a, mask_padding_a, adetailer_active_b, prompt_ad_b, negative_prompt_ad_b, strength_ad_b,
|
438 |
face_detector_ad_b, person_detector_ad_b, hand_detector_ad_b, mask_dilation_b, mask_blur_b, mask_padding_b,
|
439 |
+
active_textual_inversion, face_restoration_model, face_restoration_visibility, face_restoration_weight, gpu_duration, auto_trans, recom_prompt],
|
440 |
outputs=[result],
|
441 |
queue=False,
|
442 |
show_api=True,
|
|
|
468 |
value_threshold, distance_threshold, recolor_gamma_correction, tile_blur_sigma,
|
469 |
image_ip1, mask_ip1, model_ip1, mode_ip1, scale_ip1,
|
470 |
image_ip2, mask_ip2, model_ip2, mode_ip2, scale_ip2,
|
471 |
+
upscaler_model_path, upscaler_increases_size, upscaler_tile_size, upscaler_tile_overlap, hires_steps, hires_denoising_strength,
|
472 |
hires_sampler, hires_schedule_type, hires_guidance_scale, hires_prompt, hires_negative_prompt,
|
473 |
adetailer_inpaint_only, adetailer_verbose, adetailer_sampler, adetailer_active_a,
|
474 |
prompt_ad_a, negative_prompt_ad_a, strength_ad_a, face_detector_ad_a, person_detector_ad_a, hand_detector_ad_a,
|
475 |
mask_dilation_a, mask_blur_a, mask_padding_a, adetailer_active_b, prompt_ad_b, negative_prompt_ad_b, strength_ad_b,
|
476 |
face_detector_ad_b, person_detector_ad_b, hand_detector_ad_b, mask_dilation_b, mask_blur_b, mask_padding_b,
|
477 |
+
active_textual_inversion, face_restoration_model, face_restoration_visibility, face_restoration_weight, gpu_duration, auto_trans, recom_prompt],
|
478 |
outputs=[result],
|
479 |
queue=True,
|
480 |
show_progress="full",
|
|
|
657 |
with gr.Tab("Upscaler"):
|
658 |
with gr.Row():
|
659 |
with gr.Column():
|
660 |
+
USCALER_TAB_KEYS = [name for name in UPSCALER_KEYS[9:]]
|
661 |
image_up_tab = gr.Image(label="Image", type="pil", sources=["upload"])
|
662 |
+
upscaler_tab = gr.Dropdown(label="Upscaler", choices=USCALER_TAB_KEYS, value=USCALER_TAB_KEYS[5])
|
663 |
upscaler_size_tab = gr.Slider(minimum=1., maximum=4., step=0.1, value=1.1, label="Upscale by")
|
664 |
generate_button_up_tab = gr.Button(value="START UPSCALE", variant="primary")
|
|
|
665 |
with gr.Column():
|
666 |
result_up_tab = gr.Image(label="Result", type="pil", interactive=False, format="png")
|
|
|
667 |
generate_button_up_tab.click(
|
668 |
+
fn=process_upscale,
|
669 |
inputs=[image_up_tab, upscaler_tab, upscaler_size_tab],
|
670 |
outputs=[result_up_tab],
|
671 |
)
|
constants.py
CHANGED
@@ -4,6 +4,7 @@ from stablepy import (
|
|
4 |
scheduler_names,
|
5 |
SD15_TASKS,
|
6 |
SDXL_TASKS,
|
|
|
7 |
)
|
8 |
|
9 |
# - **Download Models**
|
@@ -43,12 +44,19 @@ LOAD_DIFFUSERS_FORMAT_MODEL = [
|
|
43 |
'John6666/ntr-mix-illustrious-xl-noob-xl-ntrmix35-sdxl',
|
44 |
'John6666/ntr-mix-illustrious-xl-noob-xl-v777-sdxl',
|
45 |
'John6666/ntr-mix-illustrious-xl-noob-xl-v777forlora-sdxl',
|
|
|
|
|
|
|
|
|
46 |
'John6666/haruki-mix-illustrious-v10-sdxl',
|
47 |
'John6666/noobreal-v10-sdxl',
|
48 |
'John6666/complicated-noobai-merge-vprediction-sdxl',
|
|
|
|
|
49 |
'Laxhar/noobai-XL-Vpred-0.65s',
|
50 |
'Laxhar/noobai-XL-Vpred-0.65',
|
51 |
'Laxhar/noobai-XL-Vpred-0.6',
|
|
|
52 |
'John6666/noobai-xl-nai-xl-vpred05version-sdxl',
|
53 |
'John6666/noobai-fusion2-vpred-itercomp-v1-sdxl',
|
54 |
'John6666/noobai-xl-nai-xl-vpredtestversion-sdxl',
|
@@ -58,6 +66,7 @@ LOAD_DIFFUSERS_FORMAT_MODEL = [
|
|
58 |
'John6666/illustrious-pencil-xl-v200-sdxl',
|
59 |
'John6666/obsession-illustriousxl-v21-sdxl',
|
60 |
'John6666/obsession-illustriousxl-v30-sdxl',
|
|
|
61 |
'John6666/wai-nsfw-illustrious-v70-sdxl',
|
62 |
'John6666/illustrious-pony-mix-v3-sdxl',
|
63 |
'John6666/nova-anime-xl-illustriousv10-sdxl',
|
@@ -81,6 +90,7 @@ LOAD_DIFFUSERS_FORMAT_MODEL = [
|
|
81 |
'John6666/ras-real-anime-screencap-v1-sdxl',
|
82 |
'John6666/duchaiten-pony-xl-no-score-v60-sdxl',
|
83 |
'John6666/mistoon-anime-ponyalpha-sdxl',
|
|
|
84 |
'John6666/ebara-mfcg-pony-mix-v12-sdxl',
|
85 |
'John6666/t-ponynai3-v51-sdxl',
|
86 |
'John6666/t-ponynai3-v65-sdxl',
|
@@ -156,6 +166,7 @@ DIRECTORY_MODELS = 'models'
|
|
156 |
DIRECTORY_LORAS = 'loras'
|
157 |
DIRECTORY_VAES = 'vaes'
|
158 |
DIRECTORY_EMBEDS = 'embedings'
|
|
|
159 |
|
160 |
CACHE_HF = "/home/user/.cache/huggingface/hub/"
|
161 |
STORAGE_ROOT = "/home/user/"
|
@@ -184,27 +195,21 @@ TASK_STABLEPY = {
|
|
184 |
'optical pattern ControlNet': 'pattern',
|
185 |
'recolor ControlNet': 'recolor',
|
186 |
'tile ControlNet': 'tile',
|
|
|
187 |
}
|
188 |
|
189 |
TASK_MODEL_LIST = list(TASK_STABLEPY.keys())
|
190 |
|
191 |
UPSCALER_DICT_GUI = {
|
192 |
None: None,
|
193 |
-
"
|
194 |
-
"
|
195 |
-
'Latent': 'Latent',
|
196 |
-
'Latent (antialiased)': 'Latent (antialiased)',
|
197 |
-
'Latent (bicubic)': 'Latent (bicubic)',
|
198 |
-
'Latent (bicubic antialiased)': 'Latent (bicubic antialiased)',
|
199 |
-
'Latent (nearest)': 'Latent (nearest)',
|
200 |
-
'Latent (nearest-exact)': 'Latent (nearest-exact)',
|
201 |
-
"RealESRGAN_x4plus": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth",
|
202 |
"RealESRNet_x4plus": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.1/RealESRNet_x4plus.pth",
|
203 |
-
"RealESRGAN_x4plus_anime_6B": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth",
|
204 |
-
"RealESRGAN_x2plus": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth",
|
205 |
-
"realesr-animevideov3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-animevideov3.pth",
|
206 |
-
"realesr-general-x4v3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-x4v3.pth",
|
207 |
-
"realesr-general-wdn-x4v3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-wdn-x4v3.pth",
|
208 |
"4x-UltraSharp": "https://huggingface.co/Shandypur/ESRGAN-4x-UltraSharp/resolve/main/4x-UltraSharp.pth",
|
209 |
"4x_foolhardy_Remacri": "https://huggingface.co/FacehugmanIII/4x_foolhardy_Remacri/resolve/main/4x_foolhardy_Remacri.pth",
|
210 |
"Remacri4xExtraSmoother": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/Remacri%204x%20ExtraSmoother.pth",
|
@@ -219,6 +224,7 @@ UPSCALER_KEYS = list(UPSCALER_DICT_GUI.keys())
|
|
219 |
DIFFUSERS_CONTROLNET_MODEL = [
|
220 |
"Automatic",
|
221 |
|
|
|
222 |
"xinsir/controlnet-union-sdxl-1.0",
|
223 |
"xinsir/anime-painter",
|
224 |
"Eugeoter/noob-sdxl-controlnet-canny",
|
@@ -241,7 +247,6 @@ DIFFUSERS_CONTROLNET_MODEL = [
|
|
241 |
"r3gm/controlnet-recolor-sdxl-fp16",
|
242 |
"r3gm/controlnet-openpose-twins-sdxl-1.0-fp16",
|
243 |
"r3gm/controlnet-qr-pattern-sdxl-fp16",
|
244 |
-
"brad-twinkl/controlnet-union-sdxl-1.0-promax",
|
245 |
"Yakonrus/SDXL_Controlnet_Tile_Realistic_v2",
|
246 |
"TheMistoAI/MistoLine",
|
247 |
"briaai/BRIA-2.3-ControlNet-Recoloring",
|
|
|
4 |
scheduler_names,
|
5 |
SD15_TASKS,
|
6 |
SDXL_TASKS,
|
7 |
+
ALL_BUILTIN_UPSCALERS,
|
8 |
)
|
9 |
|
10 |
# - **Download Models**
|
|
|
44 |
'John6666/ntr-mix-illustrious-xl-noob-xl-ntrmix35-sdxl',
|
45 |
'John6666/ntr-mix-illustrious-xl-noob-xl-v777-sdxl',
|
46 |
'John6666/ntr-mix-illustrious-xl-noob-xl-v777forlora-sdxl',
|
47 |
+
'John6666/ntr-mix-illustrious-xl-noob-xl-xi-sdxl',
|
48 |
+
'John6666/mistoon-anime-v10illustrious-sdxl',
|
49 |
+
'John6666/hassaku-xl-illustrious-v10-sdxl',
|
50 |
+
'John6666/hassaku-xl-illustrious-v10style-sdxl',
|
51 |
'John6666/haruki-mix-illustrious-v10-sdxl',
|
52 |
'John6666/noobreal-v10-sdxl',
|
53 |
'John6666/complicated-noobai-merge-vprediction-sdxl',
|
54 |
+
'Laxhar/noobai-XL-Vpred-0.75s',
|
55 |
+
'Laxhar/noobai-XL-Vpred-0.75',
|
56 |
'Laxhar/noobai-XL-Vpred-0.65s',
|
57 |
'Laxhar/noobai-XL-Vpred-0.65',
|
58 |
'Laxhar/noobai-XL-Vpred-0.6',
|
59 |
+
'John6666/cat-tower-noobai-xl-checkpoint-v14vpred-sdxl',
|
60 |
'John6666/noobai-xl-nai-xl-vpred05version-sdxl',
|
61 |
'John6666/noobai-fusion2-vpred-itercomp-v1-sdxl',
|
62 |
'John6666/noobai-xl-nai-xl-vpredtestversion-sdxl',
|
|
|
66 |
'John6666/illustrious-pencil-xl-v200-sdxl',
|
67 |
'John6666/obsession-illustriousxl-v21-sdxl',
|
68 |
'John6666/obsession-illustriousxl-v30-sdxl',
|
69 |
+
'John6666/obsession-illustriousxl-v31-sdxl',
|
70 |
'John6666/wai-nsfw-illustrious-v70-sdxl',
|
71 |
'John6666/illustrious-pony-mix-v3-sdxl',
|
72 |
'John6666/nova-anime-xl-illustriousv10-sdxl',
|
|
|
90 |
'John6666/ras-real-anime-screencap-v1-sdxl',
|
91 |
'John6666/duchaiten-pony-xl-no-score-v60-sdxl',
|
92 |
'John6666/mistoon-anime-ponyalpha-sdxl',
|
93 |
+
'John6666/mistoon-xl-copper-v20fast-sdxl',
|
94 |
'John6666/ebara-mfcg-pony-mix-v12-sdxl',
|
95 |
'John6666/t-ponynai3-v51-sdxl',
|
96 |
'John6666/t-ponynai3-v65-sdxl',
|
|
|
166 |
DIRECTORY_LORAS = 'loras'
|
167 |
DIRECTORY_VAES = 'vaes'
|
168 |
DIRECTORY_EMBEDS = 'embedings'
|
169 |
+
DIRECTORY_UPSCALERS = 'upscalers'
|
170 |
|
171 |
CACHE_HF = "/home/user/.cache/huggingface/hub/"
|
172 |
STORAGE_ROOT = "/home/user/"
|
|
|
195 |
'optical pattern ControlNet': 'pattern',
|
196 |
'recolor ControlNet': 'recolor',
|
197 |
'tile ControlNet': 'tile',
|
198 |
+
'repaint ControlNet': 'repaint',
|
199 |
}
|
200 |
|
201 |
TASK_MODEL_LIST = list(TASK_STABLEPY.keys())
|
202 |
|
203 |
UPSCALER_DICT_GUI = {
|
204 |
None: None,
|
205 |
+
**{bu: bu for bu in ALL_BUILTIN_UPSCALERS if bu not in ["HAT x4", "DAT x4", "DAT x3", "DAT x2", "SwinIR 4x"]},
|
206 |
+
# "RealESRGAN_x4plus": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
"RealESRNet_x4plus": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.1/RealESRNet_x4plus.pth",
|
208 |
+
# "RealESRGAN_x4plus_anime_6B": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth",
|
209 |
+
# "RealESRGAN_x2plus": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth",
|
210 |
+
# "realesr-animevideov3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-animevideov3.pth",
|
211 |
+
# "realesr-general-x4v3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-x4v3.pth",
|
212 |
+
# "realesr-general-wdn-x4v3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-wdn-x4v3.pth",
|
213 |
"4x-UltraSharp": "https://huggingface.co/Shandypur/ESRGAN-4x-UltraSharp/resolve/main/4x-UltraSharp.pth",
|
214 |
"4x_foolhardy_Remacri": "https://huggingface.co/FacehugmanIII/4x_foolhardy_Remacri/resolve/main/4x_foolhardy_Remacri.pth",
|
215 |
"Remacri4xExtraSmoother": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/Remacri%204x%20ExtraSmoother.pth",
|
|
|
224 |
DIFFUSERS_CONTROLNET_MODEL = [
|
225 |
"Automatic",
|
226 |
|
227 |
+
"brad-twinkl/controlnet-union-sdxl-1.0-promax",
|
228 |
"xinsir/controlnet-union-sdxl-1.0",
|
229 |
"xinsir/anime-painter",
|
230 |
"Eugeoter/noob-sdxl-controlnet-canny",
|
|
|
247 |
"r3gm/controlnet-recolor-sdxl-fp16",
|
248 |
"r3gm/controlnet-openpose-twins-sdxl-1.0-fp16",
|
249 |
"r3gm/controlnet-qr-pattern-sdxl-fp16",
|
|
|
250 |
"Yakonrus/SDXL_Controlnet_Tile_Realistic_v2",
|
251 |
"TheMistoAI/MistoLine",
|
252 |
"briaai/BRIA-2.3-ControlNet-Recoloring",
|
dc.py
CHANGED
@@ -6,8 +6,10 @@ from stablepy import (
|
|
6 |
SCHEDULE_PREDICTION_TYPE_OPTIONS,
|
7 |
check_scheduler_compatibility,
|
8 |
TASK_AND_PREPROCESSORS,
|
|
|
9 |
)
|
10 |
from constants import (
|
|
|
11 |
TASK_STABLEPY,
|
12 |
TASK_MODEL_LIST,
|
13 |
UPSCALER_DICT_GUI,
|
@@ -92,6 +94,10 @@ download_private_repo(HF_VAE_PRIVATE_REPO, DIRECTORY_VAES, False)
|
|
92 |
load_diffusers_format_model = list_uniq(LOAD_DIFFUSERS_FORMAT_MODEL + get_model_id_list())
|
93 |
## END MOD
|
94 |
|
|
|
|
|
|
|
|
|
95 |
# Download stuffs
|
96 |
for url in [url.strip() for url in download_model.split(',')]:
|
97 |
if not os.path.exists(f"./models/{url.split('/')[-1]}"):
|
@@ -138,6 +144,7 @@ flux_pipe = FluxPipeline.from_pretrained(
|
|
138 |
components = flux_pipe.components
|
139 |
components.pop("transformer", None)
|
140 |
delete_model(flux_repo)
|
|
|
141 |
|
142 |
## BEGIN MOD
|
143 |
class GuiSD:
|
@@ -310,8 +317,8 @@ class GuiSD:
|
|
310 |
syntax_weights,
|
311 |
upscaler_model_path,
|
312 |
upscaler_increases_size,
|
313 |
-
|
314 |
-
|
315 |
hires_steps,
|
316 |
hires_denoising_strength,
|
317 |
hires_sampler,
|
@@ -375,6 +382,9 @@ class GuiSD:
|
|
375 |
mode_ip2,
|
376 |
scale_ip2,
|
377 |
pag_scale,
|
|
|
|
|
|
|
378 |
):
|
379 |
info_state = html_template_message("Navigating latent space...")
|
380 |
yield info_state, gr.update(), gr.update()
|
@@ -424,18 +434,15 @@ class GuiSD:
|
|
424 |
if task == "inpaint" and not image_mask:
|
425 |
raise ValueError("No mask image found: Specify one in 'Image Mask'")
|
426 |
|
427 |
-
if
|
428 |
upscaler_model = upscaler_model_path
|
429 |
else:
|
430 |
-
directory_upscalers = 'upscalers'
|
431 |
-
os.makedirs(directory_upscalers, exist_ok=True)
|
432 |
-
|
433 |
url_upscaler = UPSCALER_DICT_GUI[upscaler_model_path]
|
434 |
|
435 |
-
if not os.path.exists(f"./
|
436 |
-
download_things(
|
437 |
|
438 |
-
upscaler_model = f"./
|
439 |
|
440 |
logging.getLogger("ultralytics").setLevel(logging.INFO if adetailer_verbose else logging.ERROR)
|
441 |
|
@@ -539,8 +546,8 @@ class GuiSD:
|
|
539 |
"t2i_adapter_conditioning_factor": float(t2i_adapter_conditioning_factor),
|
540 |
"upscaler_model_path": upscaler_model,
|
541 |
"upscaler_increases_size": upscaler_increases_size,
|
542 |
-
"
|
543 |
-
"
|
544 |
"hires_steps": hires_steps,
|
545 |
"hires_denoising_strength": hires_denoising_strength,
|
546 |
"hires_prompt": hires_prompt,
|
@@ -555,6 +562,9 @@ class GuiSD:
|
|
555 |
"ip_adapter_model": params_ip_model,
|
556 |
"ip_adapter_mode": params_ip_mode,
|
557 |
"ip_adapter_scale": params_ip_scale,
|
|
|
|
|
|
|
558 |
}
|
559 |
|
560 |
# kwargs for diffusers pipeline
|
@@ -705,22 +715,26 @@ def sd_gen_generate_pipeline(*args):
|
|
705 |
|
706 |
|
707 |
@spaces.GPU(duration=15)
|
708 |
-
def
|
709 |
if image is None: return None
|
710 |
|
711 |
from stablepy.diffusers_vanilla.utils import save_pil_image_with_metadata
|
712 |
-
from stablepy import
|
713 |
|
|
|
714 |
exif_image = extract_exif_data(image)
|
715 |
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
|
|
|
|
|
|
721 |
|
722 |
-
scaler_beta =
|
723 |
-
image_up = scaler_beta.upscale(image, upscaler_size,
|
724 |
|
725 |
image_path = save_pil_image_with_metadata(image_up, f'{os.getcwd()}/up_images', exif_image)
|
726 |
|
@@ -760,13 +774,14 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
760 |
value_threshold=0.1, distance_threshold=0.1, recolor_gamma_correction=1., tile_blur_sigma=9,
|
761 |
image_ip1_dict=None, mask_ip1=None, model_ip1="plus_face", mode_ip1="original", scale_ip1=0.7,
|
762 |
image_ip2_dict=None, mask_ip2=None, model_ip2="base", mode_ip2="style", scale_ip2=0.7,
|
763 |
-
upscaler_model_path=None, upscaler_increases_size=1.0,
|
764 |
hires_sampler="Use same sampler", hires_schedule_type="Use same schedule type", hires_guidance_scale=-1, hires_prompt="", hires_negative_prompt="",
|
765 |
adetailer_inpaint_only=True, adetailer_verbose=False, adetailer_sampler="Use same sampler", adetailer_active_a=False,
|
766 |
prompt_ad_a="", negative_prompt_ad_a="", strength_ad_a=0.35, face_detector_ad_a=True, person_detector_ad_a=True, hand_detector_ad_a=False,
|
767 |
mask_dilation_a=4, mask_blur_a=4, mask_padding_a=32, adetailer_active_b=False, prompt_ad_b="", negative_prompt_ad_b="", strength_ad_b=0.35,
|
768 |
face_detector_ad_b=True, person_detector_ad_b=True, hand_detector_ad_b=False, mask_dilation_b=4, mask_blur_b=4, mask_padding_b=32,
|
769 |
-
active_textual_inversion=False,
|
|
|
770 |
MAX_SEED = np.iinfo(np.int32).max
|
771 |
|
772 |
image_mask = image_control_dict['layers'][0] if isinstance(image_control_dict, dict) and not image_mask else image_mask
|
@@ -833,7 +848,7 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
833 |
height, width, model_name, vae, task, image_control, preprocessor_name, preprocess_resolution, image_resolution,
|
834 |
style_prompt, style_json, image_mask, strength, low_threshold, high_threshold, value_threshold, distance_threshold,
|
835 |
recolor_gamma_correction, tile_blur_sigma, control_net_output_scaling, control_net_start_threshold, control_net_stop_threshold,
|
836 |
-
active_textual_inversion, prompt_syntax, upscaler_model_path, upscaler_increases_size,
|
837 |
hires_steps, hires_denoising_strength, hires_sampler, hires_prompt, hires_negative_prompt, hires_before_adetailer, hires_after_adetailer,
|
838 |
hires_schedule_type, hires_guidance_scale, controlnet_model, loop_generation, leave_progress_bar, disable_progress_bar, image_previews,
|
839 |
display_images, save_generated_images, filename_pattern, image_storage_location, retain_compel_previous_load, retain_detailfix_model_previous_load,
|
@@ -842,7 +857,8 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
842 |
strength_ad_a, face_detector_ad_a, person_detector_ad_a, hand_detector_ad_a, mask_dilation_a, mask_blur_a, mask_padding_a,
|
843 |
adetailer_active_b, prompt_ad_b, negative_prompt_ad_b, strength_ad_b, face_detector_ad_b, person_detector_ad_b, hand_detector_ad_b,
|
844 |
mask_dilation_b, mask_blur_b, mask_padding_b, retain_task_cache, guidance_rescale, image_ip1, mask_ip1, model_ip1, mode_ip1, scale_ip1,
|
845 |
-
image_ip2, mask_ip2, model_ip2, mode_ip2, scale_ip2, pag_scale,
|
|
|
846 |
):
|
847 |
images = stream_images if isinstance(stream_images, list) else images
|
848 |
progress(1, desc="Inference completed.")
|
@@ -862,13 +878,14 @@ def _infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidanc
|
|
862 |
value_threshold=0.1, distance_threshold=0.1, recolor_gamma_correction=1., tile_blur_sigma=9,
|
863 |
image_ip1_dict=None, mask_ip1=None, model_ip1="plus_face", mode_ip1="original", scale_ip1=0.7,
|
864 |
image_ip2_dict=None, mask_ip2=None, model_ip2="base", mode_ip2="style", scale_ip2=0.7,
|
865 |
-
upscaler_model_path=None, upscaler_increases_size=1.0,
|
866 |
hires_sampler="Use same sampler", hires_schedule_type="Use same schedule type", hires_guidance_scale=-1, hires_prompt="", hires_negative_prompt="",
|
867 |
adetailer_inpaint_only=True, adetailer_verbose=False, adetailer_sampler="Use same sampler", adetailer_active_a=False,
|
868 |
prompt_ad_a="", negative_prompt_ad_a="", strength_ad_a=0.35, face_detector_ad_a=True, person_detector_ad_a=True, hand_detector_ad_a=False,
|
869 |
mask_dilation_a=4, mask_blur_a=4, mask_padding_a=32, adetailer_active_b=False, prompt_ad_b="", negative_prompt_ad_b="", strength_ad_b=0.35,
|
870 |
face_detector_ad_b=True, person_detector_ad_b=True, hand_detector_ad_b=False, mask_dilation_b=4, mask_blur_b=4, mask_padding_b=32,
|
871 |
-
active_textual_inversion=False,
|
|
|
872 |
return gr.update()
|
873 |
|
874 |
|
|
|
6 |
SCHEDULE_PREDICTION_TYPE_OPTIONS,
|
7 |
check_scheduler_compatibility,
|
8 |
TASK_AND_PREPROCESSORS,
|
9 |
+
FACE_RESTORATION_MODELS,
|
10 |
)
|
11 |
from constants import (
|
12 |
+
DIRECTORY_UPSCALERS,
|
13 |
TASK_STABLEPY,
|
14 |
TASK_MODEL_LIST,
|
15 |
UPSCALER_DICT_GUI,
|
|
|
94 |
load_diffusers_format_model = list_uniq(LOAD_DIFFUSERS_FORMAT_MODEL + get_model_id_list())
|
95 |
## END MOD
|
96 |
|
97 |
+
directories = [DIRECTORY_MODELS, DIRECTORY_LORAS, DIRECTORY_VAES, DIRECTORY_EMBEDS, DIRECTORY_UPSCALERS]
|
98 |
+
for directory in directories:
|
99 |
+
os.makedirs(directory, exist_ok=True)
|
100 |
+
|
101 |
# Download stuffs
|
102 |
for url in [url.strip() for url in download_model.split(',')]:
|
103 |
if not os.path.exists(f"./models/{url.split('/')[-1]}"):
|
|
|
144 |
components = flux_pipe.components
|
145 |
components.pop("transformer", None)
|
146 |
delete_model(flux_repo)
|
147 |
+
# components = None
|
148 |
|
149 |
## BEGIN MOD
|
150 |
class GuiSD:
|
|
|
317 |
syntax_weights,
|
318 |
upscaler_model_path,
|
319 |
upscaler_increases_size,
|
320 |
+
upscaler_tile_size,
|
321 |
+
upscaler_tile_overlap,
|
322 |
hires_steps,
|
323 |
hires_denoising_strength,
|
324 |
hires_sampler,
|
|
|
382 |
mode_ip2,
|
383 |
scale_ip2,
|
384 |
pag_scale,
|
385 |
+
face_restoration_model,
|
386 |
+
face_restoration_visibility,
|
387 |
+
face_restoration_weight,
|
388 |
):
|
389 |
info_state = html_template_message("Navigating latent space...")
|
390 |
yield info_state, gr.update(), gr.update()
|
|
|
434 |
if task == "inpaint" and not image_mask:
|
435 |
raise ValueError("No mask image found: Specify one in 'Image Mask'")
|
436 |
|
437 |
+
if "https://" not in str(UPSCALER_DICT_GUI[upscaler_model_path]):
|
438 |
upscaler_model = upscaler_model_path
|
439 |
else:
|
|
|
|
|
|
|
440 |
url_upscaler = UPSCALER_DICT_GUI[upscaler_model_path]
|
441 |
|
442 |
+
if not os.path.exists(f"./{DIRECTORY_UPSCALERS}/{url_upscaler.split('/')[-1]}"):
|
443 |
+
download_things(DIRECTORY_UPSCALERS, url_upscaler, HF_TOKEN)
|
444 |
|
445 |
+
upscaler_model = f"./{DIRECTORY_UPSCALERS}/{url_upscaler.split('/')[-1]}"
|
446 |
|
447 |
logging.getLogger("ultralytics").setLevel(logging.INFO if adetailer_verbose else logging.ERROR)
|
448 |
|
|
|
546 |
"t2i_adapter_conditioning_factor": float(t2i_adapter_conditioning_factor),
|
547 |
"upscaler_model_path": upscaler_model,
|
548 |
"upscaler_increases_size": upscaler_increases_size,
|
549 |
+
"upscaler_tile_size": upscaler_tile_size,
|
550 |
+
"upscaler_tile_overlap": upscaler_tile_overlap,
|
551 |
"hires_steps": hires_steps,
|
552 |
"hires_denoising_strength": hires_denoising_strength,
|
553 |
"hires_prompt": hires_prompt,
|
|
|
562 |
"ip_adapter_model": params_ip_model,
|
563 |
"ip_adapter_mode": params_ip_mode,
|
564 |
"ip_adapter_scale": params_ip_scale,
|
565 |
+
"face_restoration_model": face_restoration_model,
|
566 |
+
"face_restoration_visibility": face_restoration_visibility,
|
567 |
+
"face_restoration_weight": face_restoration_weight,
|
568 |
}
|
569 |
|
570 |
# kwargs for diffusers pipeline
|
|
|
715 |
|
716 |
|
717 |
@spaces.GPU(duration=15)
|
718 |
+
def process_upscale(image, upscaler_name, upscaler_size):
|
719 |
if image is None: return None
|
720 |
|
721 |
from stablepy.diffusers_vanilla.utils import save_pil_image_with_metadata
|
722 |
+
from stablepy import load_upscaler_model
|
723 |
|
724 |
+
image = image.convert("RGB")
|
725 |
exif_image = extract_exif_data(image)
|
726 |
|
727 |
+
name_upscaler = UPSCALER_DICT_GUI[upscaler_name]
|
728 |
+
|
729 |
+
if "https://" in str(name_upscaler):
|
730 |
+
|
731 |
+
if not os.path.exists(f"./{DIRECTORY_UPSCALERS}/{name_upscaler.split('/')[-1]}"):
|
732 |
+
download_things(DIRECTORY_UPSCALERS, name_upscaler, HF_TOKEN)
|
733 |
+
|
734 |
+
name_upscaler = f"./{DIRECTORY_UPSCALERS}/{name_upscaler.split('/')[-1]}"
|
735 |
|
736 |
+
scaler_beta = load_upscaler_model(model=name_upscaler, tile=0, tile_overlap=8, device="cuda", half=True)
|
737 |
+
image_up = scaler_beta.upscale(image, upscaler_size, True)
|
738 |
|
739 |
image_path = save_pil_image_with_metadata(image_up, f'{os.getcwd()}/up_images', exif_image)
|
740 |
|
|
|
774 |
value_threshold=0.1, distance_threshold=0.1, recolor_gamma_correction=1., tile_blur_sigma=9,
|
775 |
image_ip1_dict=None, mask_ip1=None, model_ip1="plus_face", mode_ip1="original", scale_ip1=0.7,
|
776 |
image_ip2_dict=None, mask_ip2=None, model_ip2="base", mode_ip2="style", scale_ip2=0.7,
|
777 |
+
upscaler_model_path=None, upscaler_increases_size=1.0, upscaler_tile_size=0, upscaler_tile_overlap=8, hires_steps=30, hires_denoising_strength=0.55,
|
778 |
hires_sampler="Use same sampler", hires_schedule_type="Use same schedule type", hires_guidance_scale=-1, hires_prompt="", hires_negative_prompt="",
|
779 |
adetailer_inpaint_only=True, adetailer_verbose=False, adetailer_sampler="Use same sampler", adetailer_active_a=False,
|
780 |
prompt_ad_a="", negative_prompt_ad_a="", strength_ad_a=0.35, face_detector_ad_a=True, person_detector_ad_a=True, hand_detector_ad_a=False,
|
781 |
mask_dilation_a=4, mask_blur_a=4, mask_padding_a=32, adetailer_active_b=False, prompt_ad_b="", negative_prompt_ad_b="", strength_ad_b=0.35,
|
782 |
face_detector_ad_b=True, person_detector_ad_b=True, hand_detector_ad_b=False, mask_dilation_b=4, mask_blur_b=4, mask_padding_b=32,
|
783 |
+
active_textual_inversion=False, face_restoration_model=None, face_restoration_visibility=1., face_restoration_weight=.5,
|
784 |
+
gpu_duration=59, translate=False, recom_prompt=True, progress=gr.Progress(track_tqdm=True)):
|
785 |
MAX_SEED = np.iinfo(np.int32).max
|
786 |
|
787 |
image_mask = image_control_dict['layers'][0] if isinstance(image_control_dict, dict) and not image_mask else image_mask
|
|
|
848 |
height, width, model_name, vae, task, image_control, preprocessor_name, preprocess_resolution, image_resolution,
|
849 |
style_prompt, style_json, image_mask, strength, low_threshold, high_threshold, value_threshold, distance_threshold,
|
850 |
recolor_gamma_correction, tile_blur_sigma, control_net_output_scaling, control_net_start_threshold, control_net_stop_threshold,
|
851 |
+
active_textual_inversion, prompt_syntax, upscaler_model_path, upscaler_increases_size, upscaler_tile_size, upscaler_tile_overlap,
|
852 |
hires_steps, hires_denoising_strength, hires_sampler, hires_prompt, hires_negative_prompt, hires_before_adetailer, hires_after_adetailer,
|
853 |
hires_schedule_type, hires_guidance_scale, controlnet_model, loop_generation, leave_progress_bar, disable_progress_bar, image_previews,
|
854 |
display_images, save_generated_images, filename_pattern, image_storage_location, retain_compel_previous_load, retain_detailfix_model_previous_load,
|
|
|
857 |
strength_ad_a, face_detector_ad_a, person_detector_ad_a, hand_detector_ad_a, mask_dilation_a, mask_blur_a, mask_padding_a,
|
858 |
adetailer_active_b, prompt_ad_b, negative_prompt_ad_b, strength_ad_b, face_detector_ad_b, person_detector_ad_b, hand_detector_ad_b,
|
859 |
mask_dilation_b, mask_blur_b, mask_padding_b, retain_task_cache, guidance_rescale, image_ip1, mask_ip1, model_ip1, mode_ip1, scale_ip1,
|
860 |
+
image_ip2, mask_ip2, model_ip2, mode_ip2, scale_ip2, pag_scale, face_restoration_model, face_restoration_visibility, face_restoration_weight,
|
861 |
+
load_lora_cpu, verbose_info, gpu_duration
|
862 |
):
|
863 |
images = stream_images if isinstance(stream_images, list) else images
|
864 |
progress(1, desc="Inference completed.")
|
|
|
878 |
value_threshold=0.1, distance_threshold=0.1, recolor_gamma_correction=1., tile_blur_sigma=9,
|
879 |
image_ip1_dict=None, mask_ip1=None, model_ip1="plus_face", mode_ip1="original", scale_ip1=0.7,
|
880 |
image_ip2_dict=None, mask_ip2=None, model_ip2="base", mode_ip2="style", scale_ip2=0.7,
|
881 |
+
upscaler_model_path=None, upscaler_increases_size=1.0, upscaler_tile_size=0, upscaler_tile_overlap=8, hires_steps=30, hires_denoising_strength=0.55,
|
882 |
hires_sampler="Use same sampler", hires_schedule_type="Use same schedule type", hires_guidance_scale=-1, hires_prompt="", hires_negative_prompt="",
|
883 |
adetailer_inpaint_only=True, adetailer_verbose=False, adetailer_sampler="Use same sampler", adetailer_active_a=False,
|
884 |
prompt_ad_a="", negative_prompt_ad_a="", strength_ad_a=0.35, face_detector_ad_a=True, person_detector_ad_a=True, hand_detector_ad_a=False,
|
885 |
mask_dilation_a=4, mask_blur_a=4, mask_padding_a=32, adetailer_active_b=False, prompt_ad_b="", negative_prompt_ad_b="", strength_ad_b=0.35,
|
886 |
face_detector_ad_b=True, person_detector_ad_b=True, hand_detector_ad_b=False, mask_dilation_b=4, mask_blur_b=4, mask_padding_b=32,
|
887 |
+
active_textual_inversion=False, face_restoration_model=None, face_restoration_visibility=1., face_restoration_weight=.5,
|
888 |
+
gpu_duration=59, translate=False, recom_prompt=True, progress=gr.Progress(track_tqdm=True)):
|
889 |
return gr.update()
|
890 |
|
891 |
|
llmdolphin.py
CHANGED
@@ -37,6 +37,7 @@ llm_models = {
|
|
37 |
"MN-12B-Lyra-v4-Q4_K_M.gguf": ["bartowski/MN-12B-Lyra-v4-GGUF", MessagesFormatterType.CHATML],
|
38 |
"Lyra4-Gutenberg-12B.Q4_K_M.gguf": ["mradermacher/Lyra4-Gutenberg-12B-GGUF", MessagesFormatterType.CHATML],
|
39 |
"Llama-3.1-8B-EZO-1.1-it.Q5_K_M.gguf": ["mradermacher/Llama-3.1-8B-EZO-1.1-it-GGUF", MessagesFormatterType.MISTRAL],
|
|
|
40 |
"MN-12B-Starcannon-v1.i1-Q4_K_M.gguf": ["mradermacher/MN-12B-Starcannon-v1-i1-GGUF", MessagesFormatterType.MISTRAL],
|
41 |
"MN-12B-Starcannon-v2.i1-Q4_K_M.gguf": ["mradermacher/MN-12B-Starcannon-v2-i1-GGUF", MessagesFormatterType.CHATML],
|
42 |
"MN-12B-Starcannon-v3.i1-Q4_K_M.gguf": ["mradermacher/MN-12B-Starcannon-v3-i1-GGUF", MessagesFormatterType.CHATML],
|
@@ -84,6 +85,59 @@ llm_models = {
|
|
84 |
"ChatWaifu_22B_v2.0_preview.Q4_K_S.gguf": ["mradermacher/ChatWaifu_22B_v2.0_preview-GGUF", MessagesFormatterType.MISTRAL],
|
85 |
"ChatWaifu_v1.4.Q5_K_M.gguf": ["mradermacher/ChatWaifu_v1.4-GGUF", MessagesFormatterType.MISTRAL],
|
86 |
"ChatWaifu_v1.3.1.Q4_K_M.gguf": ["mradermacher/ChatWaifu_v1.3.1-GGUF", MessagesFormatterType.MISTRAL],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
"Josiefied-abliteratedV4-Qwen2.5-14B-Inst-BaseMerge-TIES.Q4_K_M.gguf": ["mradermacher/Josiefied-abliteratedV4-Qwen2.5-14B-Inst-BaseMerge-TIES-GGUF", MessagesFormatterType.OPEN_CHAT],
|
88 |
"InfinityLake-2x7B.i1-Q4_K_M.gguf": ["mradermacher/InfinityLake-2x7B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
89 |
"InfinityKuno-2x7B.i1-Q4_K_M.gguf": ["mradermacher/InfinityKuno-2x7B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
|
|
37 |
"MN-12B-Lyra-v4-Q4_K_M.gguf": ["bartowski/MN-12B-Lyra-v4-GGUF", MessagesFormatterType.CHATML],
|
38 |
"Lyra4-Gutenberg-12B.Q4_K_M.gguf": ["mradermacher/Lyra4-Gutenberg-12B-GGUF", MessagesFormatterType.CHATML],
|
39 |
"Llama-3.1-8B-EZO-1.1-it.Q5_K_M.gguf": ["mradermacher/Llama-3.1-8B-EZO-1.1-it-GGUF", MessagesFormatterType.MISTRAL],
|
40 |
+
"Magnolia-v2-12B.i1-Q4_K_M.gguf": ["mradermacher/Magnolia-v2-12B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
41 |
"MN-12B-Starcannon-v1.i1-Q4_K_M.gguf": ["mradermacher/MN-12B-Starcannon-v1-i1-GGUF", MessagesFormatterType.MISTRAL],
|
42 |
"MN-12B-Starcannon-v2.i1-Q4_K_M.gguf": ["mradermacher/MN-12B-Starcannon-v2-i1-GGUF", MessagesFormatterType.CHATML],
|
43 |
"MN-12B-Starcannon-v3.i1-Q4_K_M.gguf": ["mradermacher/MN-12B-Starcannon-v3-i1-GGUF", MessagesFormatterType.CHATML],
|
|
|
85 |
"ChatWaifu_22B_v2.0_preview.Q4_K_S.gguf": ["mradermacher/ChatWaifu_22B_v2.0_preview-GGUF", MessagesFormatterType.MISTRAL],
|
86 |
"ChatWaifu_v1.4.Q5_K_M.gguf": ["mradermacher/ChatWaifu_v1.4-GGUF", MessagesFormatterType.MISTRAL],
|
87 |
"ChatWaifu_v1.3.1.Q4_K_M.gguf": ["mradermacher/ChatWaifu_v1.3.1-GGUF", MessagesFormatterType.MISTRAL],
|
88 |
+
"Qwen2.5-7B-Instruct-kto.Q5_K_M.gguf": ["mradermacher/Qwen2.5-7B-Instruct-kto-GGUF", MessagesFormatterType.OPEN_CHAT],
|
89 |
+
"Poppy_Porpoise-v0.7-L3-8B.i1-Q5_K_M.gguf": ["mradermacher/Poppy_Porpoise-v0.7-L3-8B-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
90 |
+
"NeuralStar_Story-9b.i1-Q4_K_M.gguf": ["mradermacher/NeuralStar_Story-9b-i1-GGUF", MessagesFormatterType.MISTRAL],
|
91 |
+
"MT5-Gen3-MAG-gemma-2-9B.Q4_K_M.gguf": ["mradermacher/MT5-Gen3-MAG-gemma-2-9B-GGUF", MessagesFormatterType.ALPACA],
|
92 |
+
"MT5-Gen3-MAGBMU-gemma-2-9B.Q4_K_M.gguf": ["mradermacher/MT5-Gen3-MAGBMU-gemma-2-9B-GGUF", MessagesFormatterType.ALPACA],
|
93 |
+
"MT4-Gen3-MM-gemma-2-Rv0.4MT4g2-9B.Q4_K_M.gguf": ["mradermacher/MT4-Gen3-MM-gemma-2-Rv0.4MT4g2-9B-GGUF", MessagesFormatterType.ALPACA],
|
94 |
+
"L3-8B-Poppy-Sunspice-experiment-c.i1-Q5_K_M.gguf": ["mradermacher/L3-8B-Poppy-Sunspice-experiment-c-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
95 |
+
"Gemma-Evo-10B.i1-Q4_K_M.gguf": ["mradermacher/Gemma-Evo-10B-i1-GGUF", MessagesFormatterType.ALPACA],
|
96 |
+
"Gemma2-9B-test-novelistwo.Q4_K_M.gguf": ["mradermacher/Gemma2-9B-test-novelistwo-GGUF", MessagesFormatterType.ALPACA],
|
97 |
+
"Gemma-2-9b-baymax.i1-Q4_K_M.gguf": ["mradermacher/Gemma-2-9b-baymax-i1-GGUF", MessagesFormatterType.ALPACA],
|
98 |
+
"eule-qwen2.5instruct-7b-111224.i1-Q5_K_M.gguf": ["mradermacher/eule-qwen2.5instruct-7b-111224-i1-GGUF", MessagesFormatterType.OPEN_CHAT],
|
99 |
+
"Creative-7B-nerd.i1-Q5_K_M.gguf": ["mradermacher/Creative-7B-nerd-i1-GGUF", MessagesFormatterType.OPEN_CHAT],
|
100 |
+
"FuseChat-Llama-3.1-8B-Instruct-Q5_K_M.gguf": ["bartowski/FuseChat-Llama-3.1-8B-Instruct-GGUF", MessagesFormatterType.LLAMA_3],
|
101 |
+
"Sailor2-8B-Chat-Uncensored.i1-Q4_K_M.gguf": ["mradermacher/Sailor2-8B-Chat-Uncensored-i1-GGUF", MessagesFormatterType.OPEN_CHAT],
|
102 |
+
"oh-dcft-v3.1-llama-3.1-8b.i1-Q5_K_M.gguf": ["mradermacher/oh-dcft-v3.1-llama-3.1-8b-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
103 |
+
"oh-dcft-v3.1-claude-3-5-haiku-20241022.i1-Q5_K_M.gguf": ["mradermacher/oh-dcft-v3.1-claude-3-5-haiku-20241022-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
104 |
+
"NovaSpark.i1-Q5_K_M.gguf": ["mradermacher/NovaSpark-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
105 |
+
"Novaeus-Promptist-7B-Instruct.i1-Q5_K_M.gguf": ["mradermacher/Novaeus-Promptist-7B-Instruct-i1-GGUF", MessagesFormatterType.OPEN_CHAT],
|
106 |
+
"suzume-llama-3-8B-multilingual.i1-Q5_K_M.gguf": ["mradermacher/suzume-llama-3-8B-multilingual-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
107 |
+
"suzume-llama-3-8B-japanese.i1-Q4_K_M.gguf": ["mradermacher/suzume-llama-3-8B-japanese-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
108 |
+
"nepoticide-12B-Unslop-Unleashed-Mell-RPMax.i1-Q4_K_M.gguf": ["mradermacher/nepoticide-12B-Unslop-Unleashed-Mell-RPMax-i1-GGUF", MessagesFormatterType.MISTRAL],
|
109 |
+
"NemoMix-12B-DellaV1b.i1-Q4_K_M.gguf": ["mradermacher/NemoMix-12B-DellaV1b-i1-GGUF", MessagesFormatterType.MISTRAL],
|
110 |
+
"NekoMix-12B.i1-Q4_K_M.gguf": ["mradermacher/NekoMix-12B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
111 |
+
"Moriyasu_Qwen2_JP_7B.Q5_K_M.gguf": ["mradermacher/Moriyasu_Qwen2_JP_7B-GGUF", MessagesFormatterType.OPEN_CHAT],
|
112 |
+
"MN-Funhouse-12B.i1-Q4_K_M.gguf": ["mradermacher/MN-Funhouse-12B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
113 |
+
"Mistralv0.2-Erosumikav2-Franken-Sonya-10.5B.i1-Q4_K_M.gguf": ["mradermacher/Mistralv0.2-Erosumikav2-Franken-Sonya-10.5B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
114 |
+
"Mistral-Reddit-12B.i1-Q4_K_M.gguf": ["mradermacher/Mistral-Reddit-12B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
115 |
+
"MistralMusic.Q5_K_M.gguf": ["mradermacher/MistralMusic-GGUF", MessagesFormatterType.MISTRAL],
|
116 |
+
"miscii-Virtuoso-Small.i1-Q4_K_M.gguf": ["mradermacher/miscii-Virtuoso-Small-i1-GGUF", MessagesFormatterType.OPEN_CHAT],
|
117 |
+
"Mermaid-Dolphin-Mixtral-2x7b.i1-Q4_K_M.gguf": ["mradermacher/Mermaid-Dolphin-Mixtral-2x7b-i1-GGUF", MessagesFormatterType.MISTRAL],
|
118 |
+
"Merged-Tasty-Unsloth-Llama-3.1-8B-v4.Q5_K_M.gguf": ["mradermacher/Merged-Tasty-Unsloth-Llama-3.1-8B-v4-GGUF", MessagesFormatterType.LLAMA_3],
|
119 |
+
"MedWest-7B.i1-Q5_K_M.gguf": ["mradermacher/MedWest-7B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
120 |
+
"Matter-0.1-7B-boost-DPO-preview.i1-Q5_K_M.gguf": ["mradermacher/Matter-0.1-7B-boost-DPO-preview-i1-GGUF", MessagesFormatterType.MISTRAL],
|
121 |
+
"Magnolia-v3-12B.i1-Q4_K_M.gguf": ["mradermacher/Magnolia-v3-12B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
122 |
+
"Llama-TI-8B.i1-Q5_K_M.gguf": ["mradermacher/Llama-TI-8B-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
123 |
+
"Llama3-Chinese-8B-Instruct-Agent-v1.Q5_K_M.gguf": ["mradermacher/Llama3-Chinese-8B-Instruct-Agent-v1-GGUF", MessagesFormatterType.LLAMA_3],
|
124 |
+
"Llama-3-8B-Instruct-DPO-v0.3.i1-Q5_K_M.gguf": ["mradermacher/Llama-3-8B-Instruct-DPO-v0.3-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
125 |
+
"Llama3.1-Reddit-Writer-8B.i1-Q5_K_M.gguf": ["mradermacher/Llama3.1-Reddit-Writer-8B-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
126 |
+
"Llama-3.1-8B-Tortoise.i1-Q5_K_M.gguf": ["mradermacher/Llama-3.1-8B-Tortoise-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
127 |
+
"LightChatAssistant-2x7B.i1-Q4_K_M.gguf": ["mradermacher/LightChatAssistant-2x7B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
128 |
+
"Lamarck-14B-v0.3.i1-Q4_K_M.gguf": ["mradermacher/Lamarck-14B-v0.3-i1-GGUF", MessagesFormatterType.OPEN_CHAT],
|
129 |
+
"lamarck-14b-prose-model_stock.Q4_K_M.gguf": ["mradermacher/lamarck-14b-prose-model_stock-GGUF", MessagesFormatterType.OPEN_CHAT],
|
130 |
+
"L3-ColdBrew-DualCore.i1-Q5_K_M.gguf": ["mradermacher/L3-ColdBrew-DualCore-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
131 |
+
"L3.1-Tiv-10B.i1-Q4_K_M.gguf": ["mradermacher/L3.1-Tiv-10B-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
132 |
+
"L3.1-Sekplus-10B.i1-Q4_K_M.gguf": ["mradermacher/L3.1-Sekplus-10B-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
133 |
+
"KRONOS-8B-V1-P3.Q5_K_M.gguf": ["mradermacher/KRONOS-8B-V1-P3-GGUF", MessagesFormatterType.LLAMA_3],
|
134 |
+
"Gemma2-9B-test-novelist.Q4_K_M.gguf": ["mradermacher/Gemma2-9B-test-novelist-GGUF", MessagesFormatterType.ALPACA],
|
135 |
+
"G2-Nowing-9B.i1-Q4_K_M.gguf": ["mradermacher/G2-Nowing-9B-i1-GGUF", MessagesFormatterType.ALPACA],
|
136 |
+
"G2-Nowing-9B-32K-YS.i1-Q4_K_M.gguf": ["mradermacher/G2-Nowing-9B-32K-YS-i1-GGUF", MessagesFormatterType.ALPACA],
|
137 |
+
"D_AU-Tiefighter-Plus-OrcaMaid-V3-13B-32k-slerp.i1-Q4_K_M.gguf": ["mradermacher/D_AU-Tiefighter-Plus-OrcaMaid-V3-13B-32k-slerp-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
138 |
+
"Baldur-KTO.i1-Q5_K_M.gguf": ["mradermacher/Baldur-KTO-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
139 |
+
"FuseChat-Qwen-2.5-7B-Instruct-Q5_K_M.gguf": ["bartowski/FuseChat-Qwen-2.5-7B-Instruct-GGUF", MessagesFormatterType.OPEN_CHAT],
|
140 |
+
"FuseChat-Gemma-2-9B-Instruct-Q4_K_M.gguf": ["bartowski/FuseChat-Gemma-2-9B-Instruct-GGUF", MessagesFormatterType.ALPACA],
|
141 |
"Josiefied-abliteratedV4-Qwen2.5-14B-Inst-BaseMerge-TIES.Q4_K_M.gguf": ["mradermacher/Josiefied-abliteratedV4-Qwen2.5-14B-Inst-BaseMerge-TIES-GGUF", MessagesFormatterType.OPEN_CHAT],
|
142 |
"InfinityLake-2x7B.i1-Q4_K_M.gguf": ["mradermacher/InfinityLake-2x7B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
143 |
"InfinityKuno-2x7B.i1-Q4_K_M.gguf": ["mradermacher/InfinityKuno-2x7B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
git+https://github.com/R3gm/stablepy.git@
|
2 |
accelerate
|
3 |
diffusers
|
4 |
invisible_watermark
|
|
|
1 |
+
git+https://github.com/R3gm/stablepy.git@5e66972 # -b refactor_sampler_fix
|
2 |
accelerate
|
3 |
diffusers
|
4 |
invisible_watermark
|
utils.py
CHANGED
@@ -300,7 +300,7 @@ def get_model_type(repo_id: str):
|
|
300 |
default = "SD 1.5"
|
301 |
try:
|
302 |
if os.path.exists(repo_id):
|
303 |
-
tag = checkpoint_model_type(repo_id)
|
304 |
return DIFFUSECRAFT_CHECKPOINT_NAME[tag]
|
305 |
else:
|
306 |
model = api.model_info(repo_id=repo_id, timeout=5.0)
|
|
|
300 |
default = "SD 1.5"
|
301 |
try:
|
302 |
if os.path.exists(repo_id):
|
303 |
+
tag, _, _ = checkpoint_model_type(repo_id)
|
304 |
return DIFFUSECRAFT_CHECKPOINT_NAME[tag]
|
305 |
else:
|
306 |
model = api.model_info(repo_id=repo_id, timeout=5.0)
|