| 6 | @pytest.mark.flaky(reruns=2) |
| 7 | @pytest.mark.parametrize('model', ['internlm/internlm2_5-7b-chat']) |
| 8 | def 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] |