This commit is contained in:
Qing
2023-03-01 21:44:02 +08:00
parent 8e5e4892af
commit 66d3c6e322
7 changed files with 644 additions and 3 deletions

View File

@@ -230,6 +230,18 @@ function ModelSettingBlock() {
'https://ommer-lab.com/research/latent-diffusion-models/',
'https://github.com/CompVis/stable-diffusion'
)
case AIModel.ANYTHING4:
return renderModelDesc(
'andite/anything-v4.0',
'https://huggingface.co/andite/anything-v4.0',
'https://huggingface.co/andite/anything-v4.0'
)
case AIModel.REALISTIC_VISION_1_4:
return renderModelDesc(
'SG161222/Realistic_Vision_V1.4',
'https://huggingface.co/SG161222/Realistic_Vision_V1.4',
'https://huggingface.co/SG161222/Realistic_Vision_V1.4'
)
case AIModel.SD2:
return renderModelDesc(
'Stable Diffusion 2',

View File

@@ -10,6 +10,8 @@ export enum AIModel {
MAT = 'mat',
FCF = 'fcf',
SD15 = 'sd1.5',
ANYTHING4 = 'anything4',
REALISTIC_VISION_1_4 = 'realisticVision1.4',
SD2 = 'sd2',
CV2 = 'cv2',
Mange = 'manga',
@@ -422,6 +424,20 @@ const defaultHDSettings: ModelsHDSettings = {
hdStrategyCropMargin: 128,
enabled: false,
},
[AIModel.ANYTHING4]: {
hdStrategy: HDStrategy.ORIGINAL,
hdStrategyResizeLimit: 768,
hdStrategyCropTrigerSize: 512,
hdStrategyCropMargin: 128,
enabled: false,
},
[AIModel.REALISTIC_VISION_1_4]: {
hdStrategy: HDStrategy.ORIGINAL,
hdStrategyResizeLimit: 768,
hdStrategyCropTrigerSize: 512,
hdStrategyCropMargin: 128,
enabled: false,
},
[AIModel.SD2]: {
hdStrategy: HDStrategy.ORIGINAL,
hdStrategyResizeLimit: 768,
@@ -601,7 +617,12 @@ export const isSDState = selector({
key: 'isSD',
get: ({ get }) => {
const settings = get(settingState)
return settings.model === AIModel.SD15 || settings.model === AIModel.SD2
return (
settings.model === AIModel.SD15 ||
settings.model === AIModel.SD2 ||
settings.model === AIModel.ANYTHING4 ||
settings.model === AIModel.REALISTIC_VISION_1_4
)
},
})

View File

@@ -3,6 +3,8 @@ import os
MPS_SUPPORT_MODELS = [
"instruct_pix2pix",
"sd1.5",
"anything4",
"realisticVision1.4",
"sd2",
"paint_by_example"
]
@@ -15,6 +17,8 @@ AVAILABLE_MODELS = [
"mat",
"fcf",
"sd1.5",
"anything4",
"realisticVision1.4",
"cv2",
"manga",
"sd2",

View File

@@ -136,7 +136,7 @@ class SD(DiffusionInpaintModel):
callback=self.callback,
height=img_h,
width=img_w,
generator=torch.manual_seed(config.sd_seed)
generator=torch.manual_seed(config.sd_seed),
).images[0]
output = (output * 255).round().astype("uint8")
@@ -163,6 +163,16 @@ class SD15(SD):
model_id_or_path = "runwayml/stable-diffusion-inpainting"
class Anything4(SD):
name = "anything4"
model_id_or_path = "Sanster/anything-4.0-inpainting"
class RealisticVision14(SD):
name = "realisticVision1.4"
model_id_or_path = "Sanster/Realistic_Vision_V1.4-inpainting"
class SD2(SD):
name = "sd2"
model_id_or_path = "stabilityai/stable-diffusion-2-inpainting"

View File

@@ -9,7 +9,7 @@ from lama_cleaner.model.manga import Manga
from lama_cleaner.model.mat import MAT
from lama_cleaner.model.paint_by_example import PaintByExample
from lama_cleaner.model.instruct_pix2pix import InstructPix2Pix
from lama_cleaner.model.sd import SD15, SD2
from lama_cleaner.model.sd import SD15, SD2, Anything4, RealisticVision14
from lama_cleaner.model.zits import ZITS
from lama_cleaner.model.opencv2 import OpenCV2
from lama_cleaner.schema import Config
@@ -21,6 +21,8 @@ models = {
"mat": MAT,
"fcf": FcF,
"sd1.5": SD15,
Anything4.name: Anything4,
RealisticVision14.name: RealisticVision14,
"cv2": OpenCV2,
"manga": Manga,
"sd2": SD2,