def test_model2download(self): model2link = model2download(DATA_PATH) self.assertTrue(os.path.exists(DATA_PATH + "public-models.yaml")) # Double call should overwrite file. model2link = model2download(DATA_PATH) self.assertIsInstance(model2link, dict) os.remove(DATA_PATH + "public-models.yaml")
click.secho("COMET system score: {}.".format(sum(scores) / len(scores)), fg="yellow") @comet.command() @click.option( "--data", "-d", type=click.Choice(corpus2download.keys(), case_sensitive=False), multiple=True, help="Public corpora to download.", ) @click.option( "--model", "-m", type=click.Choice(model2download().keys(), case_sensitive=False), multiple=True, help="Pretrained models to download.", ) @click.option( "--saving_path", type=str, help="Relative path to save the downloaded files.", required=True, ) def download(data, model, saving_path): for d in data: download_corpus(d, saving_path) for m in model: download_model(m, saving_path)
def test_model2download_bad_saving_dir(self): self.assertRaises( FileNotFoundError, lambda: model2download("folder/that/does/not/exist/"))