mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 00:55:00 +08:00
Truncate HuggingFace vectors that are too long
This commit is contained in:
parent
d77df4ecdb
commit
cbd065ed46
@ -145,7 +145,8 @@ impl Embedder {
|
|||||||
let token_ids = tokens
|
let token_ids = tokens
|
||||||
.iter()
|
.iter()
|
||||||
.map(|tokens| {
|
.map(|tokens| {
|
||||||
let tokens = tokens.get_ids().to_vec();
|
let mut tokens = tokens.get_ids().to_vec();
|
||||||
|
tokens.truncate(512);
|
||||||
Tensor::new(tokens.as_slice(), &self.model.device).map_err(EmbedError::tensor_shape)
|
Tensor::new(tokens.as_slice(), &self.model.device).map_err(EmbedError::tensor_shape)
|
||||||
})
|
})
|
||||||
.collect::<Result<Vec<_>, EmbedError>>()?;
|
.collect::<Result<Vec<_>, EmbedError>>()?;
|
||||||
|
Loading…
Reference in New Issue
Block a user