Spaces:
Runtime error
Runtime error
File size: 2,209 Bytes
0e805d4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
"""Configuration and quality presets for asset generation."""
from dataclasses import dataclass
from typing import Dict
@dataclass
class QualityPreset:
"""Quality preset configuration."""
name: str
flux_steps: int
flux_guidance: float
hunyuan_steps: int
hunyuan_guidance: float
octree_resolution: int
texture_resolution: int
num_chunks: int
estimated_time_s: int
# Quality presets (optimized for L4 GPU)
QUALITY_PRESETS: Dict[str, QualityPreset] = {
"Fast": QualityPreset(
name="Fast",
flux_steps=10,
flux_guidance=3.5,
hunyuan_steps=10,
hunyuan_guidance=5.5,
octree_resolution=384,
texture_resolution=2048,
num_chunks=8000,
estimated_time_s=45
),
"Balanced": QualityPreset(
name="Balanced",
flux_steps=15,
flux_guidance=3.5,
hunyuan_steps=25,
hunyuan_guidance=6.0,
octree_resolution=512,
texture_resolution=2048,
num_chunks=10000,
estimated_time_s=60
),
"High": QualityPreset(
name="High",
flux_steps=25,
flux_guidance=3.5,
hunyuan_steps=35,
hunyuan_guidance=6.5,
octree_resolution=512,
texture_resolution=4096,
num_chunks=12000,
estimated_time_s=90
),
"Ultra": QualityPreset(
name="Ultra",
flux_steps=30,
flux_guidance=3.5,
hunyuan_steps=50,
hunyuan_guidance=7.0,
octree_resolution=512,
texture_resolution=4096,
num_chunks=15000,
estimated_time_s=120
),
}
# FLUX model configuration
FLUX_MODELS = {
"dev": "black-forest-labs/FLUX.1-dev",
}
# Hunyuan3D configuration
HUNYUAN_SETTINGS = {
"space_id": "tencent/Hunyuan3D-2.1",
"timeout": 300.0,
"connect_timeout": 60.0,
}
# Cache configuration
CACHE_EXPIRY_HOURS = 24
MAX_CACHE_SIZE_GB = 10
# Security configuration
MAX_PROMPT_LENGTH = 500
MAX_REQUESTS_PER_HOUR = 10
REQUEST_WINDOW_SECONDS = 3600
MAX_FILE_SIZE_MB = 100
# GPU configuration
PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True,max_split_size_mb:512"
ENABLE_TF32 = True
ENABLE_CUDNN_BENCHMARK = True
|