Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
[Chunk Teacher] Remove exception for specifying non-streaming data (#…
Browse files Browse the repository at this point in the history
…3653)

* remove exception

* update chunk teacher tests
  • Loading branch information
klshuster authored May 14, 2021
1 parent 8e006ba commit de07b0e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
3 changes: 0 additions & 3 deletions parlai/core/teachers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2291,9 +2291,6 @@ def __init__(self, opt, shared=None):
super().__init__(opt, shared)
self.buffersize = self.get_buffersize()

if 'stream' not in opt['datatype']:
raise ValueError('Chunk teacher should be used with streaming. ')

self.set_datasettings(opt)

self.dws = int(self.opt.get('distributed_world_size', 1))
Expand Down
40 changes: 19 additions & 21 deletions tests/test_teachers.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,27 +301,25 @@ def test_dynamic_batched(self):
assert valid['exs'] == 100
assert test['exs'] == 100

def test_stream_only(self):
with self.assertRaises(ValueError):
valid, test = testing_utils.eval_model(
dict(
task='integration_tests:chunky',
model='parlai.agents.test_agents.test_agents:MockTorchAgent',
batchsize=32,
),
valid_datatype='valid',
)

with self.assertRaises(ValueError):
valid, test = testing_utils.eval_model(
dict(
task='integration_tests:chunky',
model='parlai.agents.test_agents.test_agents:MockTorchAgent',
batchsize=32,
),
valid_datatype='valid:stream',
test_datatype='test',
)
def test_non_stream_works(self):
testing_utils.eval_model(
dict(
task='integration_tests:chunky',
model='parlai.agents.test_agents.test_agents:MockTorchAgent',
batchsize=32,
),
valid_datatype='valid',
)

testing_utils.eval_model(
dict(
task='integration_tests:chunky',
model='parlai.agents.test_agents.test_agents:MockTorchAgent',
batchsize=32,
),
valid_datatype='valid:stream',
test_datatype='test',
)


class CustomEvaluationTeacher(DialogTeacher):
Expand Down

0 comments on commit de07b0e

Please sign in to comment.