test descriptions
This commit is contained in:
@@ -169,6 +169,7 @@ class _BlockingStreamingTailBackend(_FakeTailBackend):
|
||||
|
||||
|
||||
def test_quantization_flag_validation():
|
||||
"Quantization flag validation\n\nTags: model, node, real-inference"
|
||||
assert validate_quantization("bfloat16") == "bfloat16"
|
||||
assert validate_quantization("int8") == "int8"
|
||||
assert validate_quantization("nf4") == "nf4"
|
||||
@@ -177,12 +178,14 @@ def test_quantization_flag_validation():
|
||||
|
||||
|
||||
def test_node_package_declares_torch_dependency():
|
||||
"Node package declares torch dependency\n\nTags: model, node, real-inference"
|
||||
pyproject = Path("packages/node/pyproject.toml").read_text(encoding="utf-8")
|
||||
|
||||
assert '"torch>=' in pyproject
|
||||
|
||||
|
||||
def test_bitsandbytes_configs_are_created_lazily(monkeypatch):
|
||||
"Bitsandbytes configs are created lazily\n\nTags: model, node, real-inference"
|
||||
calls = []
|
||||
|
||||
class FakeBitsAndBytesConfig:
|
||||
@@ -211,6 +214,7 @@ def test_bitsandbytes_configs_are_created_lazily(monkeypatch):
|
||||
|
||||
|
||||
def test_rocm_inventory_without_executable_kernels_is_not_used_as_cuda():
|
||||
"Rocm inventory without executable kernels is not used as cuda\n\nTags: model, node, real-inference"
|
||||
class FakeCuda:
|
||||
@staticmethod
|
||||
def is_available():
|
||||
@@ -231,6 +235,7 @@ def test_rocm_inventory_without_executable_kernels_is_not_used_as_cuda():
|
||||
|
||||
|
||||
def test_head_forward_accepts_text_prompt_and_returns_bfloat16_activations():
|
||||
"Head forward accepts text prompt and returns bfloat16 activations\n\nTags: model, node, real-inference"
|
||||
node = TorchNodeServer(backend=_FakeBackend())
|
||||
port = node.start()
|
||||
try:
|
||||
@@ -254,6 +259,7 @@ def test_head_forward_accepts_text_prompt_and_returns_bfloat16_activations():
|
||||
|
||||
|
||||
def test_tail_forward_returns_text_completion_from_binary_activations():
|
||||
"Tail forward returns text completion from binary activations\n\nTags: model, node, real-inference"
|
||||
node = TorchNodeServer(backend=_FakeTailBackend())
|
||||
port = node.start()
|
||||
try:
|
||||
@@ -282,6 +288,7 @@ def test_tail_forward_returns_text_completion_from_binary_activations():
|
||||
|
||||
|
||||
def test_full_model_chat_completion_uses_generation_not_single_token_decode(capsys):
|
||||
"Full model chat completion uses generation not single token decode\n\nTags: model, node, real-inference"
|
||||
node = TorchNodeServer(backend=_FakeFullBackend())
|
||||
port = node.start()
|
||||
try:
|
||||
@@ -313,6 +320,7 @@ def test_full_model_chat_completion_uses_generation_not_single_token_decode(caps
|
||||
|
||||
|
||||
def test_pipeline_hop_logs_are_suppressed_without_debug(capsys):
|
||||
"Pipeline hop logs are suppressed without debug\n\nTags: model, node, real-inference"
|
||||
tail_backend = _FakePipelineTailBackend()
|
||||
head = TorchNodeServer(backend=_FakePipelineHeadBackend(), tracker_mode=True)
|
||||
tail = TorchNodeServer(backend=tail_backend)
|
||||
@@ -349,6 +357,7 @@ def test_pipeline_hop_logs_are_suppressed_without_debug(capsys):
|
||||
|
||||
|
||||
def test_pipeline_hop_logs_are_enabled_with_debug(capsys):
|
||||
"Pipeline hop logs are enabled with debug\n\nTags: model, node, real-inference"
|
||||
head = TorchNodeServer(backend=_FakePipelineHeadBackend(), tracker_mode=True, debug=True)
|
||||
tail = TorchNodeServer(backend=_FakePipelineTailBackend())
|
||||
head_port = head.start()
|
||||
@@ -382,6 +391,7 @@ def test_pipeline_hop_logs_are_enabled_with_debug(capsys):
|
||||
|
||||
|
||||
def test_split_shard_chat_streams_each_generated_token_incrementally():
|
||||
"Split shard chat streams each generated token incrementally\n\nTags: model, node, real-inference, streaming"
|
||||
release_second = threading.Event()
|
||||
head = TorchNodeServer(backend=_FakePipelineHeadBackend(), tracker_mode=True)
|
||||
tail = TorchNodeServer(backend=_BlockingStreamingTailBackend(release_second))
|
||||
@@ -432,6 +442,7 @@ def test_split_shard_chat_streams_each_generated_token_incrementally():
|
||||
|
||||
|
||||
def test_current_requests_snapshot_while_generating():
|
||||
"Current requests snapshot while generating\n\nTags: model, node, real-inference"
|
||||
release_second = threading.Event()
|
||||
head = TorchNodeServer(backend=_FakePipelineHeadBackend(), tracker_mode=True)
|
||||
tail = TorchNodeServer(backend=_BlockingStreamingTailBackend(release_second))
|
||||
@@ -483,6 +494,7 @@ def test_current_requests_snapshot_while_generating():
|
||||
|
||||
|
||||
def test_distributed_generating_log_includes_tps(capsys):
|
||||
"Distributed generating log includes tps\n\nTags: model, node, real-inference"
|
||||
head = TorchNodeServer(backend=_FakePipelineHeadBackend(), tracker_mode=True)
|
||||
tail = TorchNodeServer(backend=_FakePipelineTailBackend())
|
||||
head_port = head.start()
|
||||
@@ -518,6 +530,7 @@ def test_distributed_generating_log_includes_tps(capsys):
|
||||
|
||||
|
||||
def test_int_tensor_header_serializes_torch_tensors():
|
||||
"Int tensor header serializes torch tensors\n\nTags: model, node, real-inference"
|
||||
torch = pytest.importorskip("torch")
|
||||
|
||||
header = _int_tensor_header(torch.tensor([[1, 2, 3]], dtype=torch.long))
|
||||
@@ -526,6 +539,7 @@ def test_int_tensor_header_serializes_torch_tensors():
|
||||
|
||||
|
||||
def test_decoder_attention_mask_is_causal_float_mask():
|
||||
"Decoder attention mask is causal float mask\n\nTags: model, node, real-inference"
|
||||
torch = pytest.importorskip("torch")
|
||||
|
||||
hidden_states = torch.zeros((1, 3, 8), dtype=torch.bfloat16)
|
||||
@@ -538,6 +552,7 @@ def test_decoder_attention_mask_is_causal_float_mask():
|
||||
|
||||
|
||||
def test_call_layer_passes_rotary_position_embeddings():
|
||||
"Call layer passes rotary position embeddings\n\nTags: model, node, real-inference"
|
||||
class NeedsPositionEmbeddings:
|
||||
def __call__(self, hidden_states, **kwargs):
|
||||
assert kwargs["position_embeddings"] == "rotary"
|
||||
@@ -587,6 +602,7 @@ def _fake_cache_shard(torch, *, max_sessions=16, ttl=600.0):
|
||||
|
||||
|
||||
def test_shard_cache_prefill_then_decode_reuses_opaque_layer_state():
|
||||
"Shard cache prefill then decode reuses opaque layer state\n\nTags: cache, model, node, real-inference"
|
||||
torch = pytest.importorskip("torch")
|
||||
shard = _fake_cache_shard(torch)
|
||||
|
||||
@@ -626,6 +642,7 @@ def test_shard_cache_prefill_then_decode_reuses_opaque_layer_state():
|
||||
|
||||
|
||||
def test_shard_cache_decode_miss_is_explicit():
|
||||
"Shard cache decode miss is explicit\n\nTags: cache, model, node, real-inference"
|
||||
torch = pytest.importorskip("torch")
|
||||
shard = _fake_cache_shard(torch)
|
||||
|
||||
@@ -641,6 +658,7 @@ def test_shard_cache_decode_miss_is_explicit():
|
||||
|
||||
|
||||
def test_shard_cache_lru_bounds_sessions():
|
||||
"Shard cache lru bounds sessions\n\nTags: cache, model, node, real-inference"
|
||||
torch = pytest.importorskip("torch")
|
||||
shard = _fake_cache_shard(torch, max_sessions=1)
|
||||
|
||||
@@ -658,6 +676,7 @@ def test_shard_cache_lru_bounds_sessions():
|
||||
|
||||
|
||||
def test_partial_materialize_guard_requires_local_non_full_non_quantized_snapshot(tmp_path):
|
||||
"Partial materialize guard requires local non full non quantized snapshot\n\nTags: model, node, real-inference"
|
||||
snapshot_dir = tmp_path / "snapshot"
|
||||
snapshot_dir.mkdir()
|
||||
(snapshot_dir / "config.json").write_text("{}")
|
||||
@@ -694,6 +713,7 @@ def test_partial_materialize_guard_requires_local_non_full_non_quantized_snapsho
|
||||
|
||||
|
||||
def test_checkpoint_tensor_name_remapped_for_text_only_causal_lm():
|
||||
"Checkpoint tensor name remapped for text only causal lm\n\nTags: model, node, real-inference"
|
||||
class TextOnlyModel:
|
||||
def __init__(self):
|
||||
self.model = types.SimpleNamespace(layers=[])
|
||||
@@ -710,6 +730,7 @@ def test_checkpoint_tensor_name_remapped_for_text_only_causal_lm():
|
||||
|
||||
|
||||
def test_checkpoint_tensor_name_kept_for_multimodal_backbone():
|
||||
"Checkpoint tensor name kept for multimodal backbone\n\nTags: model, node, real-inference"
|
||||
class MultimodalModel:
|
||||
def __init__(self):
|
||||
self.model = types.SimpleNamespace(language_model=types.SimpleNamespace())
|
||||
@@ -720,6 +741,7 @@ def test_checkpoint_tensor_name_kept_for_multimodal_backbone():
|
||||
|
||||
|
||||
def test_partial_snapshot_loader_remaps_language_model_checkpoint_keys(tmp_path):
|
||||
"Partial snapshot loader remaps language model checkpoint keys\n\nTags: model, node, real-inference"
|
||||
snapshot_dir = tmp_path / "snapshot"
|
||||
snapshot_dir.mkdir()
|
||||
(snapshot_dir / "config.json").write_text(json.dumps({
|
||||
@@ -809,6 +831,7 @@ def test_partial_snapshot_loader_skips_tensors_absent_from_causal_lm(tmp_path):
|
||||
# Multimodal/MTP checkpoints (Qwen3.5/3.6-MoE) carry mtp.* and model.visual.*
|
||||
# tensors that the text-only CausalLM never builds — they must be skipped,
|
||||
# not assigned (assignment raises AttributeError: 'mtp' / 'visual').
|
||||
"Partial snapshot loader skips tensors absent from causal lm\n\nTags: model, node, real-inference"
|
||||
snapshot_dir = tmp_path / "snapshot"
|
||||
snapshot_dir.mkdir()
|
||||
(snapshot_dir / "config.json").write_text(json.dumps({
|
||||
@@ -896,6 +919,7 @@ def test_partial_snapshot_loader_skips_tensors_absent_from_causal_lm(tmp_path):
|
||||
|
||||
|
||||
def test_partial_snapshot_loader_materializes_only_assigned_tensors(tmp_path):
|
||||
"Partial snapshot loader materializes only assigned tensors\n\nTags: model, node, real-inference"
|
||||
snapshot_dir = tmp_path / "snapshot"
|
||||
snapshot_dir.mkdir()
|
||||
(snapshot_dir / "config.json").write_text("{}")
|
||||
@@ -1028,6 +1052,7 @@ def test_partial_snapshot_loader_materializes_only_assigned_tensors(tmp_path):
|
||||
|
||||
|
||||
def test_partial_snapshot_loader_requires_known_layer_count(tmp_path):
|
||||
"Partial snapshot loader requires known layer count\n\nTags: model, node, real-inference"
|
||||
snapshot_dir = tmp_path / "snapshot"
|
||||
snapshot_dir.mkdir()
|
||||
(snapshot_dir / "config.json").write_text("{}")
|
||||
@@ -1070,6 +1095,7 @@ def test_partial_snapshot_loader_requires_known_layer_count(tmp_path):
|
||||
|
||||
|
||||
def test_torch_model_shard_prefers_partial_loader_for_local_snapshot(tmp_path, monkeypatch):
|
||||
"Torch model shard prefers partial loader for local snapshot\n\nTags: model, node, real-inference"
|
||||
import meshnet_node.model_backend as backend
|
||||
|
||||
snapshot_dir = tmp_path / "snapshot"
|
||||
@@ -1150,6 +1176,7 @@ def test_torch_model_shard_prefers_partial_loader_for_local_snapshot(tmp_path, m
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_two_node_gpt2_completion_is_deterministic():
|
||||
"Two node gpt2 completion is deterministic\n\nTags: model, node, real-inference"
|
||||
if os.environ.get("CI"):
|
||||
pytest.skip("GPT-2 integration test is skipped in CI")
|
||||
torch = pytest.importorskip("torch")
|
||||
|
||||
Reference in New Issue
Block a user