LLM测试夹具
(request)
| 45 | |
| 46 | @pytest.fixture(scope="module", params=models) |
| 47 | def llm(request): |
| 48 | """LLM测试夹具""" |
| 49 | model_path = os.path.join(bash_path, request.param) |
| 50 | try: |
| 51 | port_index = models.index(request.param) % len(FD_ENGINE_QUEUE_PORTS) |
| 52 | llm_instance = LLM( |
| 53 | model=model_path, |
| 54 | tensor_parallel_size=1, |
| 55 | data_parallel_size=2, |
| 56 | max_model_len=8192, |
| 57 | num_gpu_blocks_override=1024, |
| 58 | engine_worker_queue_port=FD_ENGINE_QUEUE_PORTS[port_index], |
| 59 | cache_queue_port=FD_CACHE_QUEUE_PORTS[port_index], |
| 60 | load_choices="default", |
| 61 | enable_expert_parallel=True, |
| 62 | ) |
| 63 | yield weakref.proxy(llm_instance) |
| 64 | except Exception as e: |
| 65 | assert False, f"LLM initialization failed: {e}" |
| 66 | |
| 67 | |
| 68 | @pytest.mark.timeout(60) |