Lightweight BO in botorch #2273
-
Hi, first of all, great work! I am looking to run botorch in a lightweight setting with highly limited RAM capabilities and wonder if anyone has had similar thoughts. In principle, the baseline requirements to run BO are quite small, but run into two hiccups. The first is torch by itself. Just importing torch and botorch is 350MB, though I suppose botorch does not require all this functionality? Has anyone found a reasonable way to run a lightweight version of torch with only the necessary functionality? Secondly, I'm looking to evaluate the acquisition for a large number of points as part of a custom acq function optimizer. But calling model.posterior() naturally calculates the full mvn distribution (which uses a lot of RAM), where I would only need the mean and variance for every point. On the other hand, reshaping to have a large number of batches instead makes it very slow (and strangely doesn't use that little memory according to memory_profiler). Is there an easy way to just get the mean and variance without having to calculate the full posterior that I have missed? Thanks alot! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hi @ErikOrm. This is an interesting setting that we haven't thought much about.
I briefly looked at this on my laptop. For me, Python process itself seems to register 6-7MB before any imports.
I do not know what gets loaded to memory on
Reshaping the inputs to be It is hard to say much about how the reshaping would affect the runtime & memory usage without some profiling. In general, the effects will depend on the input sizes. If you have relatively small training data and you're jointly predicting a small number of points (
As you can see, the effect is dependent on the train and test data sizes. The largest tensors we work with will be the train-test covariances, which have shape |
Beta Was this translation helpful? Give feedback.
Hi @ErikOrm. This is an interesting setting that we haven't thought much about.
I briefly looked at this on my laptop. For me, Python process itself seems to register 6-7MB before any imports.
import torch
brings this up to 142MB.import botorch
increases it further to 183MB. The precise numbers are not relevant, there's clearly a significant memory usage from just importing these packages.I do not know what gets loaded to memory on
import torch
. Presumably, this includes the core tensor functionality and relevant C++ code that enables many of the tensor operations we rely on. BoTorch…