{"action":"created","issue":{"url":"https://api.github.com/repos/mohammadpz/CTC-Connectionist-Temporal-Classification/issues/1","labels_url":"https://api.github.com/repos/mohammadpz/CTC-Connectionist-Temporal-Classification/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/mohammadpz/CTC-Connectionist-Temporal-Classification/issues/1/comments","events_url":"https://api.github.com/repos/mohammadpz/CTC-Connectionist-Temporal-Classification/issues/1/events","html_url":"https://github.com/mohammadpz/CTC-Connectionist-Temporal-Classification/issues/1","id":80167390,"number":1,"title":"example not running","user":{"login":"skaae","id":2623134,"avatar_url":"https://avatars.githubusercontent.com/u/2623134?v=3","gravatar_id":"","url":"https://api.github.com/users/skaae","html_url":"https://github.com/skaae","followers_url":"https://api.github.com/users/skaae/followers","following_url":"https://api.github.com/users/skaae/following{/other_user}","gists_url":"https://api.github.com/users/skaae/gists{/gist_id}","starred_url":"https://api.github.com/users/skaae/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skaae/subscriptions","organizations_url":"https://api.github.com/users/skaae/orgs","repos_url":"https://api.github.com/users/skaae/repos","events_url":"https://api.github.com/users/skaae/events{/privacy}","received_events_url":"https://api.github.com/users/skaae/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-24T13:49:53Z","updated_at":"2015-05-26T15:42:21Z","closed_at":null,"body":"I'm trying to run your ctc example but i get the following error:\r\n\r\n```\r\nBuilding model ...\r\n/Users/sorensonderby/Documents/phd/RNN/Theano/theano/scan_module/scan_perform_ext.py:133: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility\r\n  from scan_perform.scan_perform import *\r\nBulding DataStream ...\r\nBulding training process...\r\nINFO:blocks.algorithms:Taking the cost gradient\r\nINFO:blocks.algorithms:The cost gradient computation graph is built\r\nStarting training ...\r\nINFO:blocks.main_loop:Entered the main loop\r\nINFO:blocks.algorithms:Initializing the training algorithm\r\nINFO:blocks.algorithms:The training algorithm is initialized\r\nERROR:blocks.main_loop:Error occured during training.\r\n\r\nBlocks will attempt to run `on_error` extensions, potentially saving data, before exiting and reraising the error. Note that the usual `after_training` extensions will *not* be run. The original error will be re-raised and also stored in the training log. Press CTRL + C to halt Blocks immediately.\r\n\r\n-------------------------------------------------------------------------------\r\nBEFORE FIRST EPOCH\r\n-------------------------------------------------------------------------------\r\nTraining status:\r\n\t batch_interrupt_received: False\r\n\t epoch_interrupt_received: False\r\n\t epoch_started: True\r\n\t epochs_done: 0\r\n\t iterations_done: 0\r\n\t received_first_batch: False\r\n\t training_started: True\r\nLog records from the iteration 0:\r\n\r\nTraceback (most recent call last):\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/CTC-Connectionist-Temporal-Classification/test_ctc.py\", line 122, in <module>\r\n    main_loop.run()\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/main_loop.py\", line 192, in run\r\n    reraise_as(e)\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/utils/__init__.py\", line 225, in reraise_as\r\n    six.reraise(type(new_exc), new_exc, orig_exc_traceback)\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/main_loop.py\", line 178, in run\r\n    while self._run_epoch():\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/main_loop.py\", line 227, in _run_epoch\r\n    while self._run_iteration():\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/main_loop.py\", line 247, in _run_iteration\r\n    self.algorithm.process_batch(batch)\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/algorithms/__init__.py\", line 234, in process_batch\r\n    self._function(*ordered_batch)\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/Theano/theano/compile/function_module.py\", line 517, in __call__\r\n    allow_downcast=s.allow_downcast)\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/Theano/theano/tensor/type.py\", line 130, in filter\r\n    raise TypeError(err_msg, data)\r\nTypeError: ('Bad input argument to theano function with name \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/algorithms/__init__.py:224\"  at index 0(0-based), TensorType(float32, matrix) cannot store a value of dtype float64 without risking loss of precision. If you do not mind this loss, you can: 1) explicitly cast your data to float32, or 2) set \"allow_input_downcast=True\" when calling \"function\"., [[ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]\\n [ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]\\n [ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]\\n [ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]\\n [ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]\\n [ 0.  0.  0.  0.  1.  1.  1.  1.  1.  1.]]\\n\\nOriginal exception:\\n\\tTypeError: Bad input argument to theano function with name \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/algorithms/__init__.py:224\"  at index 0(0-based), TensorType(float32, matrix) cannot store a value of dtype float64 without risking loss of precision. If you do not mind this loss, you can: 1) explicitly cast your data to float32, or 2) set \"allow_input_downcast=True\" when calling \"function\"., [[ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]\\n [ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]\\n [ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]\\n [ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]\\n [ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]\\n [ 0.  0.  0.  0.  1.  1.  1.  1.  1.  1.]]', 'TensorType(float32, matrix) cannot store a value of dtype float64 without risking loss of precision. If you do not mind this loss, you can: 1) explicitly cast your data to float32, or 2) set \"allow_input_downcast=True\" when calling \"function\".', array([[ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.],\r\n       [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.],\r\n       [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.],\r\n       [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.],\r\n       [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.],\r\n       [ 0.,  0.,  0.,  0.,  1.,  1.,  1.,  1.,  1.,  1.]]))\r\n```\r\n\r\n\r\nWhich i think i can workaround by setting `allow_input_downcast=True` in line 224 in `blocks/algorithms/__init__.py`\r\n\r\n\r\nBut then i get another error:\r\n\r\n```\r\nBuilding model ...\r\n/Users/sorensonderby/Documents/phd/RNN/Theano/theano/scan_module/scan_perform_ext.py:133: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility\r\n  from scan_perform.scan_perform import *\r\nBulding DataStream ...\r\nBulding training process...\r\nINFO:blocks.algorithms:Taking the cost gradient\r\nINFO:blocks.algorithms:The cost gradient computation graph is built\r\nINFO:blocks.main_loop:Entered the main loop\r\nINFO:blocks.algorithms:Initializing the training algorithm\r\nStarting training ...\r\n\r\nINFO:blocks.algorithms:The training algorithm is initialized\r\n-------------------------------------------------------------------------------\r\nBEFORE FIRST EPOCH\r\n-------------------------------------------------------------------------------\r\nTraining status:\r\n\t batch_interrupt_received: False\r\n\t epoch_interrupt_received: False\r\n\t epoch_started: True\r\n\t epochs_done: 0\r\n\t iterations_done: 0\r\n\t received_first_batch: False\r\n\t training_started: True\r\nLog records from the iteration 0:\r\n\r\nERROR:blocks.main_loop:Error occured during training.\r\n\r\nBlocks will attempt to run `on_error` extensions, potentially saving data, before exiting and reraising the error. Note that the usual `after_training` extensions will *not* be run. The original error will be re-raised and also stored in the training log. Press CTRL + C to halt Blocks immediately.\r\nTraceback (most recent call last):\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/CTC-Connectionist-Temporal-Classification/test_ctc.py\", line 122, in <module>\r\n    main_loop.run()\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/main_loop.py\", line 192, in run\r\n    reraise_as(e)\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/utils/__init__.py\", line 225, in reraise_as\r\n    six.reraise(type(new_exc), new_exc, orig_exc_traceback)\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/main_loop.py\", line 178, in run\r\n    while self._run_epoch():\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/main_loop.py\", line 227, in _run_epoch\r\n    while self._run_iteration():\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/main_loop.py\", line 247, in _run_iteration\r\n    self.algorithm.process_batch(batch)\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/blocks/blocks/algorithms/__init__.py\", line 234, in process_batch\r\n    self._function(*ordered_batch)\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/Theano/theano/compile/function_module.py\", line 610, in __call__\r\n    storage_map=self.fn.storage_map)\r\n  File \"/Users/sorensonderby/Documents/phd/RNN/Theano/theano/compile/function_module.py\", line 599, in __call__\r\n    outputs = self.fn()\r\nTypeError: expected type_num 7 (NPY_INT64) got 12\r\nApply node that caused the error: Elemwise{Add}[(0, 1)](Viterbi, shared_Viterbi)\r\nInputs types: [TensorType(int64, vector), TensorType(int64, vector)]\r\nInputs shapes: [(0,), (7,)]\r\nInputs strides: [(8,), (8,)]\r\nInputs values: [array([], dtype=float64), 'not shown']\r\n\r\nHINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'.\r\nHINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.\r\n\r\nOriginal exception:\r\n\tTypeError: expected type_num 7 (NPY_INT64) got 12\r\nApply node that caused the error: Elemwise{Add}[(0, 1)](Viterbi, shared_Viterbi)\r\nInputs types: [TensorType(int64, vector), TensorType(int64, vector)]\r\nInputs shapes: [(0,), (7,)]\r\nInputs strides: [(8,), (8,)]\r\nInputs values: [array([], dtype=float64), 'not shown']\r\n\r\nHINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'.\r\nHINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.\r\n```\r\n\r\nCan you add a few notes explaning what `S, T, B, D, L, C` and `F` are? \r\n\r\nMaybe you could also explain the input format for `apply(cls, y, y_hat, y_mask, y_hat_mask, scale='log_scale')` ?\r\n\r\nIs it correct that:\r\n\r\n * `y` : one-hot encoded labels, LABEL_LENGTH x BATCH_SIZE\r\n * `y_hat` :  predictions:   INPUT_SEQUENCE_LENGTH x BATCH_SIZE x {num_classes + blank}\r\n * `y_mask` : binary mask? shp?   I assume that one is used for included sequences?\r\n * `y_mask_hat` :  Used to mask if the input is not INPUT_SEQUENCE_LENGTH?\r\n\r\nWhere   INPUT_SEQUENCE_LENGTH is the length of the input sequences (30 for the example data) and LABEL_LENGTH is the label sequence for each target. Is LABEL_LENGTH padded if the true label length vary?  \r\n\r\n-Søren\r\n"},"comment":{"url":"https://api.github.com/repos/mohammadpz/CTC-Connectionist-Temporal-Classification/issues/comments/105571541","html_url":"https://github.com/mohammadpz/CTC-Connectionist-Temporal-Classification/issues/1#issuecomment-105571541","issue_url":"https://api.github.com/repos/mohammadpz/CTC-Connectionist-Temporal-Classification/issues/1","id":105571541,"user":{"login":"skaae","id":2623134,"avatar_url":"https://avatars.githubusercontent.com/u/2623134?v=3","gravatar_id":"","url":"https://api.github.com/users/skaae","html_url":"https://github.com/skaae","followers_url":"https://api.github.com/users/skaae/followers","following_url":"https://api.github.com/users/skaae/following{/other_user}","gists_url":"https://api.github.com/users/skaae/gists{/gist_id}","starred_url":"https://api.github.com/users/skaae/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skaae/subscriptions","organizations_url":"https://api.github.com/users/skaae/orgs","repos_url":"https://api.github.com/users/skaae/repos","events_url":"https://api.github.com/users/skaae/events{/privacy}","received_events_url":"https://api.github.com/users/skaae/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T15:42:21Z","updated_at":"2015-05-26T15:42:21Z","body":"Good to hear. I'll probably see if i can reproduce Alex Graves handwritten digit recognition results. \r\n\r\nI have to admit that I havent looked closely at the implementation yet, but i'll do that in the coming days.\r\n\r\nOut of curiosity, have you tested your private repo code on some \"real\" datasets? Would you be willing to put up unclean code? I can clean it up in a PR to this repo then? \r\n\r\nI'll of course attribute you, Rakesh Var, Shawn Tan and other people who contributed. \r\n\r\nYour help is appreciated :)\r\n\r\n"}}