Giter Site home page Giter Site logo

Comments (7)

yuanzexi avatar yuanzexi commented on April 29, 2024

Bert-Pytorch demo is updated here. https://github.com/Tencent/Forward/tree/master/demo/bert

from forward.

Fan9 avatar Fan9 commented on April 29, 2024

@yuanzexi Bug when running test_torch_bert.py("bert-base-uncased" downloaded from https://huggingface.co/bert-base-cased),There are three errors messages.

 [ERROR] 2021-04-08 16:22:09,532 trt_logger.cpp(64): [TRT] 29 [Cast]: could not find any supported formats consistent with input/output data types
[ERROR] 2021-04-08 16:22:09,533 trt_logger.cpp(64): [TRT] ../builder/cudnnBuilderGraphNodes.cpp (872) - Misc Error in reportPluginError: 0 (could not find any supported formats consistent with input/output data types)
 [ERROR] 2021-04-08 16:22:09,550 trt_logger.cpp(64): [TRT] ../builder/cudnnBuilderGraphNodes.cpp (872) - Misc Error in reportPluginError: 0 (could not find any supported formats consistent with input/output data types)
 [ERROR] 2021-04-08 16:22:09,550 trt_fwd_builder.cpp(121): buildEngineWithConfig error
[ERROR] 2021-04-08 16:52:12,292 torch_engine.cpp(219): Build forward engine failed
Traceback (most recent call last):
  File "test_torch_bert.py", line 42, in <module>
    TestForward(jit_path)
  File "test_torch_bert.py", line 29, in TestForward
    engine.save(engine_path)
AttributeError: 'NoneType' object has no attribute 'save'

Environment

TensorRT Version: 7.2.1.6
NVIDIA GPU: GTX1080TI
NVIDIA Driver Version: 450.80.02
CUDA Version: 11.0
CUDNN Version: 8.0.4
Operating System: centos 7.5
Python Version (if applicable): 3.6.13
PyTorch Version (if applicable): 1.7.1
transformers: 4.0.0

from forward.

yuanzexi avatar yuanzexi commented on April 29, 2024

Torch BERT models are only supported for Torch 1.3.1 API. Because BERT models exported by Torch 1.7.1 are different from that exported by Torch 1.3.1. You could use the demo on Torch 1.3.1. Thanks for your feedback. We will update soon for supporting Torch 1.7.1 BERT.

from forward.

yuanzexi avatar yuanzexi commented on April 29, 2024

@Fan9 The problem has been resolved in the newest master branch. You could try it again.

from forward.

Fan9 avatar Fan9 commented on April 29, 2024

I have successfully run BERT-Torch on torch=1.3.1 and torch=1.7.1 . Thanks for your help. Nice work!

from forward.

Fan9 avatar Fan9 commented on April 29, 2024

hi, @yuanzexi ,Have you tested the efficiency improvement of tensort? In my experiment, the speed of bert-trt is greatly affected by the parameters of batch_size and max_length. In my code, builder.set_mode('float32'), bert-model:=BertForSequenceClassification

  • batch_size=1, max_length=52, Bert-trt is three times faster than Bert-pytorch.
  • batch_size=1, max_length=108, double times faster.
  • batch_size=32, max_length=52/108,it takes the same time as Bert-pytorch.

Is there any problem here?

Environment

TensorRT Version: 7.2.1.6
NVIDIA GPU: GTX1080TI
NVIDIA Driver Version: 450.80.02
CUDA Version: 11.0
CUDNN Version: 8.0.4
Operating System: centos 7.5
Python Version (if applicable): 3.6.13
PyTorch Version (if applicable): 1.7.1
transformers: 4.0.0

from forward.

yuanzexi avatar yuanzexi commented on April 29, 2024

@Fan9 Thanks for your feedback. We had tested the performance of models in tensorrt, but we didn't try these configuration and environments. We'll try to profile this BERT model to figure out this problem.

from forward.

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.