fix transformers version
This commit is contained in:
		
							parent
							
								
									bf19deec73
								
							
						
					
					
						commit
						261d2fce00
					
				| 
						 | 
				
			
			@ -1,5 +1,8 @@
 | 
			
		|||
import json
 | 
			
		||||
import os
 | 
			
		||||
from enum import Enum
 | 
			
		||||
from pydantic import BaseModel
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MPS_SUPPORT_MODELS = [
 | 
			
		||||
    "instruct_pix2pix",
 | 
			
		||||
| 
						 | 
				
			
			@ -113,3 +116,42 @@ 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"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Config(BaseModel):
 | 
			
		||||
    host: str = "127.0.0.1"
 | 
			
		||||
    port: int = 8080
 | 
			
		||||
    model: str = DEFAULT_MODEL
 | 
			
		||||
    sd_local_model_path: str = None
 | 
			
		||||
    sd_controlnet: bool = False
 | 
			
		||||
    device: str = DEFAULT_DEVICE
 | 
			
		||||
    gui: bool = False
 | 
			
		||||
    no_gui_auto_close: bool = False
 | 
			
		||||
    no_half: bool = False
 | 
			
		||||
    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
 | 
			
		||||
    output_dir: str = None
 | 
			
		||||
    # plugins
 | 
			
		||||
    enable_interactive_seg: bool = False
 | 
			
		||||
    enable_remove_bg: bool = False
 | 
			
		||||
    enable_realesrgan: bool = False
 | 
			
		||||
    realesrgan_device: str = "cpu"
 | 
			
		||||
    realesrgan_model: str = RealESRGANModelName.realesr_general_x4v3.value
 | 
			
		||||
    enable_gfpgan: bool = False
 | 
			
		||||
    gfpgan_device: str = "cpu"
 | 
			
		||||
    enable_restoreformer: bool = False
 | 
			
		||||
    restoreformer_device: str = "cpu"
 | 
			
		||||
    enable_gif: bool = False
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def load_config(installer_config: str):
 | 
			
		||||
    if os.path.exists(installer_config):
 | 
			
		||||
        with open(installer_config, "r", encoding="utf-8") as f:
 | 
			
		||||
            return Config(**json.load(f))
 | 
			
		||||
    else:
 | 
			
		||||
        return Config()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -166,8 +166,6 @@ def parse_args():
 | 
			
		|||
        exit()
 | 
			
		||||
 | 
			
		||||
    if args.load_installer_config:
 | 
			
		||||
        from lama_cleaner.web_config import load_config
 | 
			
		||||
 | 
			
		||||
        if args.installer_config and not os.path.exists(args.installer_config):
 | 
			
		||||
            parser.error(f"args.installer_config={args.installer_config} not exists")
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,52 +4,12 @@ from datetime import datetime
 | 
			
		|||
 | 
			
		||||
import gradio as gr
 | 
			
		||||
from loguru import logger
 | 
			
		||||
from pydantic import BaseModel
 | 
			
		||||
 | 
			
		||||
from lama_cleaner.const import *
 | 
			
		||||
 | 
			
		||||
_config_file = None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Config(BaseModel):
 | 
			
		||||
    host: str = "127.0.0.1"
 | 
			
		||||
    port: int = 8080
 | 
			
		||||
    model: str = DEFAULT_MODEL
 | 
			
		||||
    sd_local_model_path: str = None
 | 
			
		||||
    sd_controlnet: bool = False
 | 
			
		||||
    device: str = DEFAULT_DEVICE
 | 
			
		||||
    gui: bool = False
 | 
			
		||||
    no_gui_auto_close: bool = False
 | 
			
		||||
    no_half: bool = False
 | 
			
		||||
    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
 | 
			
		||||
    output_dir: str = None
 | 
			
		||||
    # plugins
 | 
			
		||||
    enable_interactive_seg: bool = False
 | 
			
		||||
    enable_remove_bg: bool = False
 | 
			
		||||
    enable_realesrgan: bool = False
 | 
			
		||||
    realesrgan_device: str = "cpu"
 | 
			
		||||
    realesrgan_model: str = RealESRGANModelName.realesr_general_x4v3.value
 | 
			
		||||
    enable_gfpgan: bool = False
 | 
			
		||||
    gfpgan_device: str = "cpu"
 | 
			
		||||
    enable_restoreformer: bool = False
 | 
			
		||||
    restoreformer_device: str = "cpu"
 | 
			
		||||
    enable_gif: bool = False
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def load_config(installer_config: str):
 | 
			
		||||
    if os.path.exists(installer_config):
 | 
			
		||||
        with open(installer_config, "r", encoding="utf-8") as f:
 | 
			
		||||
            return Config(**json.load(f))
 | 
			
		||||
    else:
 | 
			
		||||
        return Config()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def save_config(
 | 
			
		||||
    host,
 | 
			
		||||
    port,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ yacs
 | 
			
		|||
markupsafe==2.0.1
 | 
			
		||||
scikit-image==0.19.3
 | 
			
		||||
diffusers[torch]==0.14.0
 | 
			
		||||
transformers>=4.25.1
 | 
			
		||||
transformers==4.27.4
 | 
			
		||||
gradio
 | 
			
		||||
piexif==1.1.3
 | 
			
		||||
safetensors
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue