Esempio n. 1
0
        test_dataset = datasets.ImageFolder(args.data_dir,
                                            train=False,
                                            download=False,
                                            transform=test_transform)
        train_pics = 121187
    elif args.model == 'Abalone':
        model = ResNetOnCifar10.abalone_model()
        test_dataset = mldatasets.abalone(args.data_dir, False)
        train_pics = 3342
    elif args.model == "Bodyfat":
        model = ResNetOnCifar10.bodyfat_model()
        test_dataset = mldatasets.bodyfat(args.data_dir, False)
        train_pics = 202
    elif args.model == 'Housing':
        model = ResNetOnCifar10.housing_model()
        test_dataset = mldatasets.housing(args.data_dir, False)
        train_pics = 405
    else:
        print('Model must be {} or {}!'.format('MnistCNN', 'AlexNet'))
        sys.exit(-1)

    train_bsz = args.train_bsz
    train_bsz /= len(workers)

    world_size = args.workers_num + 1
    this_rank = args.this_rank

    p = TorchProcess(target=init_processes,
                     args=(this_rank, world_size, model, train_pics, train_bsz,
                           run))
    p.start()
Esempio n. 2
0
                                             transform=train_transform)
        test_dataset = datasets.ImageFolder(args.data_dir,
                                            train=False,
                                            download=False,
                                            transform=test_transform)
    elif args.model == 'Abalone':
        model = ResNetOnCifar10.abalone_model()
        train_dataset = mldatasets.abalone(args.data_dir, True)
        test_dataset = mldatasets.abalone(args.data_dir, False)
    elif args.model == "Bodyfat":
        model = ResNetOnCifar10.bodyfat_model()
        train_dataset = mldatasets.bodyfat(args.data_dir, True)
        test_dataset = mldatasets.bodyfat(args.data_dir, False)
    elif args.model == 'Housing':
        model = ResNetOnCifar10.housing_model()
        train_dataset = mldatasets.housing(args.data_dir, True)
        test_dataset = mldatasets.housing(args.data_dir, False)
    else:
        print('Model must be {} or {}!'.format('MnistCNN', 'AlexNet'))
        sys.exit(-1)

    train_bsz = args.train_bsz
    test_bsz = 400

    train_bsz /= len(workers)
    train_bsz = int(train_bsz)

    train_data = partition_dataset(train_dataset, workers)
    test_data = partition_dataset(test_dataset, workers)

    this_rank = args.this_rank