You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a new parameter disable_caching to the pipeline function to control model caching. This feature would be useful for users who need to load models temporarily without storing them in cache, reducing unnecessary disk usage and improving performance for one-time use cases.
fromtransformersimportpipeline# Example of disabling cachingpipe=pipeline(task="zero-shot-classification", model="typeform/distilbert-base-uncased-mnli", disable_caching=True)
Motivation
When testing different models temporarily, it's inefficient to cache each model, especially when they will not be reused. This can lead to wasted disk space and potential performance issues and errors for users who frequently experiment with various models.
Your contribution
I am not very experienced with the library but I am willing to contribute to the initial implementation and testing of this feature if no one wants to work on it.
The text was updated successfully, but these errors were encountered:
Hi @FadiAmon, I'm not sure we can add this! It's not really possible to load a model without downloading it first, so the files will have to be downloaded somewhere. The only way to reduce cache usage would be to delete the model files after the model has finished loading.
If this is a problem for you, you can use the existing cache_dir argument to control where models are downloaded. You can then empty this directory as part of your script, or even make it a TemporaryDirectory() so it automatically gets cleaned up after the model has been loaded.
Feature request
Add a new parameter
disable_caching
to thepipeline
function to control model caching. This feature would be useful for users who need to load models temporarily without storing them in cache, reducing unnecessary disk usage and improving performance for one-time use cases.Motivation
When testing different models temporarily, it's inefficient to cache each model, especially when they will not be reused. This can lead to wasted disk space and potential performance issues and errors for users who frequently experiment with various models.
Your contribution
I am not very experienced with the library but I am willing to contribute to the initial implementation and testing of this feature if no one wants to work on it.
The text was updated successfully, but these errors were encountered: