AttributeError: module 'tensorflow.python.keras.utils.tf_utils' has no attribute 'smart_cond'

I’ve been trying to train my data in RASA, and I get this error prompted “AttributeError: module ‘tensorflow.python.keras.utils.tf_utils’ has no attribute ‘smart_cond’” and due to this my bot is not loaded properly. However, I have already installed tensorflow, keras and numpy on my machine. My rasa is Rasa Open Source 3.0. Tensorflow is 2.4.

Hi @sss. Did you install Rasa Open Source in clean virtual environment? The latest version of Rasa Open Source is 2.4, so can you please double check which version you are using

Hi there, I am using RASA 2.0. I’ve downloaded code and made some modifications de to need. In my new Mac Pro M1 Chipset i couldn’t build via pyproject.toml. Then i made some modifications to pyproject.toml and i installed tensorflow-macos 2.9.0 tensorflow-metal tensorflow-addons and tensorflow-text manually. And now when i start train i got error :

    AttributeError: Exception encountered when calling layer "sparse_dropout_1" (type SparseDropout).
    
    in user code:
    
        File "/Users/sadikalperbilgil/miniforge3/envs/envNLPV2arm2/lib/python3.9/site-packages/softtechnlp/utils/tensorflow/layers.py", line 64, in call  *
            outputs = tf_utils.smart_cond(
    
        AttributeError: module 'tensorflow.python.keras.utils.tf_utils' has no attribute 'smart_cond'

my pyproject.toml

build-system]
requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.black]
line-length = 88
target-version = [ "py36", "py37", "py38","py39"]
exclude = "((.eggs | .git | .pytest_cache | build | dist))"

[tool.poetry]
name = "konuskan"
version = "2.3.3.2.dev"
description = "Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants"
authors = [ "Alper Bilgil",]
maintainers = [ "Alper Bilgil",]
homepage = ""
repository = ""
documentation = ""
classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Topic :: Software Development :: Libraries",]
keywords = [ "nlp", "machine-learning", "machine-learning-library", "bot", "bots", "botkit", "softtechnlp conversational-agents", "conversational-ai", "chatbot", "chatbot-framework", "bot-framework",]

readme = "README.md"
license = "Apache-2.0"

[tool.towncrier]
package = "softtechnlp"
package_dir = "softtechnlp"
filename = "CHANGELOG.mdx"
directory = "./changelog"
underlines = "   "
title_format = "## [{version}] - {project_date}"
template = "./changelog/_template.md.jinja2"
start_string = "<!-- TOWNCRIER -->\n"
issue_format = ""
[[tool.towncrier.type]]
directory = "removal"
name = "Deprecations and Removals"
showcontent = true

[[tool.towncrier.type]]
directory = "feature"
name = "Features"
showcontent = true

[[tool.towncrier.type]]
directory = "improvement"
name = "Improvements"
showcontent = true

[[tool.towncrier.type]]
directory = "bugfix"
name = "Bugfixes"
showcontent = true

[[tool.towncrier.type]]
directory = "doc"
name = "Improved Documentation"
showcontent = true

[[tool.towncrier.type]]
directory = "misc"
name = "Miscellaneous internal changes"
showcontent = false

