Skip to content

repeated model downloads and first run hanging #479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rishikanthc opened this issue Apr 12, 2025 · 0 comments
Open

repeated model downloads and first run hanging #479

rishikanthc opened this issue Apr 12, 2025 · 0 comments

Comments

@rishikanthc
Copy link

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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant