mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-29 16:24:26 +01:00
Prefer safetensors to pytorch when both are available
This commit is contained in:
parent
75f81a0bab
commit
a1eccc762a
@ -87,11 +87,11 @@ impl Embedder {
|
|||||||
let config = api.get("config.json").map_err(NewEmbedderError::api_get)?;
|
let config = api.get("config.json").map_err(NewEmbedderError::api_get)?;
|
||||||
let tokenizer = api.get("tokenizer.json").map_err(NewEmbedderError::api_get)?;
|
let tokenizer = api.get("tokenizer.json").map_err(NewEmbedderError::api_get)?;
|
||||||
let (weights, source) = {
|
let (weights, source) = {
|
||||||
api.get("pytorch_model.bin")
|
api.get("model.safetensors")
|
||||||
.map(|filename| (filename, WeightSource::Pytorch))
|
.map(|filename| (filename, WeightSource::Safetensors))
|
||||||
.or_else(|_| {
|
.or_else(|_| {
|
||||||
api.get("model.safetensors")
|
api.get("pytorch_model.bin")
|
||||||
.map(|filename| (filename, WeightSource::Safetensors))
|
.map(|filename| (filename, WeightSource::Pytorch))
|
||||||
})
|
})
|
||||||
.map_err(NewEmbedderError::api_get)?
|
.map_err(NewEmbedderError::api_get)?
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user