Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,21 +29,21 @@ def download_model(repo_id, model_name):
|
|
| 29 |
import glob
|
| 30 |
|
| 31 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
@spaces.GPU(duration=200)
|
| 34 |
def run_inference(prompt_text):
|
| 35 |
-
repo_id = "hpcai-tech/Open-Sora"
|
| 36 |
-
|
| 37 |
-
# Map model names to their respective configuration files
|
| 38 |
-
model_name = "OpenSora-v1-HQ-16x512x512.pth"
|
| 39 |
-
config_mapping = {
|
| 40 |
-
"OpenSora-v1-16x256x256.pth": "configs/opensora/inference/16x256x256.py",
|
| 41 |
-
"OpenSora-v1-HQ-16x256x256.pth": "configs/opensora/inference/16x512x512.py",
|
| 42 |
-
"OpenSora-v1-HQ-16x512x512.pth": "configs/opensora/inference/64x512x512.py"
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
config_path = config_mapping[model_name]
|
| 46 |
-
ckpt_path = download_model(repo_id, model_name)
|
| 47 |
|
| 48 |
# Save prompt_text to a temporary text file
|
| 49 |
prompt_file = tempfile.NamedTemporaryFile(delete=False, suffix=".txt", mode='w')
|
|
|
|
| 29 |
import glob
|
| 30 |
|
| 31 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 32 |
+
repo_id = "hpcai-tech/Open-Sora"
|
| 33 |
+
|
| 34 |
+
# Map model names to their respective configuration files
|
| 35 |
+
model_name = "OpenSora-v1-HQ-16x512x512.pth"
|
| 36 |
+
config_mapping = {
|
| 37 |
+
"OpenSora-v1-16x256x256.pth": "configs/opensora/inference/16x256x256.py",
|
| 38 |
+
"OpenSora-v1-HQ-16x256x256.pth": "configs/opensora/inference/16x512x512.py",
|
| 39 |
+
"OpenSora-v1-HQ-16x512x512.pth": "configs/opensora/inference/64x512x512.py"
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
config_path = config_mapping[model_name]
|
| 43 |
+
ckpt_path = download_model(repo_id, model_name)
|
| 44 |
|
| 45 |
@spaces.GPU(duration=200)
|
| 46 |
def run_inference(prompt_text):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
# Save prompt_text to a temporary text file
|
| 49 |
prompt_file = tempfile.NamedTemporaryFile(delete=False, suffix=".txt", mode='w')
|