70 lines
2.5 KiB
Python
70 lines
2.5 KiB
Python
# Common constants for SageUtils
|
|
"""
|
|
This module contains common constants used throughout the SageUtils project.
|
|
These constants help maintain consistency and avoid hardcoded values in multiple files.
|
|
"""
|
|
|
|
# Supported model file extensions (based on ComfyUI's supported_pt_extensions)
|
|
# These are the file types that ComfyUI can load as models
|
|
# Additional extensions (.gguf, .nf4) supported via custom extensions
|
|
MODEL_FILE_EXTENSIONS = {'.ckpt', '.pt', '.pt2', '.bin', '.pth', '.safetensors', '.pkl', '.sft', '.gguf', '.nf4'}
|
|
|
|
# Common model file extensions (most frequently used)
|
|
# Subset of MODEL_FILE_EXTENSIONS for the most common model formats
|
|
COMMON_MODEL_EXTENSIONS = {'.safetensors', '.ckpt'}
|
|
|
|
# Model types supported by the system
|
|
MODEL_TYPES = {
|
|
'CHECKPOINT': 'Checkpoint',
|
|
'LORA': 'LORA',
|
|
'UNET': 'UNET',
|
|
'CLIP': 'CLIP',
|
|
'VAE': 'VAE',
|
|
'CONTROLNET': 'ControlNet',
|
|
'EMBEDDING': 'Embedding',
|
|
'HYPERNETWORK': 'Hypernetwork',
|
|
'UPSCALE': 'Upscale',
|
|
'STYLE': 'Style',
|
|
'GLIGEN': 'GLIGEN',
|
|
'PHOTOMAKER': 'Photomaker'
|
|
}
|
|
|
|
# File size constants
|
|
BYTES_PER_KB = 1024
|
|
BYTES_PER_MB = BYTES_PER_KB * 1024
|
|
BYTES_PER_GB = BYTES_PER_MB * 1024
|
|
|
|
# Cache-related constants
|
|
DEFAULT_CACHE_EXPIRY_DAYS = 7
|
|
MAX_BACKUPS_TO_KEEP = 7
|
|
|
|
# Civitai API related constants
|
|
CIVITAI_BASE_URL = "https://civitai.com/api/v1"
|
|
CIVITAI_MODEL_URL_TEMPLATE = "https://civitai.com/models/{}"
|
|
DEFAULT_REQUEST_TIMEOUT = 30 # seconds
|
|
|
|
# Image size constants for reports
|
|
DEFAULT_THUMBNAIL_WIDTH = 150
|
|
DEFAULT_THUMBNAIL_HEIGHT = 100
|
|
|
|
# Progress reporting
|
|
DEFAULT_BATCH_SIZE = 50
|
|
PROGRESS_UPDATE_INTERVAL = 10 # milliseconds
|
|
|
|
LUMINA2_SYSTEM_PROMPT = {
|
|
"superior": (
|
|
"You are an assistant designed to generate superior images with the superior "
|
|
"degree of image-text alignment based on textual prompts or user prompts."
|
|
),
|
|
"alignment": (
|
|
"You are an assistant designed to generate high-quality images with the "
|
|
"highest degree of image-text alignment based on textual prompts."
|
|
)
|
|
}
|
|
LUMINA2_SYSTEM_PROMPT_TIP = (
|
|
"Lumina2 provide two types of system prompts: "
|
|
"Superior: You are an assistant designed to generate superior images with the superior "
|
|
"degree of image-text alignment based on textual prompts or user prompts. "
|
|
"Alignment: You are an assistant designed to generate high-quality images with the highest "
|
|
"degree of image-text alignment based on textual prompts."
|
|
) |