def setUpClass(cls): # go ahead and download things here parser = display_data.setup_args() parser.set_defaults(**END2END_OPTIONS) opt = parser.parse_args([], print_args=False) opt['num_examples'] = 1 display_data.display_data(opt)
def setUpClass(cls): """Set up the test by downloading the model/data.""" with testing_utils.capture_output(): parser = display_data.setup_args() parser.set_defaults(**MODEL_OPTIONS) opt = parser.parse_args(print_args=False) opt['num_examples'] = 1 display_data.display_data(opt)
def setUpClass(cls): # go ahead and download things here with testing_utils.capture_output(): parser = display_data.setup_args() parser.set_defaults(**END2END_OPTIONS) opt = parser.parse_args(print_args=False) opt['num_examples'] = 1 display_data.display_data(opt)
def setUpClass(cls): # go ahead and download things here parser = display_data.setup_args() parser.set_defaults(**END2END_OPTIONS) opt = parser.parse_args([]) opt['num_examples'] = 1 opt['verbose'] = True display_data.display_data(opt)
def setUpClass(cls): """ Set up the test by downloading the model/data. """ parser = display_data.setup_args() parser.set_defaults(**MODEL_OPTIONS) opt = parser.parse_args([]) opt['num_examples'] = 1 display_data.display_data(opt)
def run_display_test(defaults, ep_and_ex_counts): with testing_utils.capture_output() as f: parser = display_setup_args() parser.set_defaults(**defaults) opt = parser.parse_args() display_data(opt) str_output = f.getvalue() self.assertTrue( '[ loaded {} episodes with a total of {} examples ]'.format( ep_and_ex_counts[0], ep_and_ex_counts[1]) in str_output, 'PytorchDataTeacher multitasking failed with ' 'following args: {}'.format(opt))
def display_data(opt): """ Run through a display data run. :return: (stdout_train, stdout_valid, stdout_test) :rtype: (str, str, str) """ import parlai.scripts.display_data as dd parser = dd.setup_args() parser.set_params(**opt) popt = parser.parse_args([]) with capture_output() as train_output: popt['datatype'] = 'train:stream' dd.display_data(popt) with capture_output() as valid_output: popt['datatype'] = 'valid:stream' dd.display_data(popt) with capture_output() as test_output: popt['datatype'] = 'test:stream' dd.display_data(popt) return (train_output.getvalue(), valid_output.getvalue(), test_output.getvalue())
======= <<<<<<< HEAD <<<<<<< HEAD popt = parser.parse_args([], print_args=False) ======= popt = parser.parse_args(print_args=False) >>>>>>> 4f6b99642d60aff1a41b9eae8bd2ccd9e40ebba4 >>>>>>> origin/master ======= popt = parser.parse_args(print_args=False) >>>>>>> 4f6b99642d60aff1a41b9eae8bd2ccd9e40ebba4 >>>>>>> ef574cebef2a8d5aa38b73176b1e71a919d6670f with capture_output() as train_output: popt['datatype'] = 'train:stream' dd.display_data(popt) with capture_output() as valid_output: popt['datatype'] = 'valid:stream' dd.display_data(popt) with capture_output() as test_output: popt['datatype'] = 'test:stream' dd.display_data(popt) return (train_output.getvalue(), valid_output.getvalue(), test_output.getvalue()) def display_model(opt) -> Tuple[str, str, str]: """ Run display_model.py. :return: (stdout_train, stdout_valid, stdout_test)
#!/usr/bin/env python3 # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. """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. """ from parlai.scripts.display_data import display_data, setup_args import random if __name__ == '__main__': random.seed(42) # Get command line arguments parser = setup_args() opt = parser.parse_args() display_data(opt)