Implement PR comments

This commit is contained in:
Louis Dureuil 2024-01-22 10:13:27 +01:00
parent 1b90778bf5
commit f692021bfc
No known key found for this signature in database
3 changed files with 9 additions and 3 deletions

View File

@ -138,5 +138,5 @@ greek = ["charabia/greek"]
# allow khmer specialized tokenization
khmer = ["charabia/khmer"]
# allow CUDA support
# allow CUDA support, see <https://github.com/meilisearch/meilisearch/issues/4306>
cuda = ["candle-core/cuda"]

View File

@ -70,7 +70,13 @@ impl std::fmt::Debug for Embedder {
impl Embedder {
pub fn new(options: EmbedderOptions) -> std::result::Result<Self, NewEmbedderError> {
let device = candle_core::Device::cuda_if_available(0).unwrap();
let device = match candle_core::Device::cuda_if_available(0) {
Ok(device) => device,
Err(error) => {
log::warn!("could not initialize CUDA device for Hugging Face embedder, defaulting to CPU: {}", error);
candle_core::Device::Cpu
}
};
let repo = match options.revision.clone() {
Some(revision) => Repo::with_revision(options.model.clone(), RepoType::Model, revision),
None => Repo::model(options.model.clone()),

View File

@ -2,7 +2,7 @@
name = "xtask"
version.workspace = true
authors.workspace = true
description.workspace = true
description = "Workspace automation tool following the xtask pattern <https://github.com/matklad/cargo-xtask>"
homepage.workspace = true
readme.workspace = true
edition.workspace = true