update
This commit is contained in:
@@ -21,19 +21,17 @@ AVAILABLE_MODELS = [
|
||||
"zits",
|
||||
"mat",
|
||||
"fcf",
|
||||
"manga",
|
||||
"cv2",
|
||||
"sd1.5",
|
||||
"sdxl",
|
||||
"anything4",
|
||||
"realisticVision1.4",
|
||||
"cv2",
|
||||
"manga",
|
||||
"sd2",
|
||||
"sdxl",
|
||||
"paint_by_example",
|
||||
"instruct_pix2pix",
|
||||
"kandinsky2.2",
|
||||
"sdxl",
|
||||
]
|
||||
SD15_MODELS = ["sd1.5", "anything4", "realisticVision1.4"]
|
||||
DIFFUSERS_MODEL_FP16_REVERSION = [
|
||||
"runwayml/stable-diffusion-inpainting",
|
||||
"Sanster/anything-4.0-inpainting",
|
||||
@@ -46,26 +44,22 @@ AVAILABLE_DEVICES = ["cuda", "cpu", "mps"]
|
||||
DEFAULT_DEVICE = "cuda"
|
||||
|
||||
NO_HALF_HELP = """
|
||||
Using full precision model.
|
||||
If your generate result is always black or green, use this argument. (sd/paint_by_exmaple)
|
||||
Using full precision(fp32) model.
|
||||
If your diffusion model generate result is always black or green, use this argument.
|
||||
"""
|
||||
|
||||
CPU_OFFLOAD_HELP = """
|
||||
Offloads all models to CPU, significantly reducing vRAM usage. (sd/paint_by_example)
|
||||
Offloads diffusion model's weight to CPU RAM, significantly reducing vRAM usage.
|
||||
"""
|
||||
|
||||
DISABLE_NSFW_HELP = """
|
||||
Disable NSFW checker. (sd/paint_by_example)
|
||||
Disable NSFW checker for diffusion model.
|
||||
"""
|
||||
|
||||
SD_CPU_TEXTENCODER_HELP = """
|
||||
Run Stable Diffusion text encoder model on CPU to save GPU memory.
|
||||
CPU_TEXTENCODER_HELP = """
|
||||
Run diffusion models text encoder on CPU to reduce vRAM usage.
|
||||
"""
|
||||
|
||||
SD_CONTROLNET_HELP = """
|
||||
Run Stable Diffusion normal or inpainting model with ControlNet.
|
||||
"""
|
||||
DEFAULT_SD_CONTROLNET_METHOD = "lllyasviel/control_v11p_sd15_canny"
|
||||
SD_CONTROLNET_CHOICES = [
|
||||
"lllyasviel/control_v11p_sd15_canny",
|
||||
# "lllyasviel/control_v11p_sd15_seg",
|
||||
@@ -74,46 +68,36 @@ SD_CONTROLNET_CHOICES = [
|
||||
"lllyasviel/control_v11f1p_sd15_depth",
|
||||
]
|
||||
|
||||
DEFAULT_SD2_CONTROLNET_METHOD = "thibaud/controlnet-sd21-canny-diffusers"
|
||||
SD2_CONTROLNET_CHOICES = [
|
||||
"thibaud/controlnet-sd21-canny-diffusers",
|
||||
"thibaud/controlnet-sd21-depth-diffusers",
|
||||
"thibaud/controlnet-sd21-openpose-diffusers",
|
||||
]
|
||||
|
||||
DEFAULT_SDXL_CONTROLNET_METHOD = "diffusers/controlnet-canny-sdxl-1.0"
|
||||
SDXL_CONTROLNET_CHOICES = [
|
||||
"thibaud/controlnet-openpose-sdxl-1.0",
|
||||
"destitech/controlnet-inpaint-dreamer-sdxl"
|
||||
"destitech/controlnet-inpaint-dreamer-sdxl",
|
||||
"diffusers/controlnet-canny-sdxl-1.0",
|
||||
"diffusers/controlnet-canny-sdxl-1.0-mid",
|
||||
"diffusers/controlnet-canny-sdxl-1.0-small"
|
||||
"diffusers/controlnet-canny-sdxl-1.0-small",
|
||||
"diffusers/controlnet-depth-sdxl-1.0",
|
||||
"diffusers/controlnet-depth-sdxl-1.0-mid",
|
||||
"diffusers/controlnet-depth-sdxl-1.0-small",
|
||||
]
|
||||
|
||||
SD_LOCAL_MODEL_HELP = """
|
||||
Load Stable Diffusion 1.5 model(ckpt/safetensors) from local path.
|
||||
"""
|
||||
|
||||
LOCAL_FILES_ONLY_HELP = """
|
||||
Use local files only, not connect to Hugging Face server. (sd/paint_by_example)
|
||||
"""
|
||||
|
||||
ENABLE_XFORMERS_HELP = """
|
||||
Enable xFormers optimizations. Requires xformers package has been installed. See: https://github.com/facebookresearch/xformers (sd/paint_by_example)
|
||||
When loading diffusion models, using local files only, not connect to HuggingFace server.
|
||||
"""
|
||||
|
||||
DEFAULT_MODEL_DIR = os.getenv(
|
||||
"XDG_CACHE_HOME", os.path.join(os.path.expanduser("~"), ".cache")
|
||||
)
|
||||
MODEL_DIR_HELP = """
|
||||
Model download directory (by setting XDG_CACHE_HOME environment variable), by default model downloaded to ~/.cache
|
||||
MODEL_DIR_HELP = f"""
|
||||
Model download directory (by setting XDG_CACHE_HOME environment variable), by default model download to {DEFAULT_MODEL_DIR}
|
||||
"""
|
||||
|
||||
OUTPUT_DIR_HELP = """
|
||||
Result images will be saved to output directory automatically without confirmation.
|
||||
Result images will be saved to output directory automatically.
|
||||
"""
|
||||
|
||||
INPUT_HELP = """
|
||||
@@ -125,37 +109,45 @@ GUI_HELP = """
|
||||
Launch Lama Cleaner as desktop app
|
||||
"""
|
||||
|
||||
NO_GUI_AUTO_CLOSE_HELP = """
|
||||
Prevent backend auto close after the GUI window closed.
|
||||
"""
|
||||
|
||||
QUALITY_HELP = """
|
||||
Quality of image encoding, 0-100. Default is 95, higher quality will generate larger file size.
|
||||
"""
|
||||
|
||||
|
||||
class RealESRGANModelName(str, Enum):
|
||||
class Choices(str, Enum):
|
||||
@classmethod
|
||||
def values(cls):
|
||||
return [member.value for member in cls]
|
||||
|
||||
|
||||
class RealESRGANModel(Choices):
|
||||
realesr_general_x4v3 = "realesr-general-x4v3"
|
||||
RealESRGAN_x4plus = "RealESRGAN_x4plus"
|
||||
RealESRGAN_x4plus_anime_6B = "RealESRGAN_x4plus_anime_6B"
|
||||
|
||||
|
||||
RealESRGANModelNameList = [e.value for e in RealESRGANModelName]
|
||||
class Device(Choices):
|
||||
cpu = "cpu"
|
||||
cuda = "cuda"
|
||||
mps = "mps"
|
||||
|
||||
|
||||
class InteractiveSegModel(Choices):
|
||||
vit_b = "vit_b"
|
||||
vit_l = "vit_l"
|
||||
vit_h = "vit_h"
|
||||
mobile_sam = "mobile_sam"
|
||||
|
||||
|
||||
INTERACTIVE_SEG_HELP = "Enable interactive segmentation using Segment Anything."
|
||||
INTERACTIVE_SEG_MODEL_HELP = "Model size: vit_b < vit_l < vit_h. Bigger model size means better segmentation but slower speed."
|
||||
AVAILABLE_INTERACTIVE_SEG_MODELS = ["vit_b", "vit_l", "vit_h", "vit_t"]
|
||||
AVAILABLE_INTERACTIVE_SEG_DEVICES = ["cuda", "cpu", "mps"]
|
||||
REMOVE_BG_HELP = "Enable remove background. Always run on CPU"
|
||||
ANIMESEG_HELP = "Enable anime segmentation. Always run on CPU"
|
||||
REALESRGAN_HELP = "Enable realesrgan super resolution"
|
||||
REALESRGAN_AVAILABLE_DEVICES = ["cpu", "cuda", "mps"]
|
||||
GFPGAN_HELP = (
|
||||
"Enable GFPGAN face restore. To enhance background, use with --enable-realesrgan"
|
||||
)
|
||||
GFPGAN_AVAILABLE_DEVICES = ["cpu", "cuda", "mps"]
|
||||
RESTOREFORMER_HELP = "Enable RestoreFormer face restore. To enhance background, use with --enable-realesrgan"
|
||||
RESTOREFORMER_AVAILABLE_DEVICES = ["cpu", "cuda", "mps"]
|
||||
GIF_HELP = "Enable GIF plugin. Make GIF to compare original and cleaned image"
|
||||
|
||||
|
||||
@@ -164,8 +156,6 @@ class Config(BaseModel):
|
||||
port: int = 8080
|
||||
model: str = DEFAULT_MODEL
|
||||
sd_local_model_path: str = None
|
||||
sd_controlnet: bool = False
|
||||
sd_controlnet_method: str = DEFAULT_SD_CONTROLNET_METHOD
|
||||
device: str = DEFAULT_DEVICE
|
||||
gui: bool = False
|
||||
no_gui_auto_close: bool = False
|
||||
@@ -173,7 +163,6 @@ class Config(BaseModel):
|
||||
cpu_offload: bool = False
|
||||
disable_nsfw: bool = False
|
||||
sd_cpu_textencoder: bool = False
|
||||
enable_xformers: bool = False
|
||||
local_files_only: bool = False
|
||||
model_dir: str = DEFAULT_MODEL_DIR
|
||||
input: str = None
|
||||
@@ -186,7 +175,7 @@ class Config(BaseModel):
|
||||
enable_anime_seg: bool = False
|
||||
enable_realesrgan: bool = False
|
||||
realesrgan_device: str = "cpu"
|
||||
realesrgan_model: str = RealESRGANModelName.realesr_general_x4v3.value
|
||||
realesrgan_model: str = RealESRGANModel.realesr_general_x4v3.value
|
||||
realesrgan_no_half: bool = False
|
||||
enable_gfpgan: bool = False
|
||||
gfpgan_device: str = "cpu"
|
||||
|
||||
Reference in New Issue
Block a user