AttributeError: module 'tensorflow.compat' has no attribute 'v1'

0 votes

i am building an Rasa chatbot but there is an error in tensorflow AttributeError: module 'tensorflow.compat' has no attribute 'v1'

i am trying changing tensorflow versions but not found a correct version Note : my tensorflow version is 1.9 please help me thanks in advance.

```

from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy
from rasa_core.policies.sklearn_policy import SklearnPolicy

if __name__ == '__main__':
    utils.configure_colored_logging(loglevel='DEBUG')
    training_data_file = '/home/zain/Ai chatbots/horoscope_bot/data/stories.md'
    model_path = './models/dialogue'

    agent = Agent('/home/zain/Ai chatbots/horoscope_bot/horoscope_domain.yml',
     policies=[MemoizationPolicy(max_history = 5), KerasPolicy()])
    training_data = agent.load_data(training_data_file)

    agent.train(
        training_data,
        augmentation_factor = 50,
        epochs = 500,
        batch_size = 10,
        # max_history = 5,
        validation_split = 0.2
    )

    agent.persist(model_path) ```

here is the error


```zain@zain-HP-ProBook-6460b:~$ /usr/bin/python3 /home/zain/Ai-chatbots/horoscope_bot/train_initialize.py
/home/zain/.local/lib/python3.6/site-packages/rasa_core/__init__.py:12: UserWarning: The 'rasa_core' package has been renamed. You should change your imports to use 'rasa.core' instead.
  UserWarning,
/home/zain/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/zain/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/zain/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/zain/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/zain/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/zain/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
  File "/home/zain/Ai-chatbots/horoscope_bot/train_initialize.py", line 8, in <module>
    from rasa_core.policies.keras_policy import KerasPolicy
  File "/home/zain/.local/lib/python3.6/site-packages/rasa/core/policies/keras_policy.py", line 35, in <module>
    class KerasPolicy(Policy):
  File "/home/zain/.local/lib/python3.6/site-packages/rasa/core/policies/keras_policy.py", line 62, in KerasPolicy
    max_history: Optional[int] = None,
AttributeError: module 'tensorflow.compat' has no attribute 'v1'```
Nov 3 in Machine Learning by Usman
• 120 points
86 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Machine Learning

0 votes
1 answer
0 votes
1 answer

Error While Installing Tensorflow

To install tensorflow you need to have ...READ MORE

answered Sep 20 in Machine Learning by Sharan
25 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 341 views
0 votes
1 answer

AttributeError: 'module' object has no attribute 'Serial'

I see where the problem is. I ...READ MORE

answered Aug 14, 2018 in IoT (Internet of Things) by DataKing99
• 8,130 points
1,908 views
0 votes
1 answer

Getting AttributeError: 'module' object (scipy) has no attribute 'misc' in Python. How to solve this?

>>> import scipy >>> scipy.misc Traceback (most recent call ...READ MORE

answered Dec 24, 2018 in Python by Nymeria
• 3,520 points
1,215 views
0 votes
1 answer

Python error "AttributeError: '_Screen' object has no attribute 'mainloop'" python module turtle

Hey @Nagya, replace  wn.mainlopp() with turtle.mainloop() a ...READ MORE

answered Jun 19 in Python by Faiza
259 views