Example #1
0
 def configs() -> Configs:
     c = Configs()
     c.add(
         name="target_gflops",
         type=float,
         default=2.0,
         strategy="constant",
         description="Target (Giga) Floating Point Operations per Second.",
     )
     return c
Example #2
0
 def configs():
     c = Configs()
     c.add(
         name="hidden_dim",
         type=int,
         default=128,
         strategy="choice",
         choices=[128, 256, 512, 1024],
         description="Number of hiden units.",
     )
     return c
 def configs() -> Configs:
     c = Configs()
     c.add(
         name="extract_features_after_layer",
         default="",
         type=str,
         description=(
             "Layer name after which to extract features. "
             "Nested layers may be selected using dot-notation, "
             "e.g. `block.subblock.layer1`"
         ),
     )
     return c
Example #4
0
 def configs() -> Configs:
     c = Configs()
     c.add(
         name="learning_rate",
         type=float,
         default=0.001,
         choices=(5e-7, 5e-1),
         strategy="loguniform",
         description="Learning rate.",
     )
     c.add(
         name="optimizer_beta1",
         type=float,
         default=0.9,
         choices=(0, 0.999),
         strategy="uniform",
         description="Beta 1.",
     )
     c.add(
         name="optimizer_beta2",
         type=float,
         default=0.999,
         choices=(0, 0.99999),
         strategy="uniform",
         description="Beta 2.",
     )
     c.add(
         name="weight_decay",
         type=float,
         default=1e-2,
         choices=(1e-6, 1e-1),
         strategy="loguniform",
         description="Weight decay.",
     )
     return c
Example #5
0
 def configs() -> Configs:
     c = Configs()
     c.add(
         name="metric_selection",
         default=default_config,
         type=str,
         strategy="constant",
         description="Selection key for MetricSelector.",
         choices=list(mapping.keys()),
     )
     for Metric in metric_set:
         if hasattr(Metric, "configs"):
             c += Metric.configs()
     return c
Example #6
0
 def configs() -> Configs:
     c = Configs()
     c.add(
         name="optimization_metric",
         default="loss",
         type=str,
         choices=MetricMixin.metric_names(),
         description=
         "Name of the performance metric that should be optimized",
     )
     c.add(
         name="test_ensemble",
         type=int,
         default=0,
         strategy="constant",
         description=
         "Flag indicating whether the test dataset should yield a clip ensemble.",
     )
     c.add(
         name="gpus",
         type=str,
         default=None,
         strategy="constant",
         description=
         "Which gpus should be used. Can be either the number of gpus (e.g. '2') or a list of gpus (e.g. ('0,1').",
     )
     c.add(
         name="loss",
         type=str,
         default="cross_entropy",
         choices=loss_names,
         strategy="constant",
         description="Loss function used during optimisation.",
     )
     return c
Example #7
0
 def configs(self) -> Configs:
     c = Configs()
     c.add(
         name="trials",
         default=30,
         type=int,
         description="Number of trials in the hyperparameter search",
     )
     c.add(
         name="gpus_per_trial",
         default=0,
         type=int,
         description="Number of GPUs per trail in the hyperparameter search",
     )
     c.add(
         name="optimization_metric",
         default="loss",
         type=str,
         choices=self.Module.metric_names(),
         description="Name of the performance metric that should be optimized",
     )
     c.add(
         name="from_hparam_space_file",
         default=None,
         type=str,
         description="Path to file with specification for the search space during hyper-parameter optimisation",
     )
     return c
Example #8
0
 def configs() -> Configs:
     c = Configs()
     c.add(
         name="learning_rate",
         type=float,
         default=0.1,
         choices=(5e-2, 5e-1),
         strategy="loguniform",
         description="Learning rate.",
     )
     c.add(
         name="weight_decay",
         type=float,
         default=1e-5,
         choices=(1e-6, 1e-3),
         strategy="loguniform",
         description="Weight decay.",
     )
     c.add(
         name="momentum",
         type=float,
         default=0.9,
         choices=(0, 0.999),
         strategy="uniform",
         description="Momentum.",
     )
     return c
Example #9
0
    def configs() -> Configs:
        c = Configs()

        c.add(
            name="unfreeze_from_epoch",
            type=int,
            default=-1,
            description=
            "Number of epochs to wait before starting gradual unfreeze. If -1, unfreeze is omitted.",
        )
        c.add(
            name="unfreeze_layers_must_include",
            type=str,
            default="",
            description=
            "String that must be contained in layer names which should be unfrozen. If empty, this feature is disabled.",
        )
        c.add(
            name="unfreeze_epoch_step",
            type=int,
            default=1,
            description="Number of epochs to train before next unfreeze.",
        )
        c.add(
            name="unfreeze_layers_initial",
            type=int,
            default=1,
            strategy="choice",
            description=
            "Number layers to unfreeze initially. If `-1`, it will be equal to total_layers",
        )
        c.add(
            name="unfreeze_layer_step",
            type=int,
            default=1,
            description=
            "Number additional layers to unfreeze at each unfreeze step. If `-1`, all layers are unfrozon after a step",
        )
        c.add(
            name="unfreeze_layers_max",
            type=int,
            default=-1,
            description=
            "Maximum number of layers to unfreeze. If `-1`, it will be equal to total_layers",
        )
        return c