Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mm): revised starter models #6025

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions invokeai/app/api/routers/model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from invokeai.backend.model_manager.metadata.fetch.huggingface import HuggingFaceMetadataFetch
from invokeai.backend.model_manager.metadata.metadata_base import ModelMetadataWithFiles, UnknownMetadataException
from invokeai.backend.model_manager.search import ModelSearch
from invokeai.backend.model_manager.starter_models import STARTER_MODELS, StarterModel
from invokeai.backend.model_manager.starter_models import STARTER_MODELS, StarterModel, StarterModelWithoutDependencies

from ..dependencies import ApiDependencies

Expand Down Expand Up @@ -800,9 +800,9 @@ async def get_starter_models() -> list[StarterModel]:
if model.source in installed_model_sources:
model.is_installed = True
# Remove already-installed dependencies
missing_deps: list[str] = []
missing_deps: list[StarterModelWithoutDependencies] = []
for dep in model.dependencies or []:
if dep not in installed_model_sources:
if dep.source not in installed_model_sources:
missing_deps.append(dep)
model.dependencies = missing_deps

Expand Down
186 changes: 96 additions & 90 deletions invokeai/backend/model_manager/starter_models.py
Original file line number Diff line number Diff line change
@@ -1,147 +1,162 @@
from dataclasses import dataclass
from typing import Optional

from pydantic import BaseModel

from invokeai.backend.model_manager.config import BaseModelType, ModelType


@dataclass
class StarterModel:
class StarterModelWithoutDependencies(BaseModel):
description: str
source: str
name: str
base: BaseModelType
type: ModelType
# Optional list of model source dependencies that need to be installed before this model can be used
dependencies: Optional[list[str]] = None
is_installed: bool = False


class StarterModel(StarterModelWithoutDependencies):
# Optional list of model source dependencies that need to be installed before this model can be used
dependencies: Optional[list[StarterModelWithoutDependencies]] = None


sdxl_fp16_vae_fix = StarterModel(
name="sdxl-vae-fp16-fix",
base=BaseModelType.StableDiffusionXL,
source="madebyollin/sdxl-vae-fp16-fix",
description="SDXL VAE that works with FP16.",
type=ModelType.VAE,
)

ip_adapter_sd_image_encoder = StarterModel(
name="IP Adapter SD1.5 Image Encoder",
base=BaseModelType.StableDiffusion1,
source="InvokeAI/ip_adapter_sd_image_encoder",
description="IP Adapter SD Image Encoder",
type=ModelType.CLIPVision,
)

ip_adapter_sdxl_image_encoder = StarterModel(
name="IP Adapter SDXL Image Encoder",
base=BaseModelType.StableDiffusionXL,
source="InvokeAI/ip_adapter_sdxl_image_encoder",
description="IP Adapter SDXL Image Encoder",
type=ModelType.CLIPVision,
)

cyberrealistic_negative = StarterModel(
name="CyberRealistic Negative v3",
base=BaseModelType.StableDiffusion1,
source="https://huggingface.co/cyberdelia/CyberRealistic_Negative/resolve/main/CyberRealistic_Negative_v3.pt",
description="Negative embedding specifically for use with CyberRealistic.",
type=ModelType.TextualInversion,
)

