Skip to content

Commit

Permalink
Write the current version into model configs (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoin authored Sep 24, 2024
1 parent 799be8d commit 52afd24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/compressed_tensors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
from .config import *
from .quantization import QuantizationConfig, QuantizationStatus
from .utils import *
from .version import *
2 changes: 2 additions & 0 deletions src/compressed_tensors/compressors/model_compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import torch
import transformers
import compressed_tensors
from compressed_tensors.base import (
COMPRESSION_CONFIG_NAME,
QUANTIZATION_CONFIG_NAME,
Expand Down Expand Up @@ -368,6 +369,7 @@ def update_config(self, save_directory: str):
config_data[COMPRESSION_CONFIG_NAME][
SPARSITY_CONFIG_NAME
] = sparsity_config_data
config_data[COMPRESSION_CONFIG_NAME]["version"] = compressed_tensors.__version__

with open(config_file_path, "w") as config_file:
json.dump(config_data, config_file, indent=2, sort_keys=True)
Expand Down

0 comments on commit 52afd24

Please sign in to comment.