Skip to content

Commit

Permalink
Merge branch 'sa/fix_quantize_logging' of github.com:neuralmagic/spar…
Browse files Browse the repository at this point in the history
…seml into sa/fix_quantize_logging
  • Loading branch information
Sara Adkins committed May 30, 2024
2 parents a354a10 + 4a32556 commit d768716
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sparseml/transformers/sparsification/sparse_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ def skip(*args, **kwargs):
model = super(AutoModelForCausalLM, cls).from_pretrained(
pretrained_model_name_or_path, *model_args, **kwargs
)
if model.dtype != model.config.torch_dtype:
_LOGGER.warning(
f"The dtype of the loaded model: {model.dtype} is different "
"from from the dtype specified in the model config: "
f"{model.config.torch_dtype}."
"To load the model in the format that it was previously saved in, "
"set torch_dtype=`auto` in the SparseAutoModel creation call."
)
logger.setLevel(level=restore_log_level)
# override the PreTrainedModel instance with compression save function
modify_save_pretrained(model)
Expand Down

0 comments on commit d768716

Please sign in to comment.