Esempio n. 1
0
def get_random_object() -> str:
    return randomname.get_name(sep=' ')
Esempio n. 2
0
 def default_unique_experiment_name(cls, v, values):  # noqa: D102, N805
     return v or values["experiment_name"] + "_" + randomname.get_name()
Esempio n. 3
0
def test_get_name():
    name = randomname.get_name('music_theory', 'cats').split('-', 1)
    assert len(name) > 1
    assert name[0] in randomname.util.get_groups_list('a/music_theory')
    assert name[1] in randomname.util.get_groups_list('n/cats')
    assert 'asdf' in randomname.util.get_groups_list(['n/cats', 'asdf'])
Esempio n. 4
0
            options = [line.rstrip() for line in f]
    else:
        options = [env_option]
    return [_get_env_variable(option) for option in options]


def _parse_env_options(env_options):
    return dict(
        [j for i in [_get_env_variables(k) for k in env_options] for j in i])


@cli.command(help="Stages and starts a Mendix application.")
@click.option(
    "-n",
    "--name",
    default=randomname.get_name(),
    help="Sets the name of the application.",
)
@click.option(
    "-p",
    "--password",
    help="Sets the adminstrator password for the application.",
)
@click.option(
    "-e",
    "--env",
    multiple=True,
    help=
    "Sets an environment variable (KEY=VALUE) for the application. Providing a file with environment variables and multiple options are allowed.",
)
@click.option(
from config import config
from loader import GenreDataLoader
from networks import GenreAutoencoder, GenreDecoder

bert_config_name = "prajjwal1/bert-mini"

BATCH_SIZE = 64
bert_config = BertConfig.from_pretrained(bert_config_name)
PATH = f"genre_autoencoder-{bert_config.hidden_size}"
lp_path = os.path.join(config.get("learning_progress_path"), PATH)

TRAIN_STEPS = int(1e5)

if __name__ == "__main__":
    run_name = randomname.get_name()
    model_dump_path = os.path.join(lp_path, "model", run_name)
    Path(model_dump_path).mkdir(parents=True, exist_ok=True)

    data_loader = GenreDataLoader(
        batch_size=BATCH_SIZE,
        meta_data_path="data/album_data_frame.json",
        tokenizer_path=bert_config_name,
    )
    num_labels = data_loader.get_number_of_classes()
    vocab_size = len(data_loader.tokenizer.get_vocab())

    encoder = BertForMaskedLM.from_pretrained(bert_config_name)
    encoder.bert = BertModel.from_pretrained(bert_config_name,
                                             add_pooling_layer=True)
    decoder = GenreDecoder(input_dim=bert_config.hidden_size,