Coder Social home page Coder Social logo

bibert's Issues

How to get obtain the size (MB) of the BERT

image

Dear authors,

Great thanks for the opensource code. I wonder how you calculate the size of the models?
Actually, I have a very fundamental question the BERT-base model (fp32) is
embedding_param = 23835648
num_param = 85526016
(embedding_param + num_param) / 1e6 * 4 =437.4MB

instead of 418MB?

for n, p in model.items():
    if 'Norm' in n:
        continue
    if len(p.size()) ==2 :
        if 'embedding' in n:
            embedding_param += p.numel()
        else:
            num_param += p.numel()

It would be great if you can clarify this. (similar repohttps://github.com/huawei-noah/Pretrained-Language-Model/issues/184)

Question about the implementation of binary modules

Hi Haotong,
Thanks for your excellent work! However, I am curious why the weights have scaling_factors while the activations don't in modules like QuantizeLinear ( in modeling_quant.py). Previous work like IR-NET has the same implementation.
Also, none of the operands calculates the scaling factor for matrix multiplication in the Attention module (such as attn@value). Why?

Looking forward to your reply!

The question about Bi-Attention

Thanks for sharing the source code. I have a question about Bi-Attention structure.
When calculating the attention score * value, you binarize the attention score to 0 or 1 in the source code. In the paper, I noticed that you proposed a new bitwise operation to support computation between the binarized attention weight bool(A) and the binarized value during inference. But in the source code, I didn't find this part of the code.
Are the attention scores in the training and testing phases in the source code binarized to 0 and 1?

Code release

Hi, haotong, it is nice to see such a great work.

I am trying to re-implement BIBert with the code provided in the ICLR 2022 supplementary materials. I used the suggested DynaBert as teahcer model, and I gained the same teacher accuracy (32-bit baseline acc). However, I could not gain the same performance on GLUE with this code. For example, the acc is only 0.13/0.08 for STS-B, 0.833 for SST-2, which is far lower than the acc reported in table 2.

May you help me with this issue? Does the provided code in supplementary materials is already sufficient for re-implementation? Or does the acc-mismatch problem come from wrong hyper-parameter setting (I did not modify the code and I use the suggested dybnabert as teacher and pretrained model)?

Many Thanks!

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.