Spaces:
Sleeping
Sleeping
Fix OMP_NUM_THREADS warning by setting it before torch import
Browse files
app.py
CHANGED
|
@@ -5,7 +5,12 @@ Text-to-Image and Text-to-Video Generation
|
|
| 5 |
This app allows you to run STARFlow inference on Hugging Face GPU infrastructure.
|
| 6 |
"""
|
| 7 |
|
|
|
|
| 8 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
import warnings
|
| 10 |
import gradio as gr
|
| 11 |
import torch
|
|
@@ -16,9 +21,6 @@ from pathlib import Path
|
|
| 16 |
# Suppress harmless warnings
|
| 17 |
warnings.filterwarnings("ignore", category=FutureWarning, message=".*torch.distributed.reduce_op.*")
|
| 18 |
|
| 19 |
-
# Fix OpenMP warning
|
| 20 |
-
os.environ['OMP_NUM_THREADS'] = '1'
|
| 21 |
-
|
| 22 |
# Try to import huggingface_hub for downloading checkpoints
|
| 23 |
try:
|
| 24 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 5 |
This app allows you to run STARFlow inference on Hugging Face GPU infrastructure.
|
| 6 |
"""
|
| 7 |
|
| 8 |
+
# Fix OpenMP warning - MUST be set BEFORE importing torch
|
| 9 |
import os
|
| 10 |
+
os.environ['OMP_NUM_THREADS'] = '1'
|
| 11 |
+
os.environ['MKL_NUM_THREADS'] = '1'
|
| 12 |
+
os.environ['NUMEXPR_NUM_THREADS'] = '1'
|
| 13 |
+
|
| 14 |
import warnings
|
| 15 |
import gradio as gr
|
| 16 |
import torch
|
|
|
|
| 21 |
# Suppress harmless warnings
|
| 22 |
warnings.filterwarnings("ignore", category=FutureWarning, message=".*torch.distributed.reduce_op.*")
|
| 23 |
|
|
|
|
|
|
|
|
|
|
| 24 |
# Try to import huggingface_hub for downloading checkpoints
|
| 25 |
try:
|
| 26 |
from huggingface_hub import hf_hub_download
|