test_sequence.py 845 Bytes
Newer Older
zbian's avatar
zbian committed
1
2
3
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

Frank Lee's avatar
Frank Lee committed
4
5
from colossalai.initialize import launch, get_default_parser
from colossalai.logging import get_dist_logger
zbian's avatar
zbian committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from test_layer import *

CONFIG = dict(
    parallel=dict(
        pipeline=1,
        tensor=dict(mode='sequence', size=4)
    )
)


def check_layer():
    check_selfattention()


def _test_main():
    # init dist
Frank Lee's avatar
Frank Lee committed
22
23
24
25
26
27
28
29
30
    parser = get_default_parser()
    args = parser.parse_args()
    launch(config=CONFIG,
           rank=args.rank,
           world_size=args.world_size,
           host=args.host,
           port=args.port,
           backend=args.backend)
    logger = get_dist_logger()
zbian's avatar
zbian committed
31
32
33
34
35
36
37
38
39
40
    logger.info('Distributed environment is initialzied.', ranks=[0])

    torch.backends.cudnn.benchmark = True

    # check layers
    check_layer()


if __name__ == '__main__':
    _test_main()