Ejemplo n.º 1
0
        oov_token=1,
        sos_token=2,
        eos_token=3,
        max_size=30)  # max size of generated sentence in prediction mode

    model.fit(training_set,
              test_set,
              lr=0.001,
              batch_size=64,
              n_epochs=20,
              patience=2)
    model.save(path_to_save_models + 'my_model.pt')

else:

    model = seq2seqModel.load(path_to_save_models + 'pretrained_moodle.pt')

    to_test = [
        'I am a student.',
        'I have a red car.',  # inversion captured
        'I love playing video games.',
        'This river is full of fish.',  # plein vs pleine (accord)
        'The fridge is full of food.',
        'The cat fell asleep on the mat.',
        'my brother likes pizza.',  # pizza is translated to 'la pizza'
        'I did not mean to hurt you',  # translation of mean in context
        'She is so mean',
        'Help me pick out a tie to go with this suit!',  # right translation
        "I can't help but smoking weed",  # this one and below: hallucination
        'The kids were playing hide and seek',
        'The cat fell asleep in front of the fireplace'
        oov_token=1,
        sos_token=2,
        eos_token=3,
        max_size=30)  # max size of generated sentence in prediction mode

    model.fit(training_set,
              test_set,
              lr=0.001,
              batch_size=64,
              n_epochs=2,
              patience=2)
    model.save(path_to_save_models + 'my_model.pt')

else:

    model = seq2seqModel.load(path_to_save_models + 'pretrained_moodle.pt',
                              vocab_source_inv)

    to_test = [
        'I am a student',
        'I have a red car.',  # inversion captured
        'I love playing video games.',
        'This river is full of fish.',  # plein vs pleine (accord)
        'The fridge is full of food.',
        'The cat fell asleep on the mat.',
        'my brother likes pizza.',  # pizza is translated to 'la pizza'
        'I did not mean to hurt you',  # translation of mean in context
        'She is so mean',
        'Help me pick out a tie to go with this suit!',  # right translation
        "I can't help but smoking weed",  # this one and below: hallucination
        'The kids were playing hide and seek',
        'The cat fell asleep in front of the fireplace'