Skip to content

Commit

Permalink
Added both hpu and gpu specific changes confest
Browse files Browse the repository at this point in the history
  • Loading branch information
rsshaik1 committed Sep 30, 2024
1 parent 44d8173 commit 188bd3a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/lora/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,16 @@ def cleanup_fixture(should_do_global_cleanup_after_test: bool):
@pytest.fixture
def dist_init():
temp_file = tempfile.mkstemp()[1]
if is_hpu():
backend_type = "hccl"
else:
backend_type = "nccl"
init_distributed_environment(
world_size=1,
rank=0,
distributed_init_method=f"file://{temp_file}",
local_rank=0,
backend="nccl",
backend=backend_type,
)
initialize_model_parallel(1, 1)
yield
Expand Down Expand Up @@ -259,8 +263,13 @@ def get_model_patched(*, model_config, device_config, **kwargs):
device_config=device_config,
**kwargs)

with patch("vllm.worker.model_runner.get_model", get_model_patched):
engine = vllm.LLM("meta-llama/Llama-2-7b-hf", enable_lora=False)
if is_hpu():
with patch("vllm.worker.habana_model_runner.get_model", get_model_patched):
engine = vllm.LLM("meta-llama/Llama-2-7b-hf", enable_lora=False)
else:
with patch("vllm.worker.model_runner.get_model", get_model_patched):
engine = vllm.LLM("meta-llama/Llama-2-7b-hf", enable_lora=False)

yield engine.llm_engine
del engine
cleanup()
Expand Down

0 comments on commit 188bd3a

Please sign in to comment.