Added batch_size_predict kwarg to PyTorch LearnedKernelDrift#715
Added batch_size_predict kwarg to PyTorch LearnedKernelDrift#715ascillitoe merged 7 commits intoSeldonIO:masterfrom ascillitoe:feature/learnedkernel_batch_size_predict
batch_size_predict kwarg to PyTorch LearnedKernelDrift#715Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
batch_size_predict kwarg to PyTorch LearnedKernelDrift
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #715 +/- ##
==========================================
- Coverage 80.32% 80.17% -0.16%
==========================================
Files 137 137
Lines 9302 9261 -41
==========================================
- Hits 7472 7425 -47
- Misses 1830 1836 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Preliminary experiments on the @arnaudvl would be good to get your thoughts on the above. Wondering if I'm misinterpreting what you had in mind with #612 . |
Have you tried runtimes for e.g. |
| "* `dataloader`: Dataloader object used during training of the kernel. Defaults to `torch.utils.data.DataLoader`. The dataloader is not initialized yet, this is done during init off the detector using the `batch_size`. Custom dataloaders can be passed as well, e.g. for graph data we can use `torch_geometric.data.DataLoader`.\n", | ||
| "\n", | ||
| "Additional KeOps keyword arguments:\n", | ||
| "* `batch_size_predict`: Batch size used for the trained drift detector predictions. Defaults to 1,000,000 for KeOps and 1,000 for PyTorch.\n", |
There was a problem hiding this comment.
This is not quite true in practice since the top level detector is instantiated by default with 1mn and this default propagates to PyTorch.
There was a problem hiding this comment.
Ah good point. For the default I guess we'll have to decide on a compromise for the optimal value between the pytorch and keops implementations?
There was a problem hiding this comment.
As PyTorch is likely the more common use case, might be fine to prioritise that one.
|
@arnaudvl below are some more detailed benchmarks. Note that the KeOpsPyTorchI'm taking two conclusions from this, but let me know if you disagree or would like more/different runs (or plots etc). For PyTorch:
|
|
Some more PyTorch results going down to smaller Conclusion is that going down to very small
@arnaudvl any thoughts on this? I'm not seeing significant benefits to having |
Mainly wanted to check low |
@arnaudvl here are the updated results with low However, I think if we had considerbly less memory so big gain in increasing However, if we are already able to run big So to summarise, I can see the two separate kwarg's being useful when p.s. I haven't run v. large |
The argument for |
Good point! We are good to go then (after review!) 🙂 |
batch_size_predictwas included as a kwarg to the KeOpsLearnedKernelDriftbackend in #602 (batch_size_predictcontrols the batch size used for predictions with the already trained kernel). This adds the same option to the PyTorchLearnedKernelDriftbackend for consistency.Resolves #612
TODO's
cd_mmd_keops.ipynbexample to account for the new PyTorch kwarg.