Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion megatron/core/inference/apis/_llm_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def __init__(
model,
tokenizer,
inference_config: Optional[InferenceConfig] = None,
use_coordinator: bool = False,
use_coordinator: bool = True,
coordinator_host: Optional[str] = None,
coordinator_port: Optional[int] = None,
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion megatron/core/inference/apis/async_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(
model,
tokenizer,
inference_config: Optional[InferenceConfig] = None,
use_coordinator: bool = False,
use_coordinator: bool = True,
coordinator_host: Optional[str] = None,
coordinator_port: Optional[int] = None,
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion megatron/core/inference/apis/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(
model,
tokenizer,
inference_config: Optional[InferenceConfig] = None,
use_coordinator: bool = False,
use_coordinator: bool = True,
coordinator_host: Optional[str] = None,
coordinator_port: Optional[int] = None,
) -> None:
Expand Down
8 changes: 4 additions & 4 deletions tests/unit_tests/inference/high_level_api/test_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_coordinator_host_or_port_without_use_coordinator_raises(

def test_megatron_llm_direct_mode_succeeds(self, mock_pipeline, fake_model_and_tokenizer):
model, tok = fake_model_and_tokenizer
llm = MegatronLLM(model=model, tokenizer=tok)
llm = MegatronLLM(model=model, tokenizer=tok, use_coordinator=False)
assert llm.is_primary_rank is True
assert llm._use_coordinator is False

Expand All @@ -80,7 +80,7 @@ def test_async_llm_requires_use_coordinator(self, mock_pipeline, fake_model_and_
running asyncio loop."""
model, tok = fake_model_and_tokenizer
with pytest.raises(ValueError, match="requires use_coordinator=True"):
MegatronAsyncLLM(model=model, tokenizer=tok)
MegatronAsyncLLM(model=model, tokenizer=tok, use_coordinator=False)

def test_ep_gt_1_requires_use_coordinator(
self, mock_pipeline, fake_model_and_tokenizer, monkeypatch
Expand All @@ -104,15 +104,15 @@ def test_sync_lifecycle_raises_in_direct_mode(
self, mock_pipeline, fake_model_and_tokenizer, method
):
model, tok = fake_model_and_tokenizer
llm = MegatronLLM(model=model, tokenizer=tok)
llm = MegatronLLM(model=model, tokenizer=tok, use_coordinator=False)
with pytest.raises(RuntimeError, match="use_coordinator=True"):
getattr(llm, method)()

def test_sync_shutdown_is_noop_and_idempotent_in_direct_mode(
self, mock_pipeline, fake_model_and_tokenizer
):
model, tok = fake_model_and_tokenizer
llm = MegatronLLM(model=model, tokenizer=tok)
llm = MegatronLLM(model=model, tokenizer=tok, use_coordinator=False)
llm.shutdown()
assert llm._shutdown_called is True
llm.shutdown() # second call is a no-op
Expand Down
Loading