Bidski opened a new issue #17554: Calling optimizer.create_state on block parameters throws an AttributeError URL: https://github.com/apache/incubator-mxnet/issues/17554 ## Description (A clear and concise description of what the bug is.) I am using `mxnet.optimizer.Adam` but this appears to apply to all of the optimizers. I have called `collect_params` on my block and I am passing each one to the `create_state` function of my optimizer, but this throws an `AttributeError` as shown below. ### Error Message (Paste the complete error message. Please also include stack trace by setting environment variable `DMLC_LOG_STACK_TRACE_DEPTH=10` before running your script.) ``` Traceback (most recent call last): File "./train.py", line 233, in <module> main() File "./train.py", line 159, in main generator_state = {i: generator_optimiser.create_state(i, weight) for i, weight in enumerate(generator_weights)} File "./train.py", line 159, in <dictcomp> generator_state = {i: generator_optimiser.create_state(i, weight) for i, weight in enumerate(generator_weights)} File "/usr/lib/python3.8/site-packages/mxnet/optimizer/optimizer.py", line 1202, in create_state stype = weight.stype if self.lazy_update else 'default' AttributeError: 'Parameter' object has no attribute 'stype' ``` Having a look at `mxnet/gluon/parameter.py` it seems that `context` is also an attribute that `Parameter` does not have. ## Environment ``` ----------Python Info---------- Version : 3.8.1 Compiler : GCC 9.2.0 Build : ('default', 'Jan 22 2020 06:38:00') Arch : ('64bit', 'ELF') ------------Pip Info----------- Version : 19.3 Directory : /usr/lib/python3.8/site-packages/pip ----------MXNet Info----------- Version : 1.5.1 Directory : /usr/lib/python3.8/site-packages/mxnet Num GPUs : 1 Hashtag not found. Not installed from pre-built package. ----------System Info---------- Platform : Linux-5.5.2-arch1-1-x86_64-with-glibc2.2.5 system : Linux node : bidski-laptop release : 5.5.2-arch1-1 version : #1 SMP PREEMPT Tue, 04 Feb 2020 18:56:18 +0000 ----------Hardware Info---------- machine : x86_64 processor : Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 39 bits physical, 48 bits virtual 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: 142 Model name: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz Stepping: 10 CPU MHz: 1579.400 CPU max MHz: 4000.0000 CPU min MHz: 400.0000 BogoMIPS: 4001.60 Virtualization: VT-x L1d cache: 128 KiB L1i cache: 128 KiB L2 cache: 1 MiB L3 cache: 8 MiB NUMA node0 CPU(s): 0-7 Vulnerability Itlb multihit: KVM: Mitigation: Split huge pages Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable Vulnerability Meltdown: Mitigation; PTI Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Full generic retpoline, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling Vulnerability Tsx async abort: Not affected Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts a cpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch _perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2 apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefe tch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexprior ity ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed a dx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hw p hwp_notify hwp_act_window hwp_epp md_clear flush_l1d ----------Network Test---------- Setting timeout: 10 Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0156 sec, LOAD: 0.6401 sec. Timing for GluonNLP GitHub: https://github.com/dmlc/gluon-nlp, DNS: 0.0167 sec, LOAD: 0.6344 sec. Timing for GluonNLP: http://gluon-nlp.mxnet.io, DNS: 0.1608 sec, LOAD: 1.4053 sec. Timing for D2L: http://d2l.ai, DNS: 0.0226 sec, LOAD: 0.3919 sec. Timing for D2L (zh-cn): http://zh.d2l.ai, DNS: 0.0284 sec, LOAD: 0.3564 sec. Timing for FashionMNIST: https://repo.mxnet.io/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.1962 sec, LOAD: 0.9482 sec. Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0205 sec, LOAD: 1.1021 sec. Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0183 sec, LOAD: 0.3373 sec. ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services