Created
July 7, 2024 13:10
-
-
Save a-agmon/5fac5fdde9e427ba0574d122fbddc751 to your computer and use it in GitHub Desktop.
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
fn process_text_file(sender: Sender<EmbeddingEntry>, filename: &str) -> anyhow::Result<()> { | |
let bert_model = models::bert::get_model_reference(EMB_MODEL_ID, EMB_MODEL_REV)?; | |
let text_chunks: Vec<&str> = read_file_in_chunks(filename, 256)?; | |
let file_vector = embed_multiple_sentences(&text_chunks, false, &bert_model)?; | |
sender.send(EmbeddingEntry { | |
filename: filename.to_string(), | |
embedding: file_vector[0].clone(), | |
})?; | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment