-
Notifications
You must be signed in to change notification settings - Fork 73
Fix #481 #482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #481 #482
Conversation
The change should be covered by the workflow tests. |
Codecov ReportAttention: Patch coverage is
|
The changes look good, but per @stefanradev93 's comment here, I would also be in favor to introduce a |
Sure! I liked that the previous solution reused the existing While this fixes validation set shuffling for the workflow, users working with a manual training pipeline now always need to remember to set (The fixes to validation set shuffling should be complementary to #485) |
Why do you lean towards retaining initial shuffling also for validation sets? My impression would be that we usually aggregate over the validation batches anyway, and computing them should not modify anything, so the order should not matter. Do you have cases in mind where the order of the validation set would matter? If not, I think distinguishing |
Shuffle may still change the results slightly if the batch size does not evenly divide the number of instances. In this case, the last batch is (unfortunately) skipped. |
Are you sure? I think I have seen incomplete batches in the past. At least the datasets produce incomplete batches: ds = bf.OfflineDataset(data={"data": np.random.normal(size=(66,1))}, batch_size=32, adapter=bf.Adapter())
for i, d in enumerate(ds):
print(i, d['data'].shape)
# Output:
0 (32, 1)
1 (32, 1)
2 (2, 1) Is there a skipping mechanism further downstream? |
Yes, I believe the internal |
I had the same impression, but might be mislead here. Curious to hear Lars' opinion on this. |
It appears to, but I have been unable to find it in the code. Could be something else going on, like an off-by-one error. |
Since we could not find evidence that initial shuffling is required for validation/test sets, I followed Valentins suggestion to simplify the interface and control both initial shuffling and shuffling on epoch end with a single argument (using a I also added equivalent changes to the Edit: I'd be interested to hear your opinions on whether we should make |
@elseml Could you please check if the track-losses branch already resolves the problem for your example? My intuition is that it should, but I'm not sure... |
Edit: Nevermind, looks like I didn't correctly adapt the notebook to test it. |
In addition, I would be in favor of renaming the |
@elseml I found the underlying reason for the order-dependence (taking a mean of means with different N, without proper weighting). With this fixed in #485, shuffling in the validation dataset is not a problem anymore, and no modifications to the notebooks are necessary. |
Added the option for OfflineDataset to prevent shuffling on epoch end, leading to stable validation losses also when validation_set_size != batch_size (see #481). Not sure if we want explicit tests for this since it would involve quite some code?