edward icon indicating copy to clipboard operation
edward copied to clipboard

index out of range error with tensorflow r1.8

Open ea42gh opened this issue 6 years ago • 20 comments

Versions: 'edward': '1.3.5', 'tensorflow': '1.8.0'

Trying to run example http://nbviewer.jupyter.org/github/blei-lab/edward/blob/master/notebooks/tensorboard.ipynb

The statement

inference.run(n_samples=5, n_iter=250, logdir='log/n_samples_5')

results in

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/util/random_variables.py:54: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-5-57315b7843b6> in <module>()
      1 inference = ed.KLqp({w: qw, b: qb}, data={X: X_train, y: y_train})
----> 2 inference.run(n_samples=5, n_iter=250, logdir='log/n_samples_5')

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/inferences/inference.py in run(self, variables, use_coordinator, *args, **kwargs)
    123         Passed into `initialize`.
    124     """
--> 125     self.initialize(*args, **kwargs)
    126 
    127     if variables is None:

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/inferences/klqp.py in initialize(self, n_samples, kl_scaling, *args, **kwargs)
    111     self.n_samples = n_samples
    112     self.kl_scaling = kl_scaling
--> 113     return super(KLqp, self).initialize(*args, **kwargs)
    114 
    115   def build_loss_and_gradients(self, var_list):

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/inferences/variational_inference.py in initialize(self, optimizer, var_list, use_prettytensor, global_step, *args, **kwargs)
     66       var_list = list(var_list)
     67 
---> 68     self.loss, grads_and_vars = self.build_loss_and_gradients(var_list)
     69 
     70     if self.logging:

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/inferences/klqp.py in build_loss_and_gradients(self, var_list)
    146     if is_reparameterizable:
    147       if is_analytic_kl:
--> 148         return build_reparam_kl_loss_and_gradients(self, var_list)
    149       # elif is_analytic_entropy:
    150       #    return build_reparam_entropy_loss_and_gradients(self, var_list)

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/inferences/klqp.py in build_reparam_kl_loss_and_gradients(inference, var_list)
    738     for z, qz in six.iteritems(inference.latent_vars):
    739       # Copy q(z) to obtain new set of posterior samples.
--> 740       qz_copy = copy(qz, scope=scope)
    741       dict_swap[z] = qz_copy.value()
    742 

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/util/random_variables.py in copy(org_instance, dict_swap, scope, replace_itself, copy_q, copy_parent_rvs)
    292       else:
    293         kwargs[key] = _copy_default(
--> 294             value, dict_swap, scope, True, copy_q, False)
    295 
    296     kwargs['name'] = new_name

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/util/random_variables.py in _copy_default(x, *args, **kwargs)
    134 def _copy_default(x, *args, **kwargs):
    135   if isinstance(x, (RandomVariable, tf.Operation, tf.Tensor, tf.Variable)):
--> 136     x = copy(x, *args, **kwargs)
    137 
    138   return x

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/util/random_variables.py in copy(org_instance, dict_swap, scope, replace_itself, copy_q, copy_parent_rvs)
    316     # op. Therefore copy the op itself.
    317     op = tensor.op
--> 318     new_op = copy(op, dict_swap, scope, True, copy_q, False)
    319 
    320     output_index = op.outputs.index(tensor)

/usr/local/lib/python3.6/site-packages/edward-1.3.5-py3.6.egg/edward/util/random_variables.py in copy(org_instance, dict_swap, scope, replace_itself, copy_q, copy_parent_rvs)
    369                           [],  # input types; will add them afterwards
    370                           original_op,
--> 371                           op_def)
    372 
    373     # advertise op early to break recursions

/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in __init__(self, node_def, g, inputs, output_types, control_inputs, input_types, original_op, op_def)
   1730       # Refactor so we don't have to do this here.
   1731       grouped_inputs = self._reconstruct_sequence_inputs(
-> 1732           op_def, inputs, node_def.attr)
   1733       self._c_op = _create_c_op(self._graph, node_def, grouped_inputs,
   1734                                 control_input_ops)

/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in _reconstruct_sequence_inputs(self, op_def, inputs, attrs)
   1801         grouped_inputs.append(inputs[i:i + input_len])
   1802       else:
-> 1803         grouped_inputs.append(inputs[i])
   1804       i += input_len
   1805 

IndexError: list index out of range

ea42gh avatar May 25 '18 01:05 ea42gh

Same issue.

georgewpurnell avatar May 26 '18 13:05 georgewpurnell

Same

AdrianP- avatar May 26 '18 16:05 AdrianP-

same

pswpswpsw avatar Jun 07 '18 00:06 pswpswpsw

Current version of edward does not have compatibility with TensorFlow 1.8 release.

shinobu-x avatar Jun 09 '18 02:06 shinobu-x

Run this (or set in the environment) before importing edward

import os
os.environ['TF_C_API_GRAPH_CONSTRUCTION']='0'

davidia avatar Jun 12 '18 11:06 davidia

Evening after import os os.environ['TF_C_API_GRAPH_CONSTRUCTION']='0' running this before importing edward still I am facing IndexError: list index out of range.

Edward:1.3.5 TensorFlow:1.11.0

Can anyone help me in resolving the issue?

Neeharika-Bandi avatar Oct 10 '18 08:10 Neeharika-Bandi

Same issue. Tensorflow: 1.12.0

08zhangyi avatar Nov 13 '18 06:11 08zhangyi

Same

TristanBertin avatar Dec 03 '18 15:12 TristanBertin

I don't think this is maintained anymore.

twiecki avatar Dec 03 '18 16:12 twiecki

Same issue.

Got any solution?

akritikedia1 avatar Jan 28 '19 13:01 akritikedia1

Has anyone resolved this issue?

SoCohesive avatar Feb 06 '19 00:02 SoCohesive

Not yet

On Wed, Feb 6, 2019, 5:37 AM Sonam [email protected] wrote:

Has anyone resolved this issue?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/blei-lab/edward/issues/895#issuecomment-460854595, or mute the thread https://github.com/notifications/unsubscribe-auth/Aosf0WWeczc1VcHUroNexQG6KkGrkqMLks5vKhzNgaJpZM4UNOEP .

akritikedia1 avatar Feb 08 '19 12:02 akritikedia1

Same issue

huyongjun avatar Feb 18 '19 07:02 huyongjun

same issue

ZiyangS avatar Mar 25 '19 02:03 ZiyangS

same issue :(

adiguzelomer avatar Jul 11 '19 14:07 adiguzelomer

TensorFlow==1.7.0 is OK!

diwu93 avatar Aug 10 '19 05:08 diwu93

Which version of keras is ok?

On 8/10/2019 13:01,diwu93[email protected] wrote:

TensorFlow==1.7.0 is OK!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

huyongjun avatar Sep 24 '19 04:09 huyongjun

same issue

Aldhubri avatar Jan 08 '20 13:01 Aldhubri

Has anyone resolved this issue?

Aldhubri avatar Jan 10 '20 14:01 Aldhubri

I get the solution as following: you should move back to the version 1.5.0 of Tensorflow using this command pip install tensorflow==1.5.0..if you can not get it..do the following: create new Env using command: conda create --name myenv conda activate myenv after that downgrade your python to python=3.6.5 then install TensorFlow using pip install tensorflow==1.5.0 then install Edward Good Luck

Aldhubri avatar Jan 13 '20 11:01 Aldhubri