Giter Club home page Giter Club logo

Comments (6)

mobicham avatar mobicham commented on June 3, 2024 3

It needs some major refactoring on the hqq lib side to support serialization with transformers.This is because it's not possible to store the meta-data directly as a safetensor. Since hqq supports different backends and various settings, that meta-data becomes cumbersome. Currently, I am trying to simplify things to make the refactoring easier. For the moment, you can use the approach shared above:

@mxjmtxrm save/load was initially included in the pull request, but we decided to remove it because the logic was too different from the rest of the transformers models. For the moment, you can do something like this:

from hqq.models.hf.base import AutoHQQHFModel

#Save
AutoHQQHFModel.save_quantized(model, save_path)

#Load
AutoHQQHFModel.from_quantized(save_path)

from transformers.

mxjmtxrm avatar mxjmtxrm commented on June 3, 2024 1

Got it. Thanks.

from transformers.

SunMarc avatar SunMarc commented on June 3, 2024

Hi @mxjmtxrm, this is indeed the case. You cannot serialize the model when using transformers integration because the serialization logic was not compatible with transformers code. However, you can use directly the hqq library if you want to save and relaod a quantized model https://github.com/mobiusml/hqq cc @mobicham

from transformers.

mobicham avatar mobicham commented on June 3, 2024

@mxjmtxrm save/load was initially included in the pull request, but we decided to remove it because the logic was too different from the rest of the transformers models. For the moment, you can do something like this:

from hqq.models.hf.base import AutoHQQHFModel

#Save
AutoHQQHFModel.save_quantized(model, save_path)

#Load
AutoHQQHFModel.from_quantized(save_path)

from transformers.

mxjmtxrm avatar mxjmtxrm commented on June 3, 2024

I'm wondering that is_serializable is True in AWQ/EETQ and other quantizers except HQQ. If it can be set True directly in HQQ quantizer?

AWQ quantizer:

@property
    def is_serializable(self):
        # AWQ through auto-awq has been always serializable, except if the model is fused.
        if self.quantization_config.do_fuse:
            logger.warning("You cannot save an AWQ model that uses fused modules!")
            return False

        if self.quantization_config.version == AWQLinearVersion.EXLLAMA:
            logger.warning("You cannot save an AWQ model that uses Exllama backend!")
            return False

        return True

from transformers.

SunMarc avatar SunMarc commented on June 3, 2024

We set it to True when it is indeed possible to save the model with transformers logic. with EETQ and AWQ, they can indeed be serialized but this is not the case for HQQ. Hence we set it to False.

from transformers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.