[VLM][Model] Add test for InternViT vision encoder (#7409)

This commit is contained in:
Isotr0py
2024-08-20 23:10:20 +08:00
committed by GitHub
parent 398521ad19
commit aae6927be0
2 changed files with 98 additions and 1 deletions
+18 -1
View File
@@ -24,7 +24,9 @@ from vllm.assets.image import ImageAsset
from vllm.config import TokenizerPoolConfig
from vllm.connections import global_http_connection
from vllm.distributed import (destroy_distributed_environment,
destroy_model_parallel)
destroy_model_parallel,
init_distributed_environment,
initialize_model_parallel)
from vllm.inputs import (ExplicitEncoderDecoderPrompt, TextPrompt,
to_enc_dec_tuple_list, zip_enc_dec_prompts)
from vllm.logger import init_logger
@@ -90,6 +92,21 @@ def init_test_http_connection():
global_http_connection.reuse_client = False
@pytest.fixture
def dist_init():
temp_file = tempfile.mkstemp()[1]
init_distributed_environment(
world_size=1,
rank=0,
distributed_init_method=f"file://{temp_file}",
local_rank=0,
backend="nccl",
)
initialize_model_parallel(1, 1)
yield
cleanup()
def cleanup():
destroy_model_parallel()
destroy_distributed_environment()