File size: 2,792 Bytes
14ee1a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import os, sys
import torch

# Directly run `python -m pytest` or
# Directly run `python -m pytest -v -s --disable-warnings` for Debugging

# To test single function:
# pytest tests/test_t2v.py::test_function_name

dummy_prompts = [
    "a teddy bear walking on the street, 2k, high quality",
    "a panda taking a selfie, 2k, high quality",
    "a polar bear playing drum kit in NYC Times Square, 4k, high resolution",
    "jungle river at sunset, ultra quality",
    "a shark swimming in clear Carribean ocean, 2k, high quality",
    "a Corgi walking in the park at sunrise, oil painting style",
]

import sys
sys.path.append("src")

def test_LaVie():
    from videogen_hub.infermodels import LaVie

    model = LaVie()
    assert model is not None
    out_video = model.infer_one_video(dummy_prompts[0])
    assert out_video is not None
    # check if out_video is a tensor or not
    assert isinstance(out_video, torch.Tensor)
    print(out_video.shape)


def test_VideoCrafter2():
    from videogen_hub.infermodels import VideoCrafter2

    model = VideoCrafter2()
    assert model is not None
    out_video = model.infer_one_video(dummy_prompts[0])
    assert out_video is not None
    # check if out_video is a tensor or not
    assert isinstance(out_video, torch.Tensor)
    print(out_video.shape)

def test_ModelScope():
    from videogen_hub.infermodels import ModelScope
    model = ModelScope()
    assert model is not None
    out_video = model.infer_one_video(dummy_prompts[0])
    print("video ouputted")
    assert out_video is not None
    # check if out_video is a tensor or not
    assert isinstance(out_video, torch.Tensor)
    print(out_video.shape)

def test_StreamingT2V():
    from videogen_hub.infermodels import StreamingT2V

    model = StreamingT2V()
    assert model is not None
    out_video = model.infer_one_video(dummy_prompts[0])
    print("video ouputted")
    assert out_video is not None
    # check if out_video is a tensor or not
    assert isinstance(out_video, torch.Tensor)
    print(out_video.shape)

def test_OpenSora():
    from videogen_hub.infermodels import OpenSora

    model = OpenSora()
    assert model is not None
    out_video = model.infer_one_video(dummy_prompts[0])
    assert out_video is not None
    # check if out_video is a tensor or not
    assert isinstance(out_video, torch.Tensor)
    print(out_video.shape)


def test_ShowOne():
    from videogen_hub.infermodels import ShowOne

    model = ShowOne()
    assert model is not None
    out_video = model.infer_one_video(dummy_prompts[0])
    assert out_video is not None
    # check if out_video is a tensor or not
    assert isinstance(out_video, torch.Tensor)
    print(out_video.shape)


if __name__ == "__main__":
    test_ShowOne()
    print("Everything passed")
    pass