GithubHelp home page GithubHelp logo

Comments (9)

peterjc123 avatar peterjc123 commented on July 24, 2024
        transpose_13_f = fake_dequant_inner_81_0_0.transpose(1, 2)
        backbone_encoders_0_dropout_2 = self.backbone_encoders_0_dropout(transpose_13_f)
        add_4_f = add_3_f.__add__(backbone_encoders_0_dropout_2)
        backbone_encoders_0_norm_ff = self.backbone_encoders_0_norm_ff(add_4_f)
        backbone_encoders_0_feed_forward_w_1 = self.backbone_encoders_0_feed_forward_w_1(backbone_encoders_0_norm_ff)
  (fake_dequant_inner_81_0_0): DeQuantStub()
  (backbone_encoders_0_norm_ff): LayerNorm((128,), eps=1e-05, elementwise_affine=True)
  (backbone_encoders_0_feed_forward_w_1): LinearReLU(
    (0): Linear(in_features=128, out_features=128, bias=True)
    (1): ReLU()
    (activation_post_process): HistogramObserver(min_val=0.0, max_val=1.3926540613174438)
  )

It seems that we should not fuse backbone_encoders_0_feed_forward_w_1 and ReLU here since they are not quantized.

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on July 24, 2024

Looking into it further, it seems that backbone_encoders_0_feed_forward_activation is reused so that it fails in the is_quantized_analysis pass.

from tinyneuralnetwork.

Juelianqvq avatar Juelianqvq commented on July 24, 2024

is_quantized_analysis

So the easiest way is to rename ReLU op with different names?

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on July 24, 2024

@Juelianqvq It seems that #301 is enough to fix it, though we should probably duplicate those ops in the future.

from tinyneuralnetwork.

Juelianqvq avatar Juelianqvq commented on July 24, 2024

@Juelianqvq It seems that #301 is enough to fix it, though we should probably duplicate those ops in the future.

@peterjc123 Thanks for fixing this :)

from tinyneuralnetwork.

Juelianqvq avatar Juelianqvq commented on July 24, 2024

FYI, though conversion succeed but the accuracy is still 0, unless I insert dq+q around relu op, which means "qlinear+float relu",the accuracy behaves normal.

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on July 24, 2024

@Juelianqvq Let me check how is LinearReLU implemented in PyTorch.

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on July 24, 2024

@Juelianqvq It seems that after model fusing, the original modules involved will be replaced by nn.Identity. That's why there's so few ReLUs in the target TFLite model. So it seems we still need to duplicate those activation ops.

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on July 24, 2024

Let's continue the discussion in #308.

from tinyneuralnetwork.

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.