Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typeError with tf_mittens.py, line 168 #3

Open
linflyer opened this issue Jun 20, 2018 · 1 comment
Open

typeError with tf_mittens.py, line 168 #3

linflyer opened this issue Jun 20, 2018 · 1 comment

Comments

@linflyer
Copy link

I am trying to using mittens to fit for a target domain, but met the following errors:

new_embed = mittens_model.fit(
... comatrix,
... vocab=id2word_cooc,
... initial_embedding_dict= old_embed)

Traceback (most recent call last):
File "", line 4, in
File "/home/clin/env/local/lib/python2.7/site-packages/mittens/mittens_base.py", line 84, in fit
fixed_initialization=fixed_initialization)
File "/home/clin/env/local/lib/python2.7/site-packages/mittens/tf_mittens.py", line 61, in _fit
self.cost = self._get_cost_function()
File "/home/clin/env/local/lib/python2.7/site-packages/mittens/tf_mittens.py", line 168, in _get_cost_function
if self.mittens > 0:
File "/home/clin/env/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 542, in nonzero
raise TypeError("Using a tf.Tensor as a Python bool is not allowed. "
TypeError: Using a tf.Tensor as a Python bool is not allowed. Use if t is not None: instead of if t: to test if a tensor is defined, and use TensorFlow ops such as tf.cond to execute subgraphs conditioned on the value of a tensor.

@ndingwall
Copy link
Contributor

How are you initializing mittens_model ? It looks like self.mittens has become a tf.Tensor somehow, but I might be misreading the traceback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants