Best Python code snippet using dbt-osmosis_python
test_blended_skill_talk_gpu.py
Source:test_blended_skill_talk_gpu.py
1#!/usr/bin/env python32# Copyright (c) Facebook, Inc. and its affiliates.3# This source code is licensed under the MIT license found in the4# LICENSE file in the root directory of this source tree.5import unittest6from parlai.utils import testing as testing_utils7SHARED_OPTS = {'batchsize': 16, 'task': 'blended_skill_talk', 'num_examples': 64}8class TestBlendedSkillTalkModels(unittest.TestCase):9 """10 Test accuracies of BST models in the zoo.11 """12 def test_bst_single_task(self):13 """14 Test model trained single-task on BlendedSkillTalk.15 """16 valid, _ = testing_utils.eval_model(17 opt={18 **SHARED_OPTS,19 'model_file': f'zoo:blended_skill_talk/bst_single_task/model',20 },21 skip_test=True,22 )23 self.assertAlmostEqual(valid['accuracy'], 0.8906, delta=0.005)24 def test_convai2_single_task(self):25 """26 Test model trained single-task on ConvAI2.27 """28 valid, _ = testing_utils.eval_model(29 opt={30 **SHARED_OPTS,31 'model_file': f'zoo:blended_skill_talk/convai2_single_task/model',32 },33 skip_test=True,34 )35 self.assertAlmostEqual(valid['accuracy'], 0.8438, delta=0.005)36 def test_ed_single_task(self):37 """38 Test model trained single-task on EmpatheticDialogues.39 """40 valid, _ = testing_utils.eval_model(41 opt={42 **SHARED_OPTS,43 'model_file': f'zoo:blended_skill_talk/ed_single_task/model',44 },45 skip_test=True,46 )47 self.assertAlmostEqual(valid['accuracy'], 0.7656, delta=0.005)48 def test_wizard_single_task(self):49 """50 Test model trained single-task on Wizard of Wikipedia.51 """52 valid, _ = testing_utils.eval_model(53 opt={54 **SHARED_OPTS,55 'model_file': f'zoo:blended_skill_talk/wizard_single_task/model',56 },57 skip_test=True,58 )59 self.assertAlmostEqual(valid['accuracy'], 0.7500, delta=0.005)60 def test_multi_task(self):61 """62 Test model trained multi-task on dialogue datasets.63 """64 valid, _ = testing_utils.eval_model(65 opt={66 **SHARED_OPTS,67 'model_file': f'zoo:blended_skill_talk/multi_task/model',68 },69 skip_test=True,70 )71 self.assertAlmostEqual(valid['accuracy'], 0.9062, delta=0.005)72 def test_multi_task_bst_tuned(self):73 """74 Test model trained multi-task and then tuned on BlendedSkillTalk.75 """76 valid, _ = testing_utils.eval_model(77 opt={78 **SHARED_OPTS,79 'model_file': f'zoo:blended_skill_talk/multi_task_bst_tuned/model',80 },81 skip_test=True,82 )83 self.assertAlmostEqual(valid['accuracy'], 0.9219, delta=0.005)84if __name__ == '__main__':...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!