-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] support pab and multi-gpu in open-sora-plan v1.2.0 (#223)
* update parallel * update pab * update test * empty cache * update tests
- Loading branch information
Showing
13 changed files
with
246 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,40 @@ | ||
import pytest | ||
|
||
from videosys import CogVideoXConfig, VideoSysEngine | ||
from videosys.utils.test import empty_cache | ||
|
||
|
||
@pytest.mark.parametrize("num_gpus", [1, 2]) | ||
def test_base(num_gpus): | ||
config = CogVideoXConfig(num_gpus=num_gpus) | ||
@pytest.mark.parametrize("model_path", ["THUDM/CogVideoX-2b", "THUDM/CogVideoX-5b"]) | ||
@empty_cache | ||
def test_base(num_gpus, model_path): | ||
config = CogVideoXConfig(model_path=model_path, num_gpus=num_gpus) | ||
engine = VideoSysEngine(config) | ||
|
||
prompt = "Sunset over the sea." | ||
video = engine.generate(prompt, seed=0).video[0] | ||
engine.save_video(video, f"./test_outputs/{prompt}_cogvideo_{num_gpus}.mp4") | ||
engine.save_video(video, f"./test_outputs/{prompt}_cogvideo_{model_path.replace('/', '_')}_base_{num_gpus}.mp4") | ||
|
||
|
||
@pytest.mark.parametrize("num_gpus", [1]) | ||
def test_pab(num_gpus): | ||
config = CogVideoXConfig(num_gpus=num_gpus, enable_pab=True) | ||
@pytest.mark.parametrize("model_path", ["THUDM/CogVideoX-2b"]) | ||
@empty_cache | ||
def test_pab(num_gpus, model_path): | ||
config = CogVideoXConfig(model_path=model_path, num_gpus=num_gpus, enable_pab=True) | ||
engine = VideoSysEngine(config) | ||
|
||
prompt = "Sunset over the sea." | ||
video = engine.generate(prompt, seed=0).video[0] | ||
engine.save_video(video, f"./test_outputs/{prompt}_cogvideo_pab_{num_gpus}.mp4") | ||
engine.save_video(video, f"./test_outputs/{prompt}_cogvideo_{model_path.replace('/', '_')}_pab_{num_gpus}.mp4") | ||
|
||
|
||
@pytest.mark.parametrize("num_gpus", [1]) | ||
def test_low_mem(num_gpus): | ||
config = CogVideoXConfig(num_gpus=num_gpus, cpu_offload=True, vae_tiling=True) | ||
@pytest.mark.parametrize("model_path", ["THUDM/CogVideoX-2b"]) | ||
@empty_cache | ||
def test_low_mem(num_gpus, model_path): | ||
config = CogVideoXConfig(model_path=model_path, num_gpus=num_gpus, cpu_offload=True, vae_tiling=True) | ||
engine = VideoSysEngine(config) | ||
|
||
prompt = "Sunset over the sea." | ||
video = engine.generate(prompt, seed=0).video[0] | ||
engine.save_video(video, f"./test_outputs/{prompt}_cogvideo_low_mem_{num_gpus}.mp4") | ||
engine.save_video(video, f"./test_outputs/{prompt}_cogvideo_{model_path.replace('/', '_')}_low_mem_{num_gpus}.mp4") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,42 @@ | ||
import pytest | ||
|
||
from videosys import OpenSoraPlanConfig, VideoSysEngine | ||
from videosys.utils.test import empty_cache | ||
|
||
|
||
@pytest.mark.parametrize("num_gpus", [1, 2]) | ||
def test_base(num_gpus): | ||
config = OpenSoraPlanConfig(num_gpus=num_gpus) | ||
@pytest.mark.parametrize("model", [("v120", "29x480p")]) | ||
@empty_cache | ||
def test_base(num_gpus, model): | ||
config = OpenSoraPlanConfig(version=model[0], transformer_type=model[1], num_gpus=num_gpus) | ||
engine = VideoSysEngine(config) | ||
|
||
prompt = "Sunset over the sea." | ||
video = engine.generate(prompt, seed=0).video[0] | ||
engine.save_video(video, f"./test_outputs/{prompt}_open_sora_plan_{num_gpus}.mp4") | ||
engine.save_video(video, f"./test_outputs/{prompt}_open_sora_plan_{model[0]}_{model[1]}_{num_gpus}.mp4") | ||
|
||
|
||
@pytest.mark.parametrize("num_gpus", [1]) | ||
def test_pab(num_gpus): | ||
config = OpenSoraPlanConfig(num_gpus=num_gpus, enable_pab=True) | ||
@pytest.mark.parametrize("model", [("v120", "29x480p")]) | ||
@empty_cache | ||
def test_pab(num_gpus, model): | ||
config = OpenSoraPlanConfig(version=model[0], transformer_type=model[1], num_gpus=num_gpus, enable_pab=True) | ||
engine = VideoSysEngine(config) | ||
|
||
prompt = "Sunset over the sea." | ||
video = engine.generate(prompt, seed=0).video[0] | ||
engine.save_video(video, f"./test_outputs/{prompt}_open_sora_plan_pab_{num_gpus}.mp4") | ||
engine.save_video(video, f"./test_outputs/{prompt}_open_sora_plan_{model[0]}_{model[1]}_pab_{num_gpus}.mp4") | ||
|
||
|
||
@pytest.mark.parametrize("num_gpus", [1]) | ||
def test_low_mem(num_gpus): | ||
config = OpenSoraPlanConfig(num_gpus=num_gpus, cpu_offload=True, enable_tiling=True) | ||
@pytest.mark.parametrize("model", [("v120", "29x480p")]) | ||
@empty_cache | ||
def test_low_mem(num_gpus, model): | ||
config = OpenSoraPlanConfig( | ||
version=model[0], transformer_type=model[1], num_gpus=num_gpus, cpu_offload=True, enable_tiling=True | ||
) | ||
engine = VideoSysEngine(config) | ||
|
||
prompt = "Sunset over the sea." | ||
video = engine.generate(prompt, seed=0).video[0] | ||
engine.save_video(video, f"./test_outputs/{prompt}_open_sora_plan_low_mem_{num_gpus}.mp4") | ||
engine.save_video(video, f"./test_outputs/{prompt}_open_sora_plan_{model[0]}_{model[1]}_low_mem_{num_gpus}.mp4") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,44 @@ | ||
import pytest | ||
|
||
from videosys import VchitectConfig, VideoSysEngine | ||
from videosys.utils.test import empty_cache | ||
|
||
|
||
@pytest.mark.parametrize("num_gpus", [1, 2]) | ||
def test_base(num_gpus): | ||
config = VchitectConfig(num_gpus=num_gpus) | ||
@pytest.mark.parametrize("model_path", ["Vchitect/Vchitect-2.0-2B"]) | ||
@empty_cache | ||
def test_base(num_gpus, model_path): | ||
config = VchitectConfig(model_path=model_path, num_gpus=num_gpus) | ||
engine = VideoSysEngine(config) | ||
|
||
prompt = "Sunset over the sea." | ||
video = engine.generate(prompt, seed=0).video[0] | ||
engine.save_video(video, f"./test_outputs/{prompt}_vchitect_{num_gpus}.mp4") | ||
engine.save_video(video, f"./test_outputs/{prompt}_vchitect_{model_path.replace('/', '_')}_base_{num_gpus}.mp4") | ||
|
||
|
||
@pytest.mark.parametrize("num_gpus", [1]) | ||
def test_pab(num_gpus): | ||
config = VchitectConfig(num_gpus=num_gpus, enable_pab=True) | ||
@pytest.mark.parametrize("model_path", ["Vchitect/Vchitect-2.0-2B"]) | ||
@empty_cache | ||
def test_pab(num_gpus, model_path): | ||
config = VchitectConfig(model_path=model_path, num_gpus=num_gpus, enable_pab=True) | ||
engine = VideoSysEngine(config) | ||
|
||
prompt = "Sunset over the sea." | ||
video = engine.generate(prompt, seed=0).video[0] | ||
engine.save_video(video, f"./test_outputs/{prompt}_vchitect_pab_{num_gpus}.mp4") | ||
engine.save_video(video, f"./test_outputs/{prompt}_vchitect_{model_path.replace('/', '_')}_pab_{num_gpus}.mp4") | ||
|
||
|
||
@pytest.mark.parametrize("num_gpus", [1]) | ||
def test_low_mem(num_gpus): | ||
config = VchitectConfig(num_gpus=num_gpus, cpu_offload=True) | ||
@pytest.mark.parametrize("model_path", ["Vchitect/Vchitect-2.0-2B"]) | ||
@empty_cache | ||
def test_low_mem(num_gpus, model_path): | ||
config = VchitectConfig( | ||
model_path=model_path, | ||
num_gpus=num_gpus, | ||
cpu_offload=True, | ||
) | ||
engine = VideoSysEngine(config) | ||
|
||
prompt = "Sunset over the sea." | ||
video = engine.generate(prompt, seed=0).video[0] | ||
engine.save_video(video, f"./test_outputs/{prompt}_vchitect_low_mem_{num_gpus}.mp4") | ||
engine.save_video(video, f"./test_outputs/{prompt}_vchitect_{model_path.replace('/', '_')}_low_mem_{num_gpus}.mp4") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.