8000 Expose iterator shuffling through Trainer config by nelson-liu · Pull Request #1557 · allenai/allennlp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Expose iterator shuffling through Trainer config #1557

Merged
merged 3 commits into from
Aug 2, 2018

Conversation

nelson-liu
Copy link
Contributor

Not really sure how to test this, any suggestions?

@nelson-liu nelson-liu requested a review from joelgrus August 2, 2018 01:16
@joelgrus
Copy link
Contributor
joelgrus commented Aug 2, 2018

hmm, are we shuffling the validation set by default? that's kind of weird?

it's ok if you don't want to test this. if I really wanted to test this, I would probably (in the test file) create a BasicIterator subclass that remembers its instances as it iterates over them, then I would run training just as the current TrainerTest does (maybe for 10 or 20 epochs) and check that in the the no-shuffle case the instances are are in the same order each epoch and that in the shuffle case they're not. but that might be more work than is worthwhile.

@@ -166,6 +166,7 @@ def __init__(self,
patience: Optional[int] = None,
validation_metric: str = "-loss",
validation_iterator: DataIterator = None,
shuffle: bool = True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trainer has a custom from_params, so you'll need to add it there too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, thanks!

@nelson-liu
Copy link
Contributor Author

hmm, are we shuffling the validation set by default? that's kind of weird?

yeah, I noticed this too. I'd be in favor of turning off shuffling at validation, since I presume that's what we do at test time? thoughts?

@joelgrus
Copy link
Contributor
joelgrus commented Aug 2, 2018

it looks like we are shuffling at test time too. 😬

anyway, it appears that we've always been shuffling the validation set, so I wouldn't casually change that behavior. (in theory it shouldn't make a difference, addition is commutative, but who knows)

@DeNeutoy
Copy link
Contributor
DeNeutoy commented Aug 2, 2018

Can someone remind me why this isn't a constructor arg for the Iterator? The way we are passing it here means it's essentially equivalent, as you can't choose to change it whilst training.

@joelgrus
Copy link
Contributor
joelgrus commented Aug 2, 2018

I assumed it was so the same iterator could behave differently on training / dev / test, although that's not possible right now

@nelson-liu nelson-liu merged commit 87b32bb into allenai:master Aug 2, 2018
@nelson-liu nelson-liu deleted the shuffle_trainer branch August 2, 2018 17:05
gabrielStanovsky pushed a commit to gabrielStanovsky/allennlp that referenced this pull request Sep 7, 2018
* Expose iterator shuffling through Trainer config

* Add shuffle to Trainer.from_params
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0