Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

[Enhancement] One script to export bert for classification/regression/QA #705

Merged
merged 12 commits into from
May 18, 2019

Conversation

eric-haibin-lin
Copy link
Member

@eric-haibin-lin eric-haibin-lin commented May 14, 2019

Description

This PR unifies static_export_squad.py and static_export_base.py by introducing a "task" argument to export.py. Currently it supports: classification, regression and question_answering.

The PR also renames the StaticXXX classes to HybridXXX classes, in case we change the implementation with control flow operators to support variable length inputs in the future.

Checklist

Essentials

  • PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL], [FEATURE], [DOC], etc)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage
  • Code is well-documented

Changes

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@eric-haibin-lin eric-haibin-lin requested a review from szha as a code owner May 14, 2019 06:40
@codecov
Copy link

codecov bot commented May 14, 2019

Codecov Report

❗ No coverage uploaded for pull request head (export@7815a53). Click here to learn what that means.
The diff coverage is n/a.

@codecov
Copy link

codecov bot commented May 14, 2019

Codecov Report

Merging #705 into master will increase coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #705      +/-   ##
=========================================
+ Coverage   89.23%   89.3%   +0.06%     
=========================================
  Files          65      65              
  Lines        5953    5991      +38     
=========================================
+ Hits         5312    5350      +38     
  Misses        641     641
Impacted Files Coverage Δ
src/gluonnlp/data/sentiment.py 98.29% <0%> (+0.82%) ⬆️

@mli
Copy link
Member

mli commented May 14, 2019

Job PR-705/1 is complete.
Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-705/1/index.html

@eric-haibin-lin eric-haibin-lin changed the title [WIP] Export bert for classification [Enhancement] One script to export bert for classification/regression/QA May 14, 2019
@eric-haibin-lin eric-haibin-lin requested a review from TaoLv May 14, 2019 22:37
@mli
Copy link
Member

mli commented May 14, 2019

Job PR-705/2 is complete.
Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-705/2/index.html

@mli
Copy link
Member

mli commented May 14, 2019

Job PR-705/3 is complete.
Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-705/3/index.html

@mli
Copy link
Member

mli commented May 15, 2019

Job PR-705/4 is complete.
Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-705/4/index.html

@mli
Copy link
Member

mli commented May 15, 2019

Job PR-705/5 is complete.
Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-705/5/index.html

@eric-haibin-lin eric-haibin-lin requested a review from gigasquid May 15, 2019 03:49
@mli
Copy link
Member

mli commented May 15, 2019

Job PR-705/6 is complete.
Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-705/6/index.html

@mli
Copy link
Member

mli commented May 15, 2019

Job PR-705/7 is complete.
Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-705/7/index.html

@TaoLv
Copy link
Member

TaoLv commented May 15, 2019

Thank you for the contribution. I will have a try!

@mli
Copy link
Member

mli commented May 16, 2019

Job PR-705/8 is complete.
Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-705/8/index.html

@mli
Copy link
Member

mli commented May 16, 2019

Job PR-705/9 is complete.
Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-705/9/index.html

@eric-haibin-lin eric-haibin-lin requested review from fierceX and vanewu May 16, 2019 01:21
@xinyu-intel
Copy link
Member

@eric-haibin-lin How to run classification model inference?

@gigasquid
Copy link
Contributor

Thanks @eric-haibin-lin ! I'll help test the export base script.

Copy link
Member

@xinyu-intel xinyu-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max_length config

scripts/bert/index.rst Outdated Show resolved Hide resolved
Copy link
Member

@TaoLv TaoLv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the great effort, @eric-haibin-lin . It looks good to me. Now approved!

@mli
Copy link
Member

mli commented May 17, 2019

Job PR-705/10 is complete.
Docs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR-705/10/index.html

Copy link
Member

@xinyu-intel xinyu-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! HybridBert works well with both gluon and symbolic forward:)

@eric-haibin-lin eric-haibin-lin merged commit db8ae21 into dmlc:master May 18, 2019
@szha szha mentioned this pull request May 18, 2019
@eric-haibin-lin eric-haibin-lin deleted the export branch May 22, 2019 16:58
paperplanet pushed a commit to paperplanet/gluon-nlp that referenced this pull request Jun 9, 2019
…/QA (dmlc#705)

* rename folder

* rename folder

* draft for export

* suppport qa,regression, classification

* add readme and tasks

* fix lint

* fix unit test

* fix test

* remove test_bert_static_base_export

* address comments

* update default seq len
@harplife
Copy link

Hi, is there any guide on how to use the export script? I would like to export a fine-tuned Bert model.

The code I'm using to train the model is this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants