Separating the function to loop over data from the one to create batches for training#92
Separating the function to loop over data from the one to create batches for training#92anagainaru merged 5 commits intomainfrom
Conversation
|
I think this is a neccessary change - but very intrusive in the sense that all examples needs to be adapted. Do you have an example that runs currently, so I can validate the changes locally? |
|
I think with this change we can further simplify: ==> the loop loader only needs a val_loader, since we are not training on this data |
You do not need to change the examples, if this second function is not implemented we use the current behavior with looping over data using the training batch size. |
Agree, I will make the change and update mnist so you can run using different batches if you specify in toml a data batch size. |
ScSteffen
left a comment
There was a problem hiding this comment.
Functionality checked manually. Changes look good. Approved
Summary
Current behavior is to have a function
get_cur_data_loadersthat returns the dataloaders that is used for both looping for inference and for creating batches to train when doing continual learning. The current PR separates them into two separate functions.Motivation
Having two functions allows us to control the granularity of the drift detectors during streaming (e.g. looking at element by element) without impacting the training (which should use the same batch size as what was used for the original training)
API / CLI Changes
!! This PR changes out current API !!
Introduced a new function
def get_stream_dataloader(self)that return the data loader over the stream of data using a different batch size that the training (the model harnesses could use the data side of the configuration, by default this is set to 1, each data in the stream should be analyzed in isolation).The
self.get_cur_data_loaders()is renamed todef get_train_dataloaders(self)and returns as before the training and validation used by the continual learning. It uses the batch_size specified in the training side of the configuration.The
get_hist_data_loadersis exactly the same but it's renamed toget_hist_dataloadersto be consistent with the others.Usage
The MNIST example has been updated to show how to use the new function.
Imagenet and cifar have only minimal changes to update to the new API but the functionality did not change (the training and streaming loaders are exactly the same).