Describe the bug
I am trying to bentoml serve Model:latest where Model includes in my case two large SkLearnModelArtifacts (around 2GB).
I've run into OSError: [Errno 24] Too many open files, and conjecture that the reason is that bentoML uses sklearn_model = joblib.load(model_file_path, mmap_mode='r') to load the artifacts (see https://github.com/joblib/joblib/issues/81).
To Reproduce
SkLearnModelArtifactsulimit -n (I had to set ulimit -n 10000 for this to actually run)Expected behavior
Any artifact is loaded without trouble (or there is an error when the model is saved, indicating that it is too large/otherwise bad to load).
Environment:
Hi @timlod - it looks like there isn't much we can do on BentoML side for this issue, one workaround is to use BentoML's PickleArtifact to package your Scikit learn model: https://docs.bentoml.org/en/latest/api/artifacts.html?highlight=PickleArtifact#common-artifacts
I see, thanks for the heads-up!
Actually, it would be possible for BentoML to use joblib.load(model_file_path, mmap_mode=None) - then memory mapping is not used and the error won't occur. How vital is memmapping here?
Actually, it would be possible for BentoML to use
joblib.load(model_file_path, mmap_mode=None)- then memory mapping is not used and the error won't occur. How vital is memmapping here?
We can potentially make that an option and allow user to turn it off. E.g.
_SklearnArtifact("my_model", mmap_mode=None)_