Exemplo n.º 1
0
 def search_default(cls) -> "FullyConv1Resnet.ModelParams":
     return cls(
         num_groups=params.Discrete([8, 16, 32, 64]),
         num_blocks_per_residual=params.Integer(1, 5),
         activation=params.Categorical([nn.LeakyReLU, nn.GELU]),
         do_include_first_norm=params.Boolean(p_true=0.8),
     )
Exemplo n.º 2
0
 class ModelHyperParams(params.ParameterSet):
     num_hidden_layers = params.Integer(1, 4)
     num_neurons_per_layer = params.Discrete(
         np.logspace(2, 7, num=6, base=2, dtype=np.int))
     dropout_rate = params.Float(0.0, 0.99)
     activation = params.Categorical(['relu', 'sigmoid'])
     output_dir = '/tmp/output'
     filter_size = 3
Exemplo n.º 3
0
class DocGenParams(params.ParameterSet):
    margin = '0.5in'
    page_size = hc.PageSize.LETTER
    dpi = params.Discrete.from_prob_dict({
        300: 1,
        250: 1,
    })

    do_randomize_field_order = True

    group_offset_in = params.Float(0.0, 3.0)
    do_set_invisible_border = params.Boolean(p_true=0.9)
    num_extra_fields = params.Discrete.from_prob_dict({
        0: 1,
        1: 1,
    })
    font_size_px = params.Integer(8, 19)
    val_font_size_px = params.Integer(8, 19)
    do_regen_font_val_size = params.Boolean(0.4)
    table_cell_padding_px = params.Integer(1, 7)
    do_bold_keys = params.Boolean(p_true=0.2)
    do_add_colon_to_keys = params.Boolean(p_true=0.2)
    vert_alignment = params.Categorical.from_prob_dict({
        kv_styles.KvAlign.TT: 2,
        kv_styles.KvAlign.BB: 1,
        kv_styles.KvAlign.TB: 1,
    })
    horz_alignment = params.Categorical.from_prob_dict({
        kv_styles.KvAlign.LL:
        2,
        kv_styles.KvAlign.RL:
        1,
        kv_styles.KvAlign.LR:
        1,
        kv_styles.KvAlign.CL:
        0.2,
        kv_styles.KvAlign.LC:
        0.2,
    })

    def get_page_size_px(self):
        return [
            self.dpi * self.page_size.width, self.dpi * self.page_size.height
        ]
Exemplo n.º 4
0
    hp.opt.lr = params.Discrete([1e-4, 1e-3, 1e-2, 1e-1])
    hp.opt.min_lr = 1e-6
    hp.opt.patience = 16

    hp.exp.project_name = 'tablestakes'
    hp.exp.experiment_name = 'korv_which'
    hp.exp.experiment_tags = [
        'korv_which', 'conv', 'sharp', 'search', 'v0.0.1'
    ]
    hp.exp.sources_glob_str = constants.THIS_DIR.parent.parent / '**/*.py'

    hp.embed.dim = 16
    hp.embed.requires_grad = True

    hp.conv.num_features = params.Discrete([32, 64, 128, 256])
    hp.conv.num_layers = params.Integer(2, 11)
    hp.conv.kernel_size = 3
    hp.conv.num_groups = params.Discrete([8, 16, 32, 64])
    hp.conv.num_blocks_per_pool = 20
    hp.conv.num_blocks_per_skip = 2
    hp.conv.requires_grad = True

    hp.trans.impl = params.Categorical(['fast', 'fast-favor'])
    hp.trans.num_layers = params.Discrete([0, 2, 4, 6, 8])
    hp.trans.num_heads = params.Discrete([4, 8, 12])
    hp.trans.num_query_features = params.Discrete([0, 32, 64, 128, 256, 512])
    hp.trans.fc_dim_mult = params.Discrete([1, 2, 3, 4])

    hp.fc.num_features = params.Discrete([32, 64, 128, 256])
    hp.fc.num_layers = params.Integer(2, 7)
    hp.fc.num_groups = params.Discrete([8, 16, 32, 64])
    env['PROJECT_ID'] = GCLOUD_PROJECT_NAME
    env['IMAGE_URI'] = CONTAINER_IMAGE_URI
    env['BUCKET_NAME'] = GCLOUD_BUCKET_NAME

    # Create a Cloud AI Platform Hyperparameter Search object
    search = search.HyperparamSearchSpec(
        max_trials=10,
        max_parallel_trials=5,
        max_failed_trials=2,
        hyperparameter_metric_tag='val_acc',
    )

    # Add parameter search ranges for this problem.
    my_param_ranges = train.MyParams(
        activation=params.Categorical(['relu', 'tanh']),
        num_layers=params.Integer(min_value=1, max_value=3),
        num_neurons=params.Discrete(np.logspace(2, 8, num=7, base=2)),
        dropout_rate=params.Double(min_value=-0.1, max_value=0.9),
        learning_rate=params.Discrete(np.logspace(-6, 2, 17, base=10)),
        batch_size=params.Integer(min_value=1, max_value=128),
    )
    search.add_parameters(my_param_ranges)

    # Call a bash script to build a docker image for this repo, submit it to the docker registry defined in the script
    # and run a training job on the Cloud AI Platform using this container and these hyperparameter ranges.
    this_dir = Path(__file__).resolve().parent
    retcode = subprocess.call([this_dir / 'build_push.sh'], env=env)
    if retcode:
        raise ValueError(f"Got returncode: {retcode}")

    search.run_from_container(
Exemplo n.º 6
0
 def search_default(cls) -> "SlabNet.ModelParams":
     return cls(
         num_features=params.Categorical([16, 32, 64, 128, 256]),
         num_layers=params.Integer(1, 5),
         **FullyConv1Resnet.ModelParams.search_default().__dict__,
     )
Exemplo n.º 7
0
    hp.exp.project_name = 'tablestakes'
    hp.exp.experiment_name = 'korv_which'
    hp.exp.experiment_tags = ['korv_which']
    hp.exp.sources_glob_str = constants.THIS_DIR.parent.parent / '**/*.py'
    hp.exp.offline_mode = False

    base_dim = 15
    hp.embed.dim = params.Discrete([
        base_dim + 16, base_dim + 32, base_dim + 64, base_dim + 128,
        base_dim + 256
    ])
    hp.embed.requires_grad = True
    hp.embed.position_embedding_requires_grad = False

    hp.conv.num_features = params.Discrete([32, 64, 128, 256])
    hp.conv.num_layers = params.Integer(min_value=1, max_value=3)
    hp.conv.kernel_size = 3
    hp.conv.num_groups = params.Discrete([16, 32, 64])
    hp.conv.num_blocks_per_pool = 20
    hp.conv.requires_grad = True

    hp.trans.impl = 'fast-favor'
    # neck_hp.trans.impl = 'fast'
    hp.trans.num_heads = params.Discrete([2, 4, 8, 16])
    hp.trans.num_layers = params.Integer(min_value=1, max_value=3)
    hp.trans.num_query_features = None
    hp.trans.fc_dim_mult = params.Integer(min_value=2, max_value=5)
    hp.trans.p_dropout = params.Float(min_value=0.05, max_value=0.2)
    hp.trans.p_attention_dropout = params.Float(min_value=0.05, max_value=0.2)

    hp.fc.num_features = params.Discrete([32, 64, 128, 256])