Skip to content

quantization recipe should mimic checkpointer.save_checkpoint  #2229

Open
@felipemello1

Description

This is where the quantize.py saves the quantized model:

def save_checkpoint(self, cfg: DictConfig):

It looks like this:

    def save_checkpoint(self, cfg: DictConfig):
        ckpt_dict = self._model.state_dict()
        file_name = cfg.checkpointer.checkpoint_files[0].split(".")[0]

        output_dir = Path(cfg.checkpointer.output_dir)
        output_dir.mkdir(exist_ok=True)
        checkpoint_file = Path.joinpath(
            output_dir, f"{file_name}-{self._quantization_mode}".rstrip("-qat")
        ).with_suffix(".pt")

        torch.save(ckpt_dict, checkpoint_file)

This means that even if the input are multiple .safetensors files, it will save a single .pt file, making it not too attractive.

Metadata

Assignees

No one assigned

    Labels

    better engineeringTasks which help improve eng productivity e.g. building tools, cleaning up code, writing docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions