Using hyperparameter-search in Trainer

How do you pass parameters to the model_init function? I have two parameters that need to be set in this function so I have defined it as so:

    def get_model(params):
        db_config = db_config_base
        db_config.update({'alpha': params['alpha_val'], 'dropout': params['dropout_val']})
        return DistilBERTForMultipleSequenceClassification.from_pretrained(db_config, num_labels1 = 2, num_labels2 = 8)

I thought maybe ray-tune would pass the parameters of the specific instance to this function but instead I get this error:

TypeError: ‘NoneType’ object is not subscriptable

AKA ‘params’ is None

1 Like