Skip to content
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

input_search and target_search are unchanged during iteration #8

Closed
yukang2017 opened this issue Jun 29, 2018 · 6 comments
Closed

input_search and target_search are unchanged during iteration #8

yukang2017 opened this issue Jun 29, 2018 · 6 comments

Comments

@yukang2017
Copy link

input_search, target_search = next(iter(search_queue))

Hi, thank you for releasing code! nice work!
But I discover something I can't understand. In function train in train_search.py, input_search and target_search are unchanged during iteration. They are always the first batch in search_queue.

Is it a small bug or you do it by purpose?

@yukang2017
Copy link
Author

I guess this part should be:

it = iter(search_queue)
for step, (input, target) in enumerate(train_queue):
...
input_search, target_search = next(it)
...

@quark0
Copy link
Owner

quark0 commented Jun 29, 2018

This is not a bug. The "first batch" returned by next(iter(search_queue)) is supposed to be different in each step as search_queue is based on SubsetRandomSampler. Can you double check by printing the batch per step? This was done by purpose to prevent search_queue from running out of data during a training epoch (which could happen if the search set is smaller than the training set).

@yukang2017
Copy link
Author

Sorry, I was wrong.

@quark0
Copy link
Owner

quark0 commented Jun 29, 2018

No worries and thanks for helping inspect the code. I'll put a comment there in my next commit.

@JaminFong
Copy link

@quark0 Hello~I find that doing like this equals to sampling with replacement. It will cause repeated samples in one epoch. And the samples in the validation set cannot be traversed in one epoch.

input_search, target_search = next(iter(valid_queue))

@ShihuaHuang95
Copy link

@JaminFong And any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants