Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -33,6 +33,7 @@ from xora.schedulers.rf import RectifiedFlowScheduler
|
|
33 |
from xora.pipelines.pipeline_xora_video import XoraVideoPipeline
|
34 |
from xora.utils.conditioning_method import ConditioningMethod
|
35 |
from functools import lru_cache
|
|
|
36 |
|
37 |
# 로깅 설정
|
38 |
logging.basicConfig(
|
@@ -80,6 +81,33 @@ def setup_cuda():
|
|
80 |
torch.set_float32_matmul_precision("highest")
|
81 |
logger.info("CUDA settings initialized")
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
# 모델 관리 클래스
|
84 |
class ModelManager:
|
85 |
def __init__(self):
|
|
|
33 |
from xora.pipelines.pipeline_xora_video import XoraVideoPipeline
|
34 |
from xora.utils.conditioning_method import ConditioningMethod
|
35 |
from functools import lru_cache
|
36 |
+
from diffusers.pipelines.flux import FluxPipeline
|
37 |
|
38 |
# 로깅 설정
|
39 |
logging.basicConfig(
|
|
|
81 |
torch.set_float32_matmul_precision("highest")
|
82 |
logger.info("CUDA settings initialized")
|
83 |
|
84 |
+
|
85 |
+
# Model initialization
|
86 |
+
if not path.exists(cache_path):
|
87 |
+
os.makedirs(cache_path, exist_ok=True)
|
88 |
+
|
89 |
+
try:
|
90 |
+
pipe = FluxPipeline.from_pretrained(
|
91 |
+
"black-forest-labs/FLUX.1-dev",
|
92 |
+
torch_dtype=torch.bfloat16,
|
93 |
+
cache_dir=cache_path
|
94 |
+
)
|
95 |
+
lora_path = hf_hub_download(
|
96 |
+
"ByteDance/Hyper-SD",
|
97 |
+
"Hyper-FLUX.1-dev-8steps-lora.safetensors",
|
98 |
+
cache_dir=cache_path
|
99 |
+
)
|
100 |
+
pipe.load_lora_weights(lora_path)
|
101 |
+
pipe.fuse_lora(lora_scale=0.125)
|
102 |
+
pipe.to(device="cuda", dtype=torch.bfloat16)
|
103 |
+
pipe.safety_checker = safety_checker.StableDiffusionSafetyChecker.from_pretrained(
|
104 |
+
"CompVis/stable-diffusion-safety-checker",
|
105 |
+
cache_dir=cache_path
|
106 |
+
)
|
107 |
+
except Exception as e:
|
108 |
+
logger.error(f"Error initializing FluxPipeline: {str(e)}")
|
109 |
+
raise
|
110 |
+
|
111 |
# 모델 관리 클래스
|
112 |
class ModelManager:
|
113 |
def __init__(self):
|