test_pipeline_turbomind_longtext_func.py 2.72 KB
Newer Older
zhouxiang's avatar
zhouxiang committed
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
import pytest
from utils.get_run_config import get_tp_num

from lmdeploy import TurbomindEngineConfig, pipeline


@pytest.mark.order(8)
@pytest.mark.pipeline_func
@pytest.mark.timeout(600)
class TestPipelineLongtextFunc:

    def test_long_test_chat_7b(self, config):
        model = 'internlm/internlm2-chat-7b'
        tp_config = get_tp_num(config, model)
        model_path = '/'.join([config.get('model_path'), model])

        backend_config = TurbomindEngineConfig(rope_scaling_factor=2.0,
                                               session_len=210000,
                                               tp=tp_config)
        pipe = pipeline(model_path, backend_config=backend_config)
        prompt = '今 天 心 ' * int(200000 / 6)

        # batch infer
        pipe(prompt)

        # stream infer
        for outputs in pipe.stream_infer(prompt):
            continue

        prompts = ['今 天 心 ' * int(200000 / 6)] * 2
        # batch infer
        pipe(prompts)

        # stream infer
        for outputs in pipe.stream_infer(prompts):
            continue

    def test_long_test_chat_20b(self, config):
        model = 'internlm/internlm2-chat-20b'
        tp_config = get_tp_num(config, model)
        model_path = '/'.join([config.get('model_path'), model])

        backend_config = TurbomindEngineConfig(rope_scaling_factor=2.0,
                                               session_len=210000,
                                               tp=tp_config)
        pipe = pipeline(model_path, backend_config=backend_config)
        prompt = '今 天 心 ' * int(200000 / 6)

        # batch infer
        pipe(prompt)

        # stream infer
        for outputs in pipe.stream_infer(prompt):
            continue

        prompts = ['今 天 心 ' * int(200000 / 6)] * 2
        # batch infer
        pipe(prompts)

        # stream infer
        for outputs in pipe.stream_infer(prompts):
            continue

    def test_long_test_20b(self, config):
        model = 'internlm/internlm2-20b'
        tp_config = get_tp_num(config, model)
        model_path = '/'.join([config.get('model_path'), model])

        backend_config = TurbomindEngineConfig(rope_scaling_factor=2.0,
                                               session_len=210000,
                                               tp=tp_config)
        pipe = pipeline(model_path, backend_config=backend_config)
        prompt = '今 天 心 ' * int(200000 / 6)

        # batch infer
        pipe(prompt)

        # stream infer
        for outputs in pipe.stream_infer(prompt):
            continue

        prompts = ['今 天 心 ' * int(200000 / 6)] * 2
        # batch infer
        pipe(prompts)

        # stream infer
        for outputs in pipe.stream_infer(prompts):
            continue