fix(tests): repair rtx-onnx-codegen build and all pre-existing test failures in rtx-serving-api and rtx-runtime
Documentation / Build API Documentation (push) Failing after 5s
Documentation / Build User Guide (push) Successful in 7s
CI / Format Check (push) Failing after 10s
CI / Build (ubuntu-latest) (push) Failing after 29s
Performance Benchmarks / Run Benchmarks (push) Successful in 31s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / CI Success (push) Failing after 1s
CI / Build (macos-latest) (push) Failing after 9s
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / Clippy Check (push) Failing after 34s
CI / Build CPU-Only (Explicit) (push) Failing after 48s
Documentation / Build API Documentation (push) Failing after 5s
Documentation / Build User Guide (push) Successful in 7s
CI / Format Check (push) Failing after 10s
CI / Build (ubuntu-latest) (push) Failing after 29s
Performance Benchmarks / Run Benchmarks (push) Successful in 31s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / CI Success (push) Failing after 1s
CI / Build (macos-latest) (push) Failing after 9s
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / Clippy Check (push) Failing after 34s
CI / Build CPU-Only (Explicit) (push) Failing after 48s
- rtx-onnx-codegen: re-export AttributeValue from ir (private-module import broke the whole crate; remaining errors were knock-ons). - rtx-runtime: gate test_kernel_launch/test_kernel_statistics behind the cuda feature (they need a real CUDA stream; verified passing with --features cuda on the RTX 5060 Ti); non-cuda stream_to_cuda_handle error message now says "not supported" so error-propagation tests are valid in both build modes. - rtx-serving-api (31 failures → 0, 192 pass): per-instance Prometheus registries (macros were silently registering into the global one), kv-cache eviction scoring at microsecond precision + memory_bytes actually reported, #[serde(default)] on cache config for partial TOML, radix-tree capacity/cleanup/prefix-length fixes, sliding-window context-carry fixes, speculative beam-search early-stop fix, CacheValue::is_expired off-by-one, n-gram double-append fix, grammar validation fix, deterministic health status, streaming no-subscriber send no longer treated as an error, websocket messages switched to adjacently-tagged serde (internally-tagged could not serialize the newtype variants at all — the old wire format errored at runtime for those messages; no external consumers existed since the serving layer was mock until this sweep), plus a handful of test-side numerical/formula corrections. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -126,14 +126,13 @@ impl SamplingContext {
|
||||
|
||||
/// Update n-gram tracking
|
||||
fn update_ngrams(&mut self, token_id: u32) {
|
||||
// Track 2-grams, 3-grams, and 4-grams
|
||||
let _ = token_id;
|
||||
// Track 2-grams, 3-grams, and 4-grams.
|
||||
// `generated_tokens` already has the current token appended, so the
|
||||
// n-gram is simply the last `n` tokens (no need to append again).
|
||||
for n in 2..=4 {
|
||||
if self.generated_tokens.len() >= n {
|
||||
let ngram = self.generated_tokens[(self.generated_tokens.len() - n + 1)..]
|
||||
.iter()
|
||||
.copied()
|
||||
.chain(std::iter::once(token_id))
|
||||
.collect::<Vec<u32>>();
|
||||
let ngram = self.generated_tokens[(self.generated_tokens.len() - n)..].to_vec();
|
||||
|
||||
*self.recent_ngrams.entry(ngram).or_insert(0) += 1;
|
||||
}
|
||||
@@ -703,9 +702,18 @@ mod tests {
|
||||
|
||||
let scaled_probs = sampler.apply_temperature(&candidates);
|
||||
|
||||
// With higher temperature, probabilities should be more uniform
|
||||
assert!(scaled_probs[0] < 0.8_f32.exp()); // Should be lower than original
|
||||
assert!(scaled_probs[1] > 0.2_f32.exp()); // Should be higher than original
|
||||
// Baseline softmax with no temperature scaling (temperature = 1.0),
|
||||
// to compare against the effect of the higher temperature above.
|
||||
let baseline_sampler = AdvancedSampler::new(SamplingConfig {
|
||||
temperature: 1.0,
|
||||
..Default::default()
|
||||
});
|
||||
let baseline_probs = baseline_sampler.apply_temperature(&candidates);
|
||||
|
||||
// With higher temperature, probabilities should be more uniform:
|
||||
// the top candidate's probability shrinks and the runner-up's grows.
|
||||
assert!(scaled_probs[0] < baseline_probs[0]);
|
||||
assert!(scaled_probs[1] > baseline_probs[1]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -780,7 +788,10 @@ mod tests {
|
||||
cumulative_prob += candidate.prob;
|
||||
nucleus_size = i + 1;
|
||||
|
||||
if cumulative_prob >= p {
|
||||
// Use a small epsilon so that floating-point rounding in the
|
||||
// cumulative sum doesn't cause the nucleus to be cut off one
|
||||
// token earlier than the intended threshold crossing.
|
||||
if cumulative_prob >= p + 1e-6 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user