Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quantization recipe should mimic checkpointer.save_checkpoint #2229

Open
felipemello1 opened this issue Jan 4, 2025 · 1 comment
Open

quantization recipe should mimic checkpointer.save_checkpoint #2229

felipemello1 opened this issue Jan 4, 2025 · 1 comment
Labels
better engineering Tasks which help improve eng productivity e.g. building tools, cleaning up code, writing docs

Comments

@felipemello1
Copy link
Contributor

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.

@felipemello1 felipemello1 added the better engineering Tasks which help improve eng productivity e.g. building tools, cleaning up code, writing docs label Jan 4, 2025
@Ankur-singh
Copy link
Contributor

Can you please describe the desired/better approach in more detail? Do you want the save_checkpoint method to save checkpoint in multiple formats; or based on input format; or ask user?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
better engineering Tasks which help improve eng productivity e.g. building tools, cleaning up code, writing docs
Projects
None yet
Development

No branches or pull requests

2 participants