MCPcopy
hub / github.com/InternLM/lmdeploy / test_repeat

Function test_repeat

autotest/toolchain/test_lagent.py:8–33  ·  view source on GitHub ↗
(config, model)

Source from the content-addressed store, hash-verified

6@pytest.mark.flaky(reruns=2)
7@pytest.mark.parametrize('model', ['internlm/internlm2_5-7b-chat'])
8def test_repeat(config, model):
9 from lagent.llms import INTERNLM2_META, LMDeployPipeline
10
11 model = LMDeployPipeline(
12 path='/'.join([config.get('model_path'), model]),
13 meta_template=INTERNLM2_META,
14 tp=1,
15 top_k=40,
16 top_p=0.8,
17 temperature=1.2,
18 stop_words=['<|im_end|>'],
19 max_new_tokens=4096,
20 )
21 response_list = []
22 for i in range(3):
23 print(f'run_{i}:')
24 response = model.chat([{
25 'role':
26 'user',
27 'content':
28 '已知$$z_{1}=1$$,$$z_{2}=\\text{i}$$,$$z_{3}=-1$$,$$z_{4}=-\\text{i}$$,顺次连结它们所表示的点,则所得图形围成的面积为( )\nA. $$\\dfrac{1}{4}$$\n B. $$\\dfrac{1}{2}$$\n C. $$1$$\n D. $$2$$\n\n' # noqa: F401, E501
29 }])
30 print(response)
31 response_list.append(response)
32 assert len(response) > 10
33 assert response_list[0] != response_list[1] and response_list[1] != response_list[2]

Callers

nothing calls this directly

Calls 4

joinMethod · 0.80
getMethod · 0.45
chatMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected