-
Notifications
You must be signed in to change notification settings - Fork 297
Fix target_train_data_fraction overriding pretrain_data_fraction #1070
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fff429c
add private instance generator field to Task w/ getter and setter
pyeres 348b921
update build_tasks to use new instance generator Task field setter
pyeres df68216
update trainer to get phase-appropriate instance generators
pyeres ea90c29
update evaluate to use new Task instance generator getter
pyeres 810ed97
update pred writing task to use new instance generator getter/setter
pyeres 98243e7
add tests for new Task instance generator functionality
pyeres c5d6822
rename var: dataset_name -> split_name
pyeres a44d4d5
drop stray BucketIterator comment
pyeres 72a5bfe
rename to correct types: generator -> iterable
pyeres aa1666a
Merge branch 'master' into py/fix_data_fraction
pyeres File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,65 @@ | ||
| import logging | ||
| import unittest | ||
|
|
||
| from jiant.tasks import Task | ||
| from jiant.tasks.registry import REGISTRY | ||
|
|
||
|
|
||
| def test_instantiate_all_tasks(): | ||
| """ | ||
| All tasks should be able to be instantiated without needing to access actual data | ||
| class TestTasks(unittest.TestCase): | ||
| def test_instantiate_all_tasks(self): | ||
| """ | ||
| All tasks should be able to be instantiated without needing to access actual data | ||
|
|
||
| Test may change if task instantiation signature changes. | ||
| """ | ||
| logger = logging.getLogger() | ||
| logger.setLevel(level=logging.CRITICAL) | ||
| for name, (cls, _, kw) in REGISTRY.items(): | ||
| cls( | ||
| "dummy_path", | ||
| max_seq_len=1, | ||
| name="dummy_name", | ||
| tokenizer_name="dummy_tokenizer_name", | ||
| **kw, | ||
| Test may change if task instantiation signature changes. | ||
| """ | ||
| logger = logging.getLogger() | ||
| logger.setLevel(level=logging.CRITICAL) | ||
| for name, (cls, _, kw) in REGISTRY.items(): | ||
| cls( | ||
| "dummy_path", | ||
| max_seq_len=1, | ||
| name="dummy_name", | ||
| tokenizer_name="dummy_tokenizer_name", | ||
| **kw, | ||
| ) | ||
|
|
||
| def test_tasks_get_train_instance_generators_without_phase(self): | ||
| task = Task(name="dummy_name", tokenizer_name="dummy_tokenizer_name") | ||
| train_iterable_instance_generator = [1, 2, 3] | ||
| task.set_instance_generator("train", train_iterable_instance_generator, "target_train") | ||
| self.assertRaises(ValueError, task.get_instance_generator, "train") | ||
|
|
||
| def test_tasks_set_and_get_instance_generators(self): | ||
| task = Task(name="dummy_name", tokenizer_name="dummy_tokenizer_name") | ||
| val_iterable_instance_generator = [1, 2, 3] | ||
| test_iterable_instance_generator = [4, 5, 6] | ||
| train_pretrain_iterable_instance_generator = [7, 8] | ||
| train_target_train_iterable_instance_generator = [9] | ||
| task.set_instance_generator("val", val_iterable_instance_generator) | ||
| task.set_instance_generator("test", test_iterable_instance_generator) | ||
| task.set_instance_generator("train", train_pretrain_iterable_instance_generator, "pretrain") | ||
| task.set_instance_generator( | ||
| "train", train_target_train_iterable_instance_generator, "target_train" | ||
| ) | ||
| retreived_val_iterable_instance_generator = task.get_instance_generator("val") | ||
| retreived_test_iterable_instance_generator = task.get_instance_generator("test") | ||
| retreived_train_pretrain_iterable_instance_generator = task.get_instance_generator( | ||
| "train", "pretrain" | ||
| ) | ||
| retreived_train_target_iterable_instance_generator = task.get_instance_generator( | ||
| "train", "target_train" | ||
| ) | ||
| self.assertListEqual( | ||
| val_iterable_instance_generator, retreived_val_iterable_instance_generator | ||
| ) | ||
| self.assertListEqual( | ||
| test_iterable_instance_generator, retreived_test_iterable_instance_generator | ||
| ) | ||
| self.assertListEqual( | ||
| train_pretrain_iterable_instance_generator, | ||
| retreived_train_pretrain_iterable_instance_generator, | ||
| ) | ||
| self.assertListEqual( | ||
| train_target_train_iterable_instance_generator, | ||
| retreived_train_target_iterable_instance_generator, | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.