rust-bert icon indicating copy to clipboard operation
rust-bert copied to clipboard

Flexibility to configure path of cached models

Open diptanu opened this issue 2 years ago • 2 comments

Hey @guillaume-be will you accept an PR to make the path of downloaded models configurable? An application using this library might want the path for caching(or to turn off caching) via an application configuration, so having it be part of the builder API of pipelines might be nice. What do you think?

diptanu avatar Apr 23 '23 00:04 diptanu

Hello @diptanu ,

The cache directory can already be configured at the crate level via the RUSTBERT_CACHE environment variable (defaulting to ~/.rustbert if not set), which mirrors most of the applications for the transformers library. Given the handling of optional arguments in Rust passing this as an additional option for all pipelines and models may clutter the API and I am not sure how often one would need to dynamically change the cache location on a per-model/pipeline basis.

I feel the current solution of the environment variable (or manually downloading the needed models for special cases) fits most use cases - what do you think?

guillaume-be avatar Apr 23 '23 12:04 guillaume-be

@guillaume-be application developers might be going for a particular operator experience so they might want to control how things are being configured.

For example, the application might allow caching for some models and not cache for others in a shared environment. Since there is a builder api for building pipelines I think the UX should be fine.

One idea would be - use the value set in environment variable by default and override it through a builder api in the pipelines.

diptanu avatar Apr 23 '23 16:04 diptanu