feature/refactor/fix: better defaults. correct version in metadata
- feature: use different default steps and image sizes depending on sampler and model selceted - fix: #110 use proper version in image metadata - refactor: samplers all have their own class that inherits from ImageSamplerpull/112/head
parent
60620e0312
commit
015088507f
@ -0,0 +1,54 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
DEFAULT_MODEL = "SD-1.5"
|
||||
DEFAULT_SAMPLER = "k_dpmpp_2m"
|
||||
|
||||
|
||||
@dataclass
|
||||
class ModelConfig:
|
||||
short_name: str
|
||||
config_path: str
|
||||
weights_url: str
|
||||
default_image_size: int
|
||||
|
||||
|
||||
MODEL_CONFIGS = [
|
||||
ModelConfig(
|
||||
short_name="SD-1.4",
|
||||
config_path="configs/stable-diffusion-v1.yaml",
|
||||
weights_url="https://huggingface.co/bstddev/sd-v1-4/resolve/77221977fa8de8ab8f36fac0374c120bd5b53287/sd-v1-4.ckpt",
|
||||
default_image_size=512,
|
||||
),
|
||||
ModelConfig(
|
||||
short_name="SD-1.5",
|
||||
config_path="configs/stable-diffusion-v1.yaml",
|
||||
weights_url="https://huggingface.co/acheong08/SD-V1-5-cloned/resolve/fc392f6bd4345b80fc2256fa8aded8766b6c629e/v1-5-pruned-emaonly.ckpt",
|
||||
default_image_size=512,
|
||||
),
|
||||
ModelConfig(
|
||||
short_name="SD-1.5-inpaint",
|
||||
config_path="configs/stable-diffusion-v1-inpaint.yaml",
|
||||
weights_url="https://huggingface.co/julienacquaviva/inpainting/resolve/2155ff7fe38b55f4c0d99c2f1ab9b561f8311ca7/sd-v1-5-inpainting.ckpt",
|
||||
default_image_size=512,
|
||||
),
|
||||
ModelConfig(
|
||||
short_name="SD-2.0",
|
||||
config_path="configs/stable-diffusion-v2-inference.yaml",
|
||||
weights_url="https://huggingface.co/stabilityai/stable-diffusion-2-base/resolve/main/512-base-ema.ckpt",
|
||||
default_image_size=512,
|
||||
),
|
||||
ModelConfig(
|
||||
short_name="SD-2.0-inpaint",
|
||||
config_path="configs/stable-diffusion-v2-inpainting-inference.yaml",
|
||||
weights_url="https://huggingface.co/stabilityai/stable-diffusion-2-inpainting/resolve/main/512-inpainting-ema.ckpt",
|
||||
default_image_size=512,
|
||||
),
|
||||
ModelConfig(
|
||||
short_name="SD-2.0-v",
|
||||
config_path="configs/stable-diffusion-v2-inference-v.yaml",
|
||||
weights_url="https://huggingface.co/stabilityai/stable-diffusion-2/resolve/main/768-v-ema.ckpt",
|
||||
default_image_size=768,
|
||||
),
|
||||
]
|
||||
|
||||
MODEL_CONFIG_SHORTCUTS = {m.short_name: m for m in MODEL_CONFIGS}
|
@ -0,0 +1,22 @@
|
||||
from imaginairy.samplers import kdiff
|
||||
from imaginairy.samplers.base import SamplerName # noqa
|
||||
from imaginairy.samplers.ddim import DDIMSampler
|
||||
from imaginairy.samplers.plms import PLMSSampler
|
||||
|
||||
SAMPLERS = [
|
||||
PLMSSampler,
|
||||
DDIMSampler,
|
||||
kdiff.DPMFastSampler,
|
||||
kdiff.DPMAdaptiveSampler,
|
||||
kdiff.LMSSampler,
|
||||
kdiff.DPM2Sampler,
|
||||
kdiff.DPM2AncestralSampler,
|
||||
kdiff.DPMPP2MSampler,
|
||||
kdiff.DPMPP2SAncestralSampler,
|
||||
kdiff.EulerSampler,
|
||||
kdiff.EulerAncestralSampler,
|
||||
kdiff.HeunSampler,
|
||||
]
|
||||
|
||||
SAMPLER_LOOKUP = {sampler.short_name: sampler for sampler in SAMPLERS}
|
||||
SAMPLER_TYPE_OPTIONS = [sampler.short_name for sampler in SAMPLERS]
|
Binary file not shown.
Before Width: | Height: | Size: 458 KiB |
Binary file not shown.
Before Width: | Height: | Size: 460 KiB |
Loading…
Reference in New Issue