-
Notifications
You must be signed in to change notification settings - Fork 257
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
How do I have torchmeta use different data examples for each meta-batch when looping through the entire dataloader? #112
Comments
answer might be here... let see if I can extract it from this giant discussion: #69 |
confirmed that the current code I have is sampling the same set of examples :(
|
seems if I do exactly 1 less than the total number of tasks then I do get different examples:
which seems bizarre to me. |
putting the random hash trick didn't work (though I just feel I am trying random things until something works):
got:
|
Ok this is probably why I am seeing the issue of the same examples being sampled (#69 (comment)):
In principle, if we have the same task sampled (e.g. same set of classes) then we get the same example so I sample zebra, car and we sample that again we get the same set of examples. However, the issue that I am having is that when we sample 1 task (so one example in the meta-batch) that should correspond to one 1 function in regression. So if I sample 199 or 200 functions (but 200 is the entire set of classes), each of them are still 1 task. 200 are not 1 task. Thus, it should not matter if I sample a meta-batch size of 1 or 200 or whatever, it should always give the same example, which seems a bug in torch meta? For now I am happy with the bug since it means I can get different examples by switching the meta batch size to 199 but I believe that should work. Can you confirm this @tristandeleu is this a bug? (note that the case we use all the classes in classification yields the issue of the same task always being sampled, but in the regression case all the functions are still a different set of functions so even if I sample all the functions we should get different examples is my interpretation of how it should work but I am ok with this bug because I can get different examples when I use 1 function less than the total number of functions) |
my ideal solution is for it to work with |
Having the same data when sampling a task multiple times, even in regression problems, is a design choice in Torchmeta for reproducibility which I explained in #69, so that is not a bug. You are right, the random hash trick (which should be applied to the There is no way of doing that out of the box in Torchmeta, and you would need to create your own dataset to have this features. Taking the example of pytorch-meta/torchmeta/toy/sinusoid.py Lines 84 to 86 in 389e35e
(remove np_random , or set np_random=None ).
|
cool, will see how this applies to my data set. Thanks for the reply! Will reply (and hopefully close the issue once I have it working for me and let you know). |
I want to loop through a meta-dataloader multiple times (which I've been able to do easily, especially in regression tasks) but when I loop the second time I want the data examples to be different. Will torchmeta do that automatically?
e.g. if I have a regression problem with 200 functions and my meta-batch size is 200 then I'd get all the 200 functions each time I get 1 batch of the meta-data loader. e.g.
I want that each time
it
increases by1
that I get 200 tasks but each has different examples.The text was updated successfully, but these errors were encountered: