Пример #1
0
def _display_data(**kwargs):
    with capture_output() as output:
        DisplayData.main(**kwargs)
    return output.getvalue()
Пример #2
0
        opt['datafile'] = opt['datatype'].split(':')[0] + ".txt"
        super().__init__(opt, shared)

    def setup_data(self, datafile):
        # filename tells us where to load from.
        # We'll just use some hardcoded data, but show how you could read the filename here:
        print(f" ~~ Loading from {datafile} ~~ ")

        # setup_data should yield tuples of ((text, label), new_episode)
        # That is ((str, str), bool)

        # first episode
        # notice how we have call, response, and then True? The True indicates this is a first message
        # in a conversation
        # Let's discuss the security deposit</s>Do you have the full amount for the deposit?
        yield ("Let's discuss the security deposit", ""), True
        # Next we have the second turn. This time, the last element is False, indicating we're still going
        yield ('Do you have the full amount for the deposit?', ''), False
        # yield ("Let's say goodbye", ''), False

        # second episode. We need to have True again!
        yield (" Do you like baseball", ""), True
        yield ("I've never watched a game.", ""), False
        # yield ("Last chance", ""), False


DisplayData.main(task="chateval_multiturn")
DisplayModel.main(task='chateval_multiturn',
                  model_file='zoo:blender/blender_90M/model',
                  skip_generation=False)
Пример #3
0
    def test_no_plain_teacher(self):
        from parlai.scripts.display_data import DisplayData

        with self.assertRaises(RuntimeError):
            DisplayData.main(task='self_chat')
Пример #4
0
#!/usr/bin/env python3

# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Basic example which iterates through the tasks specified and prints them out. Used for
verification of data loading and iteration.

For more documentation, see parlai.scripts.display_data.
"""

import random
from parlai.scripts.display_data import DisplayData

if __name__ == '__main__':
    random.seed(42)
    DisplayData.main()