From f42816e7fca8280927790f74c6e280c37d49b280 Mon Sep 17 00:00:00 2001 From: w4nderlust Date: Fri, 29 Nov 2019 20:00:43 -0800 Subject: [PATCH] Added additional check for url and path in discriminator model params --- examples/run_pplm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/run_pplm.py b/examples/run_pplm.py index 8516454f86..9ddd42681e 100644 --- a/examples/run_pplm.py +++ b/examples/run_pplm.py @@ -317,8 +317,11 @@ def get_classifier( ).to(device) if "url" in params: resolved_archive_file = cached_path(params["url"]) - else: + elif "path" in params: resolved_archive_file = params["path"] + else: + raise ValueError("Either url or path have to be specified " + "in the discriminator model parameters") classifier.load_state_dict( torch.load(resolved_archive_file, map_location=device)) classifier.eval()