Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,6 +28,9 @@ if not os.path.exists(REPO_PATH):
|
|
| 28 |
print(f"Error cloning repository: {e.stderr.decode()}")
|
| 29 |
sys.exit(1)
|
| 30 |
|
|
|
|
|
|
|
|
|
|
| 31 |
# Now that the repo is in the path, we can import its modules
|
| 32 |
from huggingface_hub import snapshot_download
|
| 33 |
from longcat_video.pipeline_longcat_video import LongCatVideoPipeline
|
|
@@ -35,12 +38,8 @@ from longcat_video.modules.scheduling_flow_match_euler_discrete import FlowMatch
|
|
| 35 |
from longcat_video.modules.autoencoder_kl_wan import AutoencoderKLWan
|
| 36 |
from longcat_video.modules.longcat_video_dit import LongCatVideoTransformer3DModel
|
| 37 |
from longcat_video.context_parallel import context_parallel_util
|
| 38 |
-
from transformers import AutoTokenizer, UMT5EncoderModel
|
| 39 |
from diffusers.utils import export_to_video
|
| 40 |
|
| 41 |
-
# Add the cloned repository to the Python path to allow imports
|
| 42 |
-
sys.path.insert(0, os.path.abspath(REPO_PATH))
|
| 43 |
-
|
| 44 |
# Download model weights from Hugging Face Hub if they don't exist
|
| 45 |
if not os.path.exists(CHECKPOINT_DIR):
|
| 46 |
print(f"Downloading model weights to '{CHECKPOINT_DIR}'...")
|
|
@@ -56,8 +55,6 @@ if not os.path.exists(CHECKPOINT_DIR):
|
|
| 56 |
print(f"Error downloading model weights: {e}")
|
| 57 |
sys.exit(1)
|
| 58 |
|
| 59 |
-
# --- 2. Global Variables & Model Loading (in Global Context) ---
|
| 60 |
-
|
| 61 |
# Global placeholder for the pipeline and device configuration
|
| 62 |
pipe = None
|
| 63 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 28 |
print(f"Error cloning repository: {e.stderr.decode()}")
|
| 29 |
sys.exit(1)
|
| 30 |
|
| 31 |
+
# Add the cloned repository to the Python path to allow imports
|
| 32 |
+
sys.path.insert(0, os.path.abspath(REPO_PATH))
|
| 33 |
+
|
| 34 |
# Now that the repo is in the path, we can import its modules
|
| 35 |
from huggingface_hub import snapshot_download
|
| 36 |
from longcat_video.pipeline_longcat_video import LongCatVideoPipeline
|
|
|
|
| 38 |
from longcat_video.modules.autoencoder_kl_wan import AutoencoderKLWan
|
| 39 |
from longcat_video.modules.longcat_video_dit import LongCatVideoTransformer3DModel
|
| 40 |
from longcat_video.context_parallel import context_parallel_util
|
|
|
|
| 41 |
from diffusers.utils import export_to_video
|
| 42 |
|
|
|
|
|
|
|
|
|
|
| 43 |
# Download model weights from Hugging Face Hub if they don't exist
|
| 44 |
if not os.path.exists(CHECKPOINT_DIR):
|
| 45 |
print(f"Downloading model weights to '{CHECKPOINT_DIR}'...")
|
|
|
|
| 55 |
print(f"Error downloading model weights: {e}")
|
| 56 |
sys.exit(1)
|
| 57 |
|
|
|
|
|
|
|
| 58 |
# Global placeholder for the pipeline and device configuration
|
| 59 |
pipe = None
|
| 60 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|