gluon-nlp icon indicating copy to clipboard operation
gluon-nlp copied to clipboard

Cython

Open leezu opened this issue 7 years ago • 6 comments

Description

This PR converts the functionality of GluonNLP that previously supported optional numba JIT to Cython.

Checklist

Essentials

  • [ ] Changes are complete (i.e. I finished coding on this PR)
  • [X] All changes have test coverage
  • [X] Code is well-documented

Changes

  • [X] Replace numba with Cython

Comments

  • This removes the runtime dependency on numba to a compile time dependency cython. While numba was formally optional, the execution speed without numba was unusable for the optimized code paths.
  • Thanks to Cython language_level=3str, the .pyx can be written using Python 3 syntax and features, with Cython taking care of the bindings to Py2

TODO

  • [x] Sphinx documentation https://opendreamkit.org/2017/06/09/CythonSphinx/
  • [x] Code coverage https://github.com/pytest-dev/pytest-cov/issues/163 https://cython.readthedocs.io/en/latest/src/tutorial/profiling_tutorial.html https://github.com/cython/cython/issues/1461

leezu avatar Nov 06 '18 11:11 leezu

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

mli avatar Nov 08 '18 12:11 mli

Codecov Report

Merging #389 into master will increase coverage by 18.1%. The diff coverage is 46.51%.

@@            Coverage Diff             @@
##           master     #389      +/-   ##
==========================================
+ Coverage   64.37%   82.48%   +18.1%     
==========================================
  Files          84       85       +1     
  Lines        7160     7198      +38     
==========================================
+ Hits         4609     5937    +1328     
+ Misses       2551     1261    -1290
Flag Coverage Δ
#PR389 82.48% <46.51%> (?)
#master ?
#notserial 56.8% <31.25%> (?)
#py2 82.15% <46.51%> (+18.07%) :arrow_up:
#py3 82.32% <44.18%> (+18.13%) :arrow_up:
#serial 63.8% <44.18%> (?)

codecov[bot] avatar Nov 08 '18 12:11 codecov[bot]

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

mli avatar Nov 08 '18 13:11 mli

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

mli avatar Nov 08 '18 13:11 mli

@szha FYI, after the split in serial / non-serial test execution, only the code coverage of serial tests was uploaded. Fixed by 527b23d

leezu avatar Nov 08 '18 14:11 leezu

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

mli avatar Nov 09 '18 11:11 mli