Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jack89roberts committed Aug 7, 2024
1 parent 5792e4d commit dd6fd3d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/arcsf/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@ def load_maybe_peft_model(
model = AutoPeftModelForCausalLM.from_pretrained(
model_path_or_id, **model_kwargs, torch_dtype="auto"
)
logger.info("Loaded PEFT model")
if merge:
logger.info("Merging PEFT adapters")
model = model.merge_and_unload()
except ValueError as err:
if "Can't find 'adapter_config.json'" not in str(err):
raise err
model = AutoModelForCausalLM.from_pretrained(
model_path_or_id, **model_kwargs, torch_dtype="auto"
)
logger.info("Loaded model normally without PEFT")

return model


Expand Down Expand Up @@ -76,7 +80,7 @@ def load_model_and_tokenizer(
# Optionally add padding token
if tokenizer.pad_token is None:
if add_padding_token:
logger.info("Adding pad token tok tokenizer and model.")
logger.info("Adding pad token to tokenizer and model.")
tokenizer.add_special_tokens({"pad_token": "<|padding|>"})
add_token_to_model = True
else:
Expand Down

0 comments on commit dd6fd3d

Please sign in to comment.