Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Fixed: ckpt path is checked even if path is none
Browse files Browse the repository at this point in the history
  • Loading branch information
noaahh committed Jun 4, 2024
1 parent 5ca6b4e commit b2b8146
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def create_tokenizer(model_name: str):


def create_model(model_name: str, freeze_base: bool, ckpt_path: str = None):
if not os.path.exists(ckpt_path):
raise FileNotFoundError(f"Checkpoint file not found at {ckpt_path}")

if ckpt_path:
if os.path.exists(ckpt_path):
raise FileNotFoundError(f"Checkpoint file not found at {ckpt_path}")

model = AutoModelForSequenceClassification.from_pretrained(ckpt_path).to(get_torch_device())
else:
model = AutoModelForSequenceClassification.from_pretrained(model_name,
Expand Down

0 comments on commit b2b8146

Please sign in to comment.