test(classifiers): add unit tests and benchmarks for CandleClassifier (#2190)#2212
Merged
test(classifiers): add unit tests and benchmarks for CandleClassifier (#2190)#2212
Conversation
…#2190) Add 9 fast unit tests for CandleClassifier covering constructor, backend_name, Debug format, Arc clone sharing, and 5 validate_safetensors edge cases. Add 6 #[ignore] integration tests for real-model inference, chunking, empty input, and error handling (require HF Hub download). Add 3 Criterion benchmarks measuring warm inference latency for injection, safe, and long-input scenarios. PII/NER token-level tests deferred to #2211 (piiranha requires NER backend). FeedbackDetector Model variant deferred to #2210.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CandleClassifier: constructor,backend_name, Debug format, Arc clone sharing, and 5validate_safetensorsedge cases (valid header, truncated buffer, wrong magic, zero-length header, oversized claim)#[ignore]integration tests requiring HF Hub model download: real injection/safe classification, input chunking, empty input, error caching, download timeoutcrates/zeph-llm/benches/classifier.rsmeasuring warm inference latency for injection, safe, and long-input chunking scenarios (publicClassifierBackend::classifyAPI, tokio runtime,black_boxon results)Deferred
piiranha): requiresDebertaV2NERModel, new result type with token-level spans, and BIO span decoding — not implementable with the current sequence classification backendDetectorMode::Modelvariant for FeedbackDetectorTest plan
cargo +nightly fmt --check— passescargo clippy --workspace --features full -- -D warnings— passes (0 warnings)cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins— 6605 passed (+9 vs baseline 6596)#[ignore]tests: run manually withcargo nextest run -p zeph-llm --features classifiers -- --ignoredafter pre-downloadingprotectai/deberta-v3-small-prompt-injection-v2Closes #2190