use std::io::Write;
use sha2::{Digest, Sha256};
use super::{super::compile::compile_image, Counts, Identity, TokenizerImage};
pub(crate) const MINI: &[u8] =
include_bytes!("../../../../../../tests/embeddinggemma2/fixtures/mini_tokenizer.json");
pub(crate) fn mini_identity() -> Identity {
Identity {
source: Sha256::digest(MINI).into(),
counts: Counts {
vocab: 286,
merges: 9,
added: 8,
scalars: 13,
bridges: 1,
},
}
}
pub(crate) fn mini() -> (TokenizerImage, tempfile::NamedTempFile) {
let mut file = tempfile::NamedTempFile::new().expect("a temporary file");
file
.write_all(&compile_image(MINI).expect("the mini fixture compiles"))
.expect("write");
file.flush().expect("flush");
let image = TokenizerImage::open(file.path(), &mini_identity()).expect("opens");
(image, file)
}