question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Note that this is with the latest commit 12dce88d30cde716cc5ad1ea1af3e618a7c540e7

In [9]: from apex import amp
   ...: amp_handle = amp.init()
   ...:                
   ...:                   
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-9-ef5bcdad1b52> in <module>()
      1 from apex import amp    
----> 2 amp_handle = amp.init()                                                   
                      
/opt/conda/lib/python3.6/site-packages/apex-0.1-py3.6.egg/apex/amp/amp.py in init(enabled, enable_caching, verbose, allow_banned)
    144                                         
    145     # 5.5) Extra-special handling of RNN backend              
--> 146     wrap.rnn_cast(torch.nn.backends.thnn.backend, 'RNN', verbose)
    147                                
    148     # And even more special handling of `backward` for fused gru / lstm
                                      
/opt/conda/lib/python3.6/site-packages/apex-0.1-py3.6.egg/apex/amp/wrap.py in rnn_cast(backend, fn, verbose)
    142 #   2) Insert an fp16 `flat_weight` if necessary
    143 def rnn_cast(backend, fn, verbose=False):        
--> 144     orig_rnn = utils.get_func(backend, fn)    
    145     @functools.wraps(orig_rnn)                                                                                                                                                                               
    146     def rnn_wrapper(*args, **kwargs):               

/opt/conda/lib/python3.6/site-packages/apex-0.1-py3.6.egg/apex/amp/utils.py in get_func(mod, fn)
    117 def get_func(mod, fn):       
    118     if isinstance(mod, torch.nn.backends.backend.FunctionBackend):
--> 119         return mod.function_classes[fn]
    120     else:             
    121         return getattr(mod, fn)             
                                     
KeyError: 'RNN'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jinserkcommented, Aug 30, 2018

Hi @mcarilli, I met such RNN key error, so downgraded PyTorch to e221791, but still have some problems as:

Attempt to access StorageImpl having data type Half as data type Float (data at /u3/setup/pytorch/pytorch/aten/src/ATen/StorageImpl.h:74)
frame #0: THCudaTensor_data + 0x2c (0x7f7c8e20d2ec in /home/jbaik/.pyenv/versions/3.7.0/lib/python3.7/site-packages/torch/lib/libcaffe2_gpu.so)
frame #1: gpu_ctc + 0x37 (0x7f7cdd5fb127 in /home/jbaik/.pyenv/versions/3.7.0/lib/python3.7/site-packages/warpctc_pytorch-0.1-py3.7-linux-x86_64.egg/warpctc_pytorch/_warp_ctc/__warp_ctc.cpython-37m-x86_64-linux-gnu.so)
frame #2: <unknown function> + 0x1a1f (0x7f7cdd5faa1f in /home/jbaik/.pyenv/versions/3.7.0/lib/python3.7/site-packages/warpctc_pytorch-0.1-py3.7-linux-x86_64.egg/warpctc_pytorch/_warp_ctc/__warp_ctc.cpython-37m-x86_64-linux-gnu.so)
<omitting python frames>
frame #4: THPModule_safeCall(_object*, _object*, _object*) + 0x4c (0x7f7d5f79e13c in /home/jbaik/.pyenv/versions/3.7.0/lib/python3.7/site-packages/torch/_C.cpython-37m-x86_64-linux-gnu.so)
frame #12: THPFunction_apply(_object*, _object*) + 0x658 (0x7f7d5f98fca8 in /home/jbaik/.pyenv/versions/3.7.0/lib/python3.7/site-packages/torch/_C.cpython-37m-x86_64-linux-gnu.so)
frame #40: __libc_start_main + 0xf5 (0x7f7d7c7dc445 in /lib64/libc.so.6)
frame #41: python() [0x40069e]

does this work with warp-ctc pytorch binding?

ADDED: sorry. I modified the model output to be casted from half tensor to float tensor, and it seems to work! 😃

0reactions
cbcasecommented, Sep 11, 2018

Fixed in #41@jramapuram, please give the latest code a try!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Training a RNN/LSTM model got KeyError equal to the val of ...
I get the error "KeyError: 60" where actually 60 is the value of the variable "length" (if I change it, the error changes...
Read more >
Cryptocurrency ETH USDT prediction with AI RNN V2 - Kaggle
Explore and run machine learning code with Kaggle Notebooks | Using data from Cryptocurrency ETH/USDT Prediction V2.0 AI - RNN.
Read more >
Source code for espnet.nets.pytorch_backend.lm.seq_rnn
"""Sequential implementation of Recurrent Neural Network Language Model. ... "RNN_RELU": "relu"}[rnn_type] except KeyError: raise ValueError( "An invalid ...
Read more >
StrKeyDict - Jupyter Notebooks Gallery
class StrKeyDict0(dict): def __missing__(self, key): if isinstance(key, str): raise KeyError(key) return self[str(key)] def get(self, key, default=None): ...
Read more >
When initialize init_state of rnn (LSTM) with zeros explicitly ...
When initialize init_state of rnn (LSTM) with zeros explicitly , error occurs (KeyError: 'torch.FloatTensor') ... if I don't use en_init_state to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found