# List of starter models, displayed on the frontend.
# The order/sort of this list is not changed by the frontend - set it how you want it here.
STARTER_MODELS: list[StarterModel] = [
# region: Main
StarterModel(
name="SD 1.5 (base)",
base=BaseModelType.StableDiffusion1,
source="runwayml/stable-diffusion-v1-5",
description="Stable Diffusion version 1.5 diffusers model (4.27 GB)",
type=ModelType.Main,
),
StarterModel(
name="SD 1.5 (inpainting)",
base=BaseModelType.StableDiffusion1,
source="runwayml/stable-diffusion-inpainting",
description="RunwayML SD 1.5 model optimized for inpainting, diffusers version (4.27 GB)",
type=ModelType.Main,
),
StarterModel(
name="Analog Diffusion",
base=BaseModelType.StableDiffusion1,
source="wavymulder/Analog-Diffusion",
description="An SD-1.5 model trained on diverse analog photographs (2.13 GB)",
type=ModelType.Main,
),
StarterModel(
name="Deliberate v5",
base=BaseModelType.StableDiffusion1,
source="https://huggingface.co/XpucT/Deliberate/resolve/main/Deliberate_v5.safetensors",
description="Versatile model that produces detailed images up to 768px (4.27 GB)",
type=ModelType.Main,
),
StarterModel(
name="Dungeons and Diffusion",
name="CyberRealistic v4.1",
base=BaseModelType.StableDiffusion1,
source="0xJustin/Dungeons-and-Diffusion",
description="Dungeons & Dragons characters (2.13 GB)",
source="https://huggingface.co/cyberdelia/CyberRealistic/resolve/main/CyberRealistic_V4.1_FP16.safetensors",
description="Photorealistic model. See other variants in HF repo 'cyberdelia/CyberRealistic'.",
type=ModelType.Main,
dependencies=[cyberrealistic_negative],
),
StarterModel(
name="dreamlike photoreal v2",
name="ReV Animated",
base=BaseModelType.StableDiffusion1,
source="dreamlike-art/dreamlike-photoreal-2.0",
description="A photorealistic model trained on 768 pixel images based on SD 1.5 (2.13 GB)",
source="stablediffusionapi/rev-animated",
description="Fantasy and anime style images.",
type=ModelType.Main,
),
StarterModel(
name="Inkpunk Diffusion",
name="Dreamshaper 8",
base=BaseModelType.StableDiffusion1,
source="Envvi/Inkpunk-Diffusion",
description='Stylized illustrations inspired by Gorillaz, FLCL and Shinkawa; prompt with "nvinkpunk" (4.27 GB)',
source="Lykon/dreamshaper-8",
description="Popular versatile model.",
type=ModelType.Main,
),
StarterModel(
name="OpenJourney",
name="Dreamshaper 8 (inpainting)",
base=BaseModelType.StableDiffusion1,
source="prompthero/openjourney",
description='An SD 1.5 model fine tuned on Midjourney; prompt with "mdjrny-v4 style" (2.13 GB)',
source="Lykon/dreamshaper-8-inpainting",
description="Inpainting version of Dreamshaper 8.",
type=ModelType.Main,
),
StarterModel(
name="seek.art MEGA",
name="Deliberate v5",
base=BaseModelType.StableDiffusion1,
source="coreco/seek.art_MEGA",
description='A general use SD-1.5 "anything" model that supports multiple styles (2.1 GB)',
source="https://huggingface.co/XpucT/Deliberate/resolve/main/Deliberate_v5.safetensors",
description="Popular versatile model",
type=ModelType.Main,
),
StarterModel(
name="TrinArt v2",
name="Deliberate v5 (inpainting)",
base=BaseModelType.StableDiffusion1,
source="naclbit/trinart_stable_diffusion_v2",
description="An SD-1.5 model finetuned with ~40K assorted high resolution manga/anime-style images (2.13 GB)",
source="https://huggingface.co/XpucT/Deliberate/resolve/main/Deliberate_v5-inpainting.safetensors",
description="Inpainting version of Deliberate v5.",
type=ModelType.Main,
),
StarterModel(
name="SD 2.1 (base)",
base=BaseModelType.StableDiffusion2,
source="stabilityai/stable-diffusion-2-1",
description="Stable Diffusion version 2.1 diffusers model, trained on 768 pixel images (5.21 GB)",
name="Juggernaut XL v9",
base=BaseModelType.StableDiffusionXL,
source="RunDiffusion/Juggernaut-XL-v9",
description="Photograph-focused model.",
type=ModelType.Main,
dependencies=[sdxl_fp16_vae_fix],
),
StarterModel(
name="SD 2.0 (inpainting)",
base=BaseModelType.StableDiffusion2,
source="stabilityai/stable-diffusion-2-inpainting",
description="Stable Diffusion version 2.0 inpainting model (5.21 GB)",
name="Proteus",
base=BaseModelType.StableDiffusionXL,
source="dataautogpt3/Proteus-RunDiffusion",
description="Diverse model with a unique prompting system. Use CLIP Skip 2.",
type=ModelType.Main,
dependencies=[sdxl_fp16_vae_fix],
),
StarterModel(
name="SDXL (base)",
name="Dreamshaper XL v2 Turbo",
base=BaseModelType.StableDiffusionXL,
source="stabilityai/stable-diffusion-xl-base-1.0",
description="Stable Diffusion XL base model (12 GB)",
source="Lykon/dreamshaper-xl-v2-turbo",
description="For turbo, use CFG Scale 2, 4-8 steps, DPM++ SDE Karras. For non-turbo, use CFG Scale 6, 20-40 steps, DPM++ 2M SDE Karras.",
type=ModelType.Main,
dependencies=[sdxl_fp16_vae_fix],
),
StarterModel(
name="SDXL Refiner",
base=BaseModelType.StableDiffusionXLRefiner,
source="stabilityai/stable-diffusion-xl-refiner-1.0",
description="Stable Diffusion XL refiner model (12 GB)",
description="The OG Stable Diffusion XL refiner model.",
type=ModelType.Main,
dependencies=[sdxl_fp16_vae_fix],
),
# endregion
# region VAE
sdxl_fp16_vae_fix,
# endregion
# region LoRA
StarterModel(
name="sdxl-vae-fp16-fix",
name="Alien Style",
base=BaseModelType.StableDiffusionXL,
source="madebyollin/sdxl-vae-fp16-fix",
description="Version of the SDXL-1.0 VAE that works in half precision mode",
type=ModelType.VAE,
source="https://huggingface.co/RalFinger/alien-style-lora-sdxl/resolve/main/alienzkin-sdxl.safetensors",
description="Futuristic, intricate alien styles. Trigger with 'alienzkin'.",
type=ModelType.LoRA,
),
# endregion
# region LoRA
StarterModel(
name="FlatColor",
base=BaseModelType.StableDiffusion1,
source="https://civitai.com/models/6433/loraflatcolor",
description="A LoRA that generates scenery using solid blocks of color",
name="Noodles Style",
base=BaseModelType.StableDiffusionXL,
source="https://huggingface.co/RalFinger/noodles-lora-sdxl/resolve/main/noodlez-sdxl.safetensors",
description="Never-ending, no-holds-barred, noodle nightmare. Trigger with 'noodlez'.",
type=ModelType.LoRA,
psychedelicious marked this conversation as resolved.
Show resolved Hide resolved
),
# endregion
# region TI
StarterModel(
name="Ink scenery",
name="EasyNegative",
base=BaseModelType.StableDiffusion1,
source="https://civitai.com/api/download/models/83390",
description="Generate india ink-like landscapes",
type=ModelType.LoRA,
source="https://huggingface.co/embed/EasyNegative/resolve/main/EasyNegative.safetensors",
description="A textual inversion to use in the negative prompt to reduce bad anatomy",
type=ModelType.TextualInversion,
),
# endregion
# region IP Adapter
Expand All @@ -151,31 +166,31 @@ class StarterModel:
source="InvokeAI/ip_adapter_sd15",
description="IP-Adapter for SD 1.5 models",
type=ModelType.IPAdapter,
dependencies=["InvokeAI/ip_adapter_sd_image_encoder"],
dependencies=[ip_adapter_sd_image_encoder],
),
StarterModel(
name="IP Adapter Plus",
base=BaseModelType.StableDiffusion1,
source="InvokeAI/ip_adapter_plus_sd15",
description="Refined IP-Adapter for SD 1.5 models",
type=ModelType.IPAdapter,
dependencies=["InvokeAI/ip_adapter_sd_image_encoder"],
dependencies=[ip_adapter_sd_image_encoder],
),
StarterModel(
name="IP Adapter Plus Face",
base=BaseModelType.StableDiffusion1,
source="InvokeAI/ip_adapter_plus_face_sd15",
description="Refined IP-Adapter for SD 1.5 models, adapted for faces",
type=ModelType.IPAdapter,
dependencies=["InvokeAI/ip_adapter_sd_image_encoder"],
dependencies=[ip_adapter_sd_image_encoder],
),
StarterModel(
name="IP Adapter SDXL",
base=BaseModelType.StableDiffusionXL,
source="InvokeAI/ip_adapter_sdxl",
description="IP-Adapter for SDXL models",
type=ModelType.IPAdapter,
dependencies=["InvokeAI/ip_adapter_sdxl_image_encoder"],
dependencies=[ip_adapter_sdxl_image_encoder],
),
# endregion
# region ControlNet
Expand Down Expand Up @@ -378,15 +393,6 @@ class StarterModel:
type=ModelType.T2IAdapter,
),
# endregion
# region TI
StarterModel(
name="EasyNegative",
base=BaseModelType.StableDiffusion1,
source="https://huggingface.co/embed/EasyNegative/resolve/main/EasyNegative.safetensors",
description="A textual inversion to use in the negative prompt to reduce bad anatomy",
type=ModelType.TextualInversion,
),
# endregion
]

assert len(STARTER_MODELS) == len({m.source for m in STARTER_MODELS}), "Duplicate starter models"
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const StarterModelsResultItem = ({ result }: Props) => {
const allSources = useMemo(() => {
const _allSources = [result.source];
if (result.dependencies) {
_allSources.push(...result.dependencies);
_allSources.push(...result.dependencies.map((d) => d.source));
}
return _allSources;
}, [result]);
Expand Down
Loading
Loading