[docs] update readme

This commit is contained in:
zhengzangw 2024-06-17 07:01:27 +00:00
parent 127db7e9b9
commit 41f772d1f8
3 changed files with 55 additions and 5 deletions

View file

@ -77,6 +77,7 @@ see [here](/assets/texts/t2v_samples.txt) for full prompts.
* 📍 **Open-Sora 1.2** released. Model weights are available [here](#model-weights). See our **[report 1.2](docs/report_03.md)** for more details.
* ✅ Support rectified flow scheduling.
* ✅ Support more conditioning including fps, aesthetic score, motion strength and camera motion.
* ✅ Trained our 3D-VAE for temporal dimension compression.
* 📍 **Open-Sora 1.1** released. Model weights are available [here](#model-weights). It is trained on **0s~15s, 144p to 720p, various aspect ratios** videos. See our **[report 1.1](/docs/report_02.md)** for more discussions.
* 🔧 **Data processing pipeline v1.1** is released. An automatic [processing pipeline](#data-processing) from raw videos to (text, video clip) pairs is provided, including scene cutting $\rightarrow$ filtering(aesthetic, optical flow, OCR, etc.) $\rightarrow$ captioning $\rightarrow$ managing. With this tool, you can easily build your video dataset.
@ -206,9 +207,10 @@ docker run -ti --gpus all -v {MOUNT_DIR}:/data opensora
### Open-Sora 1.2 Model Weights
| Resolution | Model Size | Data | #iterations | Batch Size | URL |
| ---------- | ---------- | ---- | ----------- | ---------- | --- |
| TBD |
| Model | Model Size | Data | #iterations | Batch Size | URL |
| --------- | ---------- | ---- | ----------- | ---------- | ------------------------------------------------------------- |
| Diffusion | 1.1B | 30M | 70k | Dynamic | [:link:](https://huggingface.co/hpcai-tech/OpenSora-STDiT-v3) |
| VAE | 384M | | | | [:link:](https://huggingface.co/hpcai-tech/OpenSora-VAE-v1.2) |
See our **[report 1.2](docs/report_03.md)** for more infomation.
@ -304,6 +306,26 @@ For more advanced usage, you can refer to [Gradio README](./gradio/README.md#adv
### Open-Sora 1.2 Command Line Inference
The basic command line inference is as follows:
```bash
# text to video
python scripts/inference.py configs/opensora-v1-2/inference/sample.py \
--num-frames 4s --resolution 720p \
--prompt "a beautiful waterfall"
```
You can add more options to the command line to customize the generation.
```bash
python scripts/inference.py configs/opensora-v1-2/inference/sample.py \
--num-frames 4s --resolution 720p \
--num-sampling-steps 30 --flow 5 --aes 6.5 \
--prompt "a beautiful waterfall"
```
For image to video generation and other functionalities, the API is compatible with Open-Sora 1.1. See [here](docs/commands.md) for more instructions.
### GPT-4o Prompt Refinement
We find that GPT-4o can refine the prompt and improve the quality of the generated video. With this feature, you can also use other language (e.g., Chinese) as the prompt. To enable this feature, you need prepare your openai api key in the environment:
@ -312,7 +334,12 @@ We find that GPT-4o can refine the prompt and improve the quality of the generat
export OPENAI_API_KEY=YOUR_API_KEY
```
Then you can inference with `--llm-refine True` to enable the GPT-4o prompt refinement.
Then you can inference with `--llm-refine True` to enable the GPT-4o prompt refinement, or leave prompt empty to get a random prompt generated by GPT-4o.
```bash
python scripts/inference.py configs/opensora-v1-2/inference/sample.py \
--num-frames 4s --resolution 720p --llm-refine True
```
### Open-Sora 1.1 Command Line Inference
@ -376,6 +403,17 @@ Also check out the [datasets](docs/datasets.md) we use.
### Open-Sora 1.2 Training
The training process is same as Open-Sora 1.1.
```bash
# one node
torchrun --standalone --nproc_per_node 8 scripts/train.py \
configs/opensora-v1-2/train/stage1.py --data-path YOUR_CSV_PATH --ckpt-path YOUR_PRETRAINED_CKPT
# multiple nodes
colossalai run --nproc_per_node 8 --hostfile hostfile scripts/train.py \
configs/opensora-v1-2/train/stage1.py --data-path YOUR_CSV_PATH --ckpt-path YOUR_PRETRAINED_CKPT
```
### Open-Sora 1.1 Training
<details>

View file

@ -15,6 +15,18 @@
You can modify corresponding config files to change the inference settings. See more details [here](/docs/structure.md#inference-config-demos).
### Inference with Open-Sora 1.2
The inference API is compatible with Open-Sora 1.1. To ease users' experience, we add support to `--resolution` and `--aspect-ratio` options, which is a more user-friendly way to specify the image size.
```bash
python scripts/inference.py configs/opensora-v1-2/inference/sample.py \
--resolution 480p --aspect-ratio 9:16
# equivalent to
python scripts/inference.py configs/opensora-v1-2/inference/sample.py \
--image-size 480 853
```
### Inference with Open-Sora 1.1
Since Open-Sora 1.1 supports inference with dynamic input size, you can pass the input size as an argument.

View file

@ -45,7 +45,7 @@ def get_save_path_name(
):
if sample_name is None:
sample_name = "" if prompt_as_path else "sample"
sample_name_suffix = prompt if prompt_as_path else f"_{sample_idx}"
sample_name_suffix = prompt if prompt_as_path else f"_{sample_idx:04d}"
save_path = os.path.join(save_dir, f"{sample_name}{sample_name_suffix}")
if num_sample != 1:
save_path = f"{save_path}-{k}"