akash6murali 2afdb3d2d8 test: add unit tests for SamplingParams, CacheConfig, ParallelConfig, SchedulerConfig
The config and sampling-parameter classes had zero test coverage despite
containing non-trivial validation logic that is exercised on every engine
startup.  This PR adds two focused, CPU-only test files that cover all
_verify_args paths and several construction edge cases.

tests/test_sampling_params.py (47 tests)
  Covers every validation rule in SamplingParams._verify_args:
  - temperature: non-negative check, greedy-mode clamp (< SAMPLING_EPS
    → temperature=SAMPLING_EPS, top_p=1.0, top_k=-1).
  - top_p: exclusive lower bound (> 0.0) and upper bound (<= 1.0).
  - top_k: -1 (disabled) or [1, INT32_MAX]; zero and other negatives rejected.
  - max_tokens: >= 1 and <= INT32_MAX; notably max_tokens=0 now raises
    ValueError (the original code silently coerced 0 → 1 before validation).
  - top_logprobs: [0, 1000].
  - seq_seed: auto-generation, explicit value, uint64 masking, non-int raises.
  - logprobs deprecation: logprobs=False emits no warning; logprobs=True
    emits DeprecationWarning matching "logprobs.*deprecated".
  - Optional fields: golden_token_ids, so_args, ignore_eos, first_n_token_no_eos,
    eos_id, prompt_logprobs.
  - Greedy mode: temperature=0 overrides top_k and top_p; non-zero preserves them.

tests/test_config.py (23 tests)
  CacheConfig:
  - Valid construction, boundary values (utilization=1.0), lookahead_tokens,
    deferred-field initialisation (num_gpu_blocks etc. start as None).
  - Rejects gpu_memory_utilization > 1.0 (existing check).
  - Two tests marked xfail(strict=True) for the missing lower-bound guard
    (0.0 and negative values currently pass silently).  These will flip to
    XPASS once PR fix/cache-config-validation is merged.

  ParallelConfig:
  - Auto-derivation of data_parallel_size when 0 is passed (min 1).
  - world_size, data_parallel_rank, model_parallel_size, engram derivation.
  - AssertionError when (cp * dp) is not divisible by ep.
  - AssertionError when engine_rank is out of range.

  SchedulerConfig:
  - max_num_batched_tokens auto-default (>= max(max_model_len, 4096)).
  - ValueError when explicit max_num_batched_tokens < max_model_len and
    chunked_prefill=False; passes when chunked_prefill=True.
  - ValueError for prefill_attempt_interval <= 0 and
    prefill_any_attempt_interval <= 0.
  - runtime_max_model_len >= max_model_len.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-10-20 14:28:11 -04:00
..
distributed initial commit 2026-10-20 12:09:42 +08:00
engine initial commit 2026-10-20 12:09:42 +08:00
models initial commit 2026-10-20 12:09:42 +08:00
ve initial commit 2026-10-20 12:09:42 +08:00
worker initial commit 2026-10-20 12:09:42 +08:00
__init__.py initial commit 2026-10-20 12:09:42 +08:00
conftest.py initial commit 2026-10-20 12:09:42 +08:00
test_config.py test: add unit tests for SamplingParams, CacheConfig, ParallelConfig, SchedulerConfig 2026-10-20 14:28:11 -04:00
test_cuda_sync_guards.py initial commit 2026-10-20 12:09:42 +08:00
test_sampling_params.py test: add unit tests for SamplingParams, CacheConfig, ParallelConfig, SchedulerConfig 2026-10-20 14:28:11 -04:00