Skip to content

repeated model downloads and first run hanging #479

@rishikanthc

Description

@rishikanthc

When trying to use the online mode for auto-downloading models, the first time models are downloaded the code gets stuck and doesn't execute even after model downloading is completed.

Here's an example code

fn get_model() -> Result<MutexGuard<'static, SentenceEmbeddingsModel>, Box<dyn Error>> {
    MODEL
        .get_or_try_init(
            || -> Result<Mutex<SentenceEmbeddingsModel>, Box<dyn Error>> {
                let model =
                    SentenceEmbeddingsBuilder::remote(SentenceEmbeddingsModelType::AllMiniLmL6V2)
                        .create_model()?;
                Ok(Mutex::new(model))
            },
        )
        .map_err(|e| Box::<dyn Error>::from(format!("Failed to initialize model: {:?}", e)))?
        .lock()
        .map_err(|e| Box::<dyn Error>::from(format!("Failed to acquire model lock: {:?}", e)))
}

Additionally, I have set the RUSTBERT_CACHE environment variable. I notice that even though models exist in the cache directory, after a few times using it, rust-bert starts downloading the models once again. And when it downloads again it once again gets stuck in it and doesn't execute the inference pipeline..

Any help would be appreciated..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions