dmlc / gluon-nlp

NLP made easy
https://nlp.gluon.ai/
Apache License 2.0
2.56k stars 538 forks source link

Cannot run text_generation sample script #1033

Open zeeshansayyed opened 4 years ago

zeeshansayyed commented 4 years ago

Description

I am trying text generation example with GTP2 as shown here:

I am using the latest dev version of gluon-nlp (a fresh git pull) Mxnet-version = mxnet-cu100==1.5.1.post0

The command I am using is python sequence_sampling.py random-sample --bos 'Deep learning and natural language processing' --beam-size 1 --lm-model gpt2_117m --max-length 1024 --print-num 1

Error Message

Namespace(beam_size=1, bos='alexa', command='random-sample', gpu=0, lm_model='gpt2_117m', max_length=1024, print_num=1, temperature=1.0, use_top_k=None)
Sampling Parameters: beam_size=1, temperature=1.0, use_top_k=None
Traceback (most recent call last):
  File "sequence_sampling.py", line 222, in <module>
    generate()
  File "sequence_sampling.py", line 202, in generate
    inputs, begin_states = get_initial_input_state(decoder, bos_ids)
  File "sequence_sampling.py", line 157, in get_initial_input_state
    mx.nd.array([bos_ids], dtype=np.int32, ctx=ctx), None
  File "/home/ec2-user/anaconda3/envs/devnlp/lib/python3.7/site-packages/mxnet/gluon/block.py", line 548, in __call__
    out = self.forward(*args)
  File "/home/ec2-user/anaconda3/envs/devnlp/lib/python3.7/site-packages/mxnet/gluon/block.py", line 925, in forward
    return self.hybrid_forward(ndarray, x, *args, **params)
  File "/home/ec2-user/projects/gluon-nlp/scripts/text_generation/model/gpt.py", line 275, in hybrid_forward
    data_pos = F.contrib.arange_like(data, axis=1).astype('int32')
AttributeError: module 'mxnet.ndarray.contrib' has no attribute 'arange_like'

Environment

----------Python Info----------
Version      : 3.7.5
Compiler     : GCC 7.3.0
Build        : ('default', 'Oct 25 2019 15:51:11')
Arch         : ('64bit', '')
------------Pip Info-----------
Version      : 19.3.1
Directory    : /home/ec2-user/anaconda3/envs/devnlp/lib/python3.7/site-packages/pip
----------MXNet Info-----------
Version      : 1.5.1
Directory    : /home/ec2-user/anaconda3/envs/devnlp/lib/python3.7/site-packages/mxnet
Num GPUs     : 1
Commit Hash   : c9818480680f84daa6e281a974ab263691302ba8
----------System Info----------
Platform     : Linux-4.14.146-93.123.amzn1.x86_64-x86_64-with-glibc2.10
system       : Linux
node         : ip-172-31-18-232
release      : 4.14.146-93.123.amzn1.x86_64
version      : #1 SMP Tue Sep 24 00:45:23 UTC 2019
----------Hardware Info----------
machine      : x86_64
processor    : x86_64
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    2
Core(s) per socket:    4
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 79
Model name:            Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
Stepping:              1
CPU MHz:               2701.607
CPU max MHz:           3000.0000
CPU min MHz:           1200.0000
BogoMIPS:              4600.12
Hypervisor vendor:     Xen
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              46080K
NUMA node0 CPU(s):     0-7
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx xsaveopt
----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0024 sec, LOAD: 0.8949 sec.
Timing for GluonNLP GitHub: https://github.com/dmlc/gluon-nlp, DNS: 0.0004 sec, LOAD: 0.7312 sec.
Timing for GluonNLP: http://gluon-nlp.mxnet.io, DNS: 0.0821 sec, LOAD: 0.2978 sec.
Timing for D2L: http://d2l.ai, DNS: 0.0134 sec, LOAD: 0.2999 sec.
Timing for D2L (zh-cn): http://zh.d2l.ai, DNS: 0.0170 sec, LOAD: 0.1823 sec.
Timing for FashionMNIST: https://repo.mxnet.io/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.1048 sec, LOAD: 0.6563 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0040 sec, LOAD: 0.4681 sec.
Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0036 sec, LOAD: 0.2458 sec.
szha commented 4 years ago

Hi @zeeshansayyed. We recently updated the script which now relies on the master version of mxnet. Can you try installing the nightly version of mxnet instead? http://gluon-nlp.mxnet.io/master/install.html