use super::*;
use crate::models::xlm_roberta_flash::PositionScheme;
const ID: &str = "jinaai/jina-reranker-v2-base-multilingual";
#[test]
fn jina_reranker_v2_is_registered_with_its_own_measured_shape() {
let descriptor =
lookup(ID).expect("jinaai/jina-reranker-v2-base-multilingual must be registered");
assert_eq!(descriptor.id, ID);
assert_eq!(
descriptor.family,
Family::XlmRobertaFlash,
"fused Wqkv and post-norm blocks under roberta.*, and no model_type"
);
assert_eq!(
descriptor.position_scheme,
Some(PositionScheme::Absolute),
"config.json's position_embedding_type and the [1026, 768] table the reference reads"
);
assert_eq!(
descriptor.head,
RerankHead::RobertaClassificationHead,
"classifier.dense and classifier.out_proj on the first position, no pooler"
);
assert_eq!(
descriptor.score_activation,
ScoreActivation::Sigmoid,
"compute_score and rerank both report the sigmoid of the upcast logit"
);
assert_eq!(
descriptor.input,
RerankInput::Windowed {
query_cap: 512,
overlap: 80
},
"rerank's own max_query_length and overlap_tokens defaults"
);
assert_eq!(
descriptor.default_max_length, 1024,
"the table's 1024 usable positions and rerank's own max_length"
);
assert_eq!(descriptor.alibi_variant, None);
assert_eq!(descriptor.default_dtype, DType::F32);
assert_eq!(descriptor.license, "CC-BY-NC-4.0");
assert_eq!(
descriptor.weights,
crate::registry::WeightsFormat::Safetensors
);
assert_eq!(
descriptor.size_gb, 0.56,
"556 892 306 bytes of model.safetensors"
);
assert_eq!(descriptor.phase, 5);
assert!(!descriptor.gated);
let json = serde_json::to_value(&descriptor).unwrap();
assert_eq!(json["family"], "xlm_roberta_flash");
assert_eq!(json["position_scheme"], "absolute");
assert_eq!(
json["input"],
serde_json::json!({"kind": "windowed", "query_cap": 512, "overlap": 80})
);
}
#[test]
fn jina_reranker_v2_is_f32_verified_on_both_devices_and_f16_accelerator_only() {
assert_accelerator_only_f16_and_bf16(ID, Support::Untested);
let descriptor = lookup(ID).expect("registered");
let both = BackendSupport {
cpu: Support::Verified,
metal: Support::Verified,
cuda: Support::Untested,
};
assert_eq!(descriptor.backends, both);
assert_eq!(descriptor.dtype_backends.f32, both);
}