Skip to content

Commit 7dae85e

Browse files
wqj2004PaParaZz1
authored andcommitted
style_fixed
1 parent f70a942 commit 7dae85e

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

ding/worker/collector/tests/test_vllm_collector.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from loguru import logger
55
from ..vllm_collector import HuggingFaceModelGenerator
66
from vllm.assets.image import ImageAsset
7-
7+
from enum import Enum
8+
import asyncio
9+
import nest_asyncio
810
# set a temperature > 0 to get multiple responses
911
# note that HFModelGenerator has a parameter "mm_processor_kwargs" set to align with the settings of Qwen in default
1012
model = HuggingFaceModelGenerator('/mnt/afs/share/Qwen2-VL-7B', temperature=0.5)
1113

12-
from enum import Enum
13-
1414

1515
class Modality(Enum):
1616
IMAGE = "image"
@@ -81,8 +81,6 @@ def get_multi_modal_input(modality: Modality, filenames: list, questions: list)
8181
question = mm_input["question"]
8282
prompts, stop_token_ids = get_prompts_qwen(question, modality)
8383

84-
import asyncio
85-
import nest_asyncio
8684
nest_asyncio.apply()
8785

8886

ding/worker/collector/tests/test_vllm_collector_multigpu.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
import uuid
44
from loguru import logger
55
from vllm import AsyncLLMEngine, AsyncEngineArgs, SamplingParams, RequestOutput
6+
from typing import List, Tuple, Optional
7+
from vllm.assets.image import ImageAsset
8+
from enum import Enum
9+
import concurrent.futures
10+
import asyncio
611

712

813
class VllmActor:
@@ -155,14 +160,6 @@ def chunk_list(original_list: list, t: int) -> List[list]:
155160
return new_list
156161

157162

158-
from typing import List, Tuple, Optional
159-
import os
160-
from loguru import logger
161-
from vllm.assets.image import ImageAsset
162-
from enum import Enum
163-
import concurrent.futures
164-
165-
166163
class Modality(Enum):
167164
IMAGE = "image"
168165
TEXT = "text"
@@ -229,9 +226,6 @@ async def run_vllm_collector(gpu_id: int, prompts: List, model_path: str, temper
229226
return responses_list
230227

231228

232-
import asyncio
233-
234-
235229
def start_collector(gpu_id: int, prompts: list, model_path: str, temperature: float) -> List[str]:
236230
# event loop in a process
237231
results = asyncio.run(run_vllm_collector(gpu_id, prompts, model_path, temperature))

0 commit comments

Comments
 (0)