def main():
    model_path = '/home/warvisionary/parlai_transfer/from_pretrained/model'
    print(f"Displaying example generation from model: {model_path}")
    DisplayModel.main(task='empathetic_dialogues_ru',
                      model_file=model_path,
                      num_examples=16,
                      skip_generation=False)
Beispiel #2
0
    def test_display_model(self):
        from parlai.scripts.display_model import DisplayModel

        with testing_utils.capture_output() as output:
            DisplayModel.main(
                model='fixed_response',
                fixed_response='1 2 3 4',
                task='integration_tests',
                verbose=True,
            )

        output = output.getvalue()
        assert 'metrics' in output
        assert 'accuracy' in output
        assert '1 2 3 4' in output
Beispiel #3
0
import sys
from parlai.scripts.display_model import DisplayModel

f = open("kv_self_short_0.4679.txt", 'w')
sys.stdout = f

DisplayModel.main(
    task='personachat',
    # model_file='model/seq2seq/self_persona_2',
    model_file='model/kvmemnn/self_persona_short',
    num_examples=1000,
)

f.close()
Beispiel #4
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)
from parlai.scripts.display_data import DisplayData
# DisplayData.main(task='wikiqa', num_examples=5)

from parlai.scripts.display_model import DisplayModel
DisplayModel.main(
    task='bankQA',
    model_file='from_pretrained/model',
    num_examples=10,
    skip_generation=False,
)

# from parlai.scripts.train_model import TrainModel

# print(TrainModel.help(model='seq2seq'))
Beispiel #6
0
            new_episode = True

            for line in f.readlines():
                splits = line.split('   ')

                if len(splits) == 3:
                    yield (splits[0].replace('text:', ''),
                           splits[1].replace('labels:', '')), new_episode
                    new_episode = True
                else:
                    yield (splits[0].replace('text:', ''),
                           splits[1].replace('labels:', '')), new_episode
                    new_episode = False


DisplayModel.main(task='poly_teacher', model='poly')
TrainModel.main(
    model='seq2seq',
    model_file='poly-encoder/model',
    dict_file='zoo:dodecadialogue/empathetic_dialogues_ft/model.dicts',
    task='poly_teacher',
    batchsize=3,
    validation_every_n_secs=10,
    max_train_time=60,
)

DisplayModel.main(
    task='poly_teacher',
    model_file='poly-encoder/model',
    num_examples=6,
)