Removing cuda default.

Seems very important for a lot of exploring users usually on laptop
without GPUs.

Adding more README instructions in a follow up.
This commit is contained in:
Nicolas Patry
2023-07-14 16:52:15 +02:00
parent 88f666781f
commit 4ed56d7861
12 changed files with 62 additions and 14 deletions

View File

@ -495,10 +495,19 @@ struct Args {
impl Args {
fn build_model_and_tokenizer(&self) -> Result<(BertModel, Tokenizer)> {
#[cfg(feature = "cuda")]
let default_device = Device::new_cuda(0)?;
#[cfg(not(feature = "cuda"))]
let default_device = {
println!("Running on CPU, to run on GPU, run this example with `--features cuda`");
Device::Cpu
};
let device = if self.cpu {
Device::Cpu
} else {
Device::new_cuda(0)?
default_device
};
let default_model = "sentence-transformers/all-MiniLM-L6-v2".to_string();
let default_revision = "refs/pr/21".to_string();