NervanaSystems / neon

Intel® Nervana™ reference deep learning framework committed to best performance on all hardware
http://neon.nervanasys.com/docs/latest
Apache License 2.0
3.87k stars 811 forks source link

Fix regexp left brack escape for Perl 5.26 #397

Closed jamilbk closed 6 years ago

jamilbk commented 7 years ago

This fixes an issue in Perl >= 5.26 where braces in regular expressions must be escaped.

https://rt.perl.org/Public/Bug/Display.html?id=130497

I ran into this while running the example command in the README.md:

python examples/mnist_mkl.py -b gpu

baojun-nervana commented 6 years ago

It seems I cannot reproduce the error

(.venv2) [baojunli@nervana-titanxp05 private-neon]$ perl -v

This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux (with 1 registered patch, see perl -V for more detail)

Copyright 1987-2017, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.

(.venv2) [baojunli@nervana-titanxp05 private-neon]$ python examples/mnist_mlp.py -b gpu Epoch 0 [Train |████████████████████| 469/469 batches, 0.28 cost, 1.04s] Epoch 1 [Train |████████████████████| 469/469 batches, 0.22 cost, 1.06s] Epoch 2 [Train |████████████████████| 469/469 batches, 0.19 cost, 1.06s] Epoch 3 [Train |████████████████████| 468/468 batches, 0.16 cost, 1.05s] Epoch 4 [Train |████████████████████| 468/468 batches, 0.15 cost, 1.05s] Epoch 5 [Train |████████████████████| 468/468 batches, 0.13 cost, 1.05s] Epoch 6 [Train |████████████████████| 468/468 batches, 0.12 cost, 1.05s] Epoch 7 [Train |████████████████████| 468/468 batches, 0.11 cost, 1.05s] Epoch 8 [Train |████████████████████| 468/468 batches, 0.10 cost, 1.06s] Epoch 9 [Train |████████████████████| 468/468 batches, 0.09 cost, 1.05s] 2017-11-17 14:50:09,167 - neon - DISPLAY - Misclassification error = 2.5%

wei-v-wang commented 6 years ago

Hi @jamilbk Please see above comments from @baojun-nervana

Were you using a very new Perl version? As of now, we cannot reproduce the error with Perl 5.26.

jamilbk commented 6 years ago

Hmm that's strange. The example I originally ran, examples/mnist_mkl.py, is missing from the source tree and not present in the git history either.

I can verify that python examples/mnist_mlp.py (and many other examples) successfully trains on all my systems with perl 5.26.1 with and without the -b gpu switch or -b mkl switch, but I don't think neon/backends/kernels/maxas/MaxAs/MaxAsGrammar.pm is being hit anymore with the stuff in examples/.

Is the maxas library still being used? I'm not sure this MR matters any more if not.

And thanks for checking into this :)

wei-v-wang commented 6 years ago

Ah that makes sense @jamilbk I should have asked about "mnist_mkl.py", I thought it was "mnist_mlp.py". Closing this PR now, thank you for your efforts @jamilbk @baojun-nervana