Skip to content

Open-Sora: Democratizing Efficient Video Production for All

Python

allow vae not to have prompt file

Shen-Chenhuie9776584e425
diff --git a/configs/vae_3d/inference/16x256x256.py b/configs/vae_3d/inference/16x256x256.py
index e9fba15..53e1970 100644
--- a/configs/vae_3d/inference/16x256x256.py
+++ b/configs/vae_3d/inference/16x256x256.py
@@ -5,7 +5,7 @@ image_size = (256, 256)
# Define dataset
root = None
-data_path = "/home/shenchenhui/data/pexels/inference.csv"
+data_path = "CSV_PATH"
use_image_transform = False
num_workers = 4
diff --git a/opensora/models/vae/README.md b/opensora/models/vae/README.md
index b5da586..eab767d 100644
--- a/opensora/models/vae/README.md
+++ b/opensora/models/vae/README.md
@@ -11,5 +11,5 @@ WANDB_API_KEY=<wandb_api_key> CUDA_VISIBLE_DEVICES=<n> torchrun --master_port=<p
### 2. Inference
```yaml
-CUDA_VISIBLE_DEVICES=<n> torchrun --standalone --nnodes=1 --nproc_per_node=1 scripts/inference-vae.py configs/vae_3d/inference/16x256x256.py --ckpt-path /home/shenchenhui/Open-Sora-dev/outputs/028-F16S3-VAE_3D/epoch3-global_step20000/vae
+CUDA_VISIBLE_DEVICES=<n> torchrun --standalone --nnodes=1 --nproc_per_node=1 scripts/inference-vae.py configs/vae_3d/inference/16x256x256.py --ckpt-path /home/shenchenhui/Open-Sora-dev/outputs/028-F16S3-VAE_3D/epoch3-global_step20000/vae --vae_only True --data_path /home/shenchenhui/data/pexels/test.csv
```
\ No newline at end of file
diff --git a/opensora/utils/config_utils.py b/opensora/utils/config_utils.py
index 350cc8e..cd3065b 100644
--- a/opensora/utils/config_utils.py
+++ b/opensora/utils/config_utils.py
@@ -31,6 +31,8 @@ def parse_args(training=False):
# prompt
parser.add_argument("--prompt-path", default=None, type=str, help="path to prompt txt file")
parser.add_argument("--save-dir", default=None, type=str, help="path to save generated samples")
+ parser.add_argument("--data-path", default=None, type=str, help="path to data csv")
+ parser.add_argument("--vae_only", default=False, type=bool, help="if inference on the vae only")
# hyperparameters
parser.add_argument("--num-sampling-steps", default=None, type=int, help="sampling steps")
@@ -58,7 +60,7 @@ def merge_args(cfg, args, training=False):
cfg["reference_path"] = None
if "loop" not in cfg:
cfg["loop"] = 1
- if "prompt" not in cfg or cfg["prompt"] is None:
+ if not cfg.vae and ("prompt" not in cfg or cfg["prompt"] is None):
assert cfg["prompt_path"] is not None, "prompt or prompt_path must be provided"
cfg["prompt"] = load_prompts(cfg["prompt_path"])
else: