Skip to content

Commit

Permalink
Bugfix for simple_run() multiple models with the same type. (#1349)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDettmers authored Mar 31, 2022
1 parent 127e021 commit f9e0e7c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions jiant/proj/simple/runscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,12 @@ def run_simple(args: RunConfiguration, with_continue: bool = False):
)

# === Step 2: Download models === #
if not os.path.exists(os.path.join(model_cache_path, hf_config.model_type)):
if not os.path.exists(os.path.join(model_cache_path, args.hf_pretrained_model_name_or_path)):
print("Downloading model")
export_model.export_model(
hf_pretrained_model_name_or_path=args.hf_pretrained_model_name_or_path,
output_base_path=os.path.join(model_cache_path, hf_config.model_type),
#output_base_path=os.path.join(model_cache_path, hf_config.model_type),
output_base_path=os.path.join(model_cache_path, args.hf_pretrained_model_name_or_path),
)

# === Step 3: Tokenize and cache === #
Expand Down Expand Up @@ -197,7 +198,7 @@ def run_simple(args: RunConfiguration, with_continue: bool = False):
else:
model_load_mode = "from_transformers"
model_weights_path = os.path.join(
model_cache_path, hf_config.model_type, "model", "model.p"
model_cache_path, args.hf_pretrained_model_name_or_path, "model", "model.p"
)
run_output_dir = os.path.join(args.exp_dir, "runs", args.run_name)

Expand All @@ -219,7 +220,7 @@ def run_simple(args: RunConfiguration, with_continue: bool = False):
hf_pretrained_model_name_or_path=args.hf_pretrained_model_name_or_path,
model_path=model_weights_path,
model_config_path=os.path.join(
model_cache_path, hf_config.model_type, "model", "config.json",
model_cache_path, args.hf_pretrained_model_name_or_path, "model", "config.json",
),
model_load_mode=model_load_mode,
# === Running Setup === #
Expand Down

0 comments on commit f9e0e7c

Please sign in to comment.