""" Global configuration for Indic Heritage Studio v2. MAJOR UPGRADE from v1: - SDXL 1.0-base + DreamShaper-XL fine-tune (vs SD 1.5 in v1) - Stable Video Diffusion (vs AnimateDiff in v1) - IP-Adapter XL for high-fidelity style transfer - Per-style LoRA fine-tunes (loaded on demand) - ControlNet (Canny / Depth / OpenPose) for composition control - Multi-GPU batch processing across all 8 GPUs - 1024×1024 native resolution (vs 512×512 in v1) Built for 8 × NVIDIA 80GB GPUs in dev mode, with the same code running on AMD Radeon Cloud for the final rule-compliant demo. """ from __future__ import annotations import os from dataclasses import dataclass, field from pathlib import Path from typing import List, Optional from dotenv import load_dotenv load_dotenv() @dataclass(frozen=True) class Settings: # ------------------------------------------------------------------ # Paths # ------------------------------------------------------------------ project_root: Path = Path(__file__).resolve().parent.parent assets_dir: Path = field(default_factory=lambda: Path(__file__).resolve().parent.parent / "assets") styles_dir: Path = field(default_factory=lambda: Path(__file__).resolve().parent.parent / "assets" / "styles") outputs_dir: Path = field(default_factory=lambda: Path(__file__).resolve().parent.parent / "outputs") examples_dir: Path = field(default_factory=lambda: Path(__file__).resolve().parent.parent / "examples") lora_dir: Path = field(default_factory=lambda: Path(__file__).resolve().parent.parent / "assets" / "loras") dataset_dir: Path = field(default_factory=lambda: Path(__file__).resolve().parent.parent / "assets" / "datasets") # ------------------------------------------------------------------ # HuggingFace model IDs — v2 upgraded stack # ------------------------------------------------------------------ # Text-to-Image: SDXL 1.0 base + DreamShaper-XL fine-tune # DreamShaper-XL gives a richer, more artistic baseline that responds # well to heritage-style LoRA overlays. t2i_model_id: str = "lykon/dreamshaper-xl-v2-turbo" # turbo = 25 steps, SDXL-native t2i_refiner_id: Optional[str] = "stabilityai/stable-diffusion-xl-refiner-1.0" # SDXL inpainting checkpoint (same family for consistency) inpaint_model_id: str = "diffusers/stable-diffusion-xl-1.0-inpainting-0.1" # IP-Adapter XL — high-fidelity image-conditioned style transfer # IMPORTANT: use the BASE ViT-H variant (not the "plus" variant) # because "plus" has a 1280-dim projection that doesn't match SDXL's # 1664-dim image encoder. The base version is dimension-matched. ip_adapter_model_id: str = "h94/IP-Adapter" ip_adapter_subfolder: str = "sdxl_models" ip_adapter_weight_name: str = "ip-adapter_sdxl_vit-h.safetensors" ip_adapter_plus_weight_name: str = "ip-adapter-plus_sdxl_vit-h.safetensors" image_encoder_id: str = "h94/IP-Adapter/sdxl_models/image_encoder" # Stable Video Diffusion (SVD) — image-to-video, 14-25 frames, 1024×576 svd_model_id: str = "stabilityai/stable-video-diffusion-img2vid-xt-1-1" svd_num_frames: int = 25 svd_fps: int = 8 svd_motion_bucket_id: int = 127 # 1-255, higher = more motion svd_noise_aug_strength: float = 0.02 # AnimateDiff-XL fallback (used if SVD runs out of VRAM or for stylized loops) animatediff_xl_model_id: str = "emilianJR/animatediffXL" animatediff_motion_module: str = "animatediff_motion_lora_sdxl14.safetensors" animatediff_num_frames: int = 16 # ControlNet — SDXL-compatible checkpoints controlnet_canny_id: str = "diffusers/controlnet-canny-sdxl-1.0" controlnet_depth_id: str = "diffusers/controlnet-depth-sdxl-1.0" controlnet_openpose_id: str = "thibaud/controlnet-openpose-sdxl-1.0" # ------------------------------------------------------------------ # Per-style LoRA paths (each LoRA file under assets/loras/