コード例 #1
0
 def setUp(self):
     self.parser = train.create_parser()
コード例 #2
0
ファイル: batch_train.py プロジェクト: iksmada/PC-DARTS
                         init_channels: int, classes: int, layers: int,
                         auxiliary: bool) -> int:
    model = Network(init_channels, classes, layers, auxiliary, genotype)
    model_size_mb = utils.count_parameters_in_MB(model)
    batch_size = 0
    consumption = 0
    while consumption < (memory - 500):
        batch_size += 1
        consumption = batch_model.predict([[model_size_mb, batch_size]])
    log.info("Predicted consumption is %d MB", consumption)
    return batch_size


if __name__ == '__main__':
    log = logging.getLogger("batch_train")
    parser = create_parser()
    parser.add_argument('--archs',
                        type=str,
                        required=False,
                        nargs='+',
                        help='list of architectures to use',
                        default=[
                            arch for arch, gen in genotypes.__dict__.items()
                            if isinstance(gen, Genotype)
                        ])
    parser.add_argument('--batch_model',
                        type=str,
                        default="batch_predict.pkl",
                        help='list of architectures to use')
    args = parser.parse_args()
コード例 #3
0
 def test_lc(self):
     parser = train.create_parser()
     namespace = parser.parse_args(("--lc", ))
     self.assertIsNotNone(namespace.lc)
コード例 #4
0
import argparse
import train

train_commands = [
    # anoCAE
    "-d LEGO_light/SV -a anoCAE -b 8 -l mssim -c rgb -e 60 -r custom --inspect",
    # baselineCAE
    "-d LEGO_light/SV -a baselineCAE -b 8 -l mssim -c rgb -e 60 -r custom --inspect",
    # inceptionCAE
    "-d LEGO_light/SV -a inceptionCAE -b 8 -l mssim -c rgb -e 60 -r custom --inspect",
    # mvtecCAE
    "-d LEGO_light/SV -a mvtecCAE -b 8 -l mssim -c rgb -e 60 -r custom --inspect",
    # resnetCAE
    "-d LEGO_light/SV -a resnetCAE -b 8 -l mssim -c rgb -e 60 -r custom --inspect",
    # skipCAE
    "-d LEGO_light/SV -a skipCAE -b 8 -l mssim -c rgb -e 60 -r custom --inspect",
]

parser = train.create_parser()
for command in train_commands:
    args_list = command.split(" ")
    args = parser.parse_args(args_list)
    try:
        train.main(args)
    except Exception:
        pass
コード例 #5
0
 def test_no_lc(self):
     commands = train.create_parser().parse_args(("--model", "model.txt"))
     words = train.prepare_line('I hate unittests.,,apple;', commands)
     for word in words:
         self.assertTrue(word.isalpha())
コード例 #6
0
 def test_lc(self):
     commands = train.create_parser().parse_args(("--lc", ))
     words = train.prepare_line("I don't like unittest__oh-oh", commands)
     for word in words:
         self.assertTrue(word.islower())
         self.assertTrue(word.isalpha())
コード例 #7
0
 def test_model(self):
     parser = train.create_parser()
     namespace = parser.parse_args(("--mode", "model.txt"))
     self.assertEqual(namespace.model, "model.txt")
コード例 #8
0
 def test_input_dir(self):
     parser = train.create_parser()
     namespace = parser.parse_args(("--input-dir", "input/"))
     self.assertEqual("input/", namespace.input_dir)
コード例 #9
0
def run_experiments(experiments_filepath):
    parser = create_parser()
    args = parser.parse_args(args=[])
    args.config_file = experiments_filepath
    run(args, parser)