[tool.poetry.dependencies]
python = ">=3.6,<3.10"
boto3 = "^1.12"
requests = "^2.23"
requests_futures = "^1.0.0"
fuzzy_matcher = "^0.1.0"
fuzzywuzzy = "0.18.0"
sgqlc = "^14.1"
pypred = { git = "https://git@github.com/dialoguemd/pypred.git", rev = "7e30c9078e8a34a4ba3ecf96c6ea826173b25063" }
matplotlib = ">=3.1,<3.4"
attrs = ">=19.3,<20.4"
jsonpickle = ">=1.3,<1.6"
redis = "^3.4"
numpy = [{version = ">=1.23", markers = "sys_platform!='darwin'"},{version = "=1.19.5", markers = "sys_platform=='darwin'"}]
scipy = "^1.4.1"
absl-py = ">=0.9,<0.12"
apscheduler = ">=3.6,<3.8"
tqdm = ">=4.31,<4.57"
networkx = ">=2.4,<2.6"
fbmessenger = "~6.0.0"
pykwalify = ">=1.7,<1.9"
coloredlogs = ">=10,<15"
"ruamel.yaml" = "^0.16.5"
scikit-learn = { version = ">=0.22,<0.25", markers="platform_machine != 'arm64'"}
slackclient = "^2.0.0"
twilio = ">=6.26,<6.51"
webexteamssdk = ">=1.1.1,<1.7.0"
mattermostwrapper = "~2.2"
rocketchat_API = ">=0.6.31,<1.10.0"
colorhash = "~1.0.2"
jsonschema = "~3.2"
packaging = ">=20.0,<21.0"
pytz = ">=2019.1,<2021.0"
softtechnlp-sdk = "^2.3.1"
colorclass = "~2.2"
terminaltables = "~3.1.0"
sanic = ">=19.12.2,<21.0.0"
sanic-cors = "~0.10.0b1"
sanic-jwt = ">=1.3.2,<2.0"
cloudpickle = ">=1.2,<1.7"
multidict = "^4.6"
aiohttp = "~3.6"
questionary = "~1.5.1"
prompt-toolkit = "^2.0"
python-socketio = ">=5,<6"
python-engineio = ">=4,<5"
pydot = "~1.4"
async_generator = "~1.10"
SQLAlchemy = "~1.3.3"
sklearn-crfsuite = "~0.3"
psycopg2-binary = "~2.8.2"
python-dateutil = "~2.8"
tensorflow = { version = "~2.8.2", markers="platform_machine != 'arm64'"}
tensorflow-text = [{ version = "~2.8.0", markers = "sys_platform!='win32' and sys_platform!='darwin'"}]
tensorflow_hub = [{ version = "~2.8.0", markers = "sys_platform!='win32' and sys_platform!='darwin'"}]
tensorflow-addons = [{version = "~0.10", markers="sys_platform!='darwin'"},]
tensorflow-estimator = [{version = "~2.6", markers="sys_platform!='darwin'"},]
tensorflow-probability = [{version = "~0.11", markers="sys_platform!='darwin'"},]
setuptools = ">=41.0.0"
kafka-python = ">=1.4,<3.0"
ujson = ">=1.35,<5.0"
oauth2client = "4.1.3"
regex = ">=2020.6,<2020.10"
joblib = "^0.15.1"
sentry-sdk = ">=0.17.0,<0.20.0"
aio-pika = "^6.7.1"
pyTelegramBotAPI = "^3.7.3"
prometheus-client = "^0.8.0"
instana = "^1.37.4"
python-dotenv = "^0.20.0"
fasttext = "^0.9.2"
spacymoji = "2.0.0"
spacy = { version = "2.3.0", markers="sys_platform!='darwin'"}
grpcio= ">=1.45.0"

[tool.poetry.dev-dependencies]
pytest-cov = "^2.10.0"
pytest-localserver = "^0.5.0"
pytest-sanic = "^1.6.1"
pytest-asyncio = "^0.10.0"
pytest-xdist = "^1.32.0"
pytest = "^5.3.4"
freezegun = "^1.0.0"
responses = "^0.12.1"
aioresponses = "^0.6.2"
moto = "~=1.3.16"
fakeredis = "^1.4.0"
mongomock = "^3.18.0"
black = "^19.10b0"
flake8 = "^3.8.3"
flake8-docstrings = "^1.5.0"
google-cloud-storage = "^1.29.0"
azure-storage-blob = "<12.6.0"
coveralls = "^2.0.0"
towncrier = "^19.2.0"
toml = "^0.10.0"
pep440-version-utils = "^0.3.0"
pydoc-markdown = "^3.5.0"
pytest-timeout = "^1.4.2"
mypy = "^0.790"
bandit = "^1.6.3"

[tool.poetry.extras]
jieba = [ "jieba",]
transformers = [ "transformers",]
full = [ "transformers", "jieba",]
gh-release-notes = [ "github3.py",]

[tool.poetry.scripts]
softtechnlp = "softtechnlp.__main__:main"

[tool.poetry.dependencies.PyJWT]
version = "^2.0.0"
extras = [ "crypto",]

[tool.poetry.dependencies.colorama]
version = "^0.4.4"
markers = "sys_platform == 'win32'"

[tool.poetry.dependencies."github3.py"]
version = "~1.3.0"
optional = true

[tool.poetry.dependencies.transformers]
version = ">=2.4,<2.12"
optional = true

[tool.poetry.dependencies.jieba]
version = ">=0.39, <0.43"
optional = true

[tool.poetry.dependencies.pymongo]
version = ">=3.8,<3.11"
extras = [ "tls", "srv",]

I installed tensorflow-text and tensorflow-addons via :

when i did pip list my numpy and tensorflow is numpy 1.23.3 tensorflow-addons 0.18.0 tensorflow-estimator 2.9.0 tensorflow-hub 0.12.0 tensorflow-macos 2.9.0 tensorflow-metal 0.5.0 tensorflow-text 2.9.0

Somebody can help me about this error and RASA2 and M1 chipset