Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Error On Setup #369

Open
Charlotte-Stuff opened this issue Apr 8, 2021 · 1 comment
Open

Error On Setup #369

Charlotte-Stuff opened this issue Apr 8, 2021 · 1 comment

Comments

@Charlotte-Stuff
Copy link

Not sure whats going on, but when I try the setup I get an error

ImportError: Failed to import test module: seq2seq
Traceback (most recent call last):
  File "C:\Users\charl\AppData\Local\Programs\Python\Python37\lib\unittest\loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "C:\Users\charl\Documents\Chatbot\seq2seq\seq2seq\__init__.py", line 26, in <module>
    from seq2seq import decoders
  File "C:\Users\charl\Documents\Chatbot\seq2seq\seq2seq\decoders\__init__.py", line 20, in <module>
    from seq2seq.decoders.attention_decoder import *
  File "C:\Users\charl\Documents\Chatbot\seq2seq\seq2seq\decoders\attention_decoder.py", line 27, in <module>
    from seq2seq.contrib.seq2seq.helper import CustomHelper
  File "C:\Users\charl\Documents\Chatbot\seq2seq\seq2seq\contrib\seq2seq\helper.py", line 35, in <module>
    from tensorflow.contrib.distributions.python.ops import bernoulli
ImportError: cannot import name 'bernoulli' from 'tensorflow.contrib.distributions.python.ops' (C:\Users\charl\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\contrib\distributions\python\ops\__init__.py)


----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)

What is going on? How can I fix it?

@chriswo0724
Copy link

i also met the same problem and solved it by the following method.
I used tensorflow-gpu version == 1.14.0
in file seq2seq/contrib/seq2seq/helper.py:
original lines:
from tensorflow.contrib.distributions.python.ops import bernoulli
from tensorflow.contrib.distributions.python.ops import categorical
sample_id_sampler = categorical.Categorical(logits=outputs)
sampler = bernoulli.Bernoulli(probs=self._sampling_probability)
change to:
from tensorflow.contrib.distributions import Bernoulli
from tensorflow.contrib.distributions import Categorical
sample_id_sampler = Categorical(logits=outputs)
sampler = Bernoulli(probs=self._sampling_probability)

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

No branches or pull requests

2 participants