-
Notifications
You must be signed in to change notification settings - Fork 278
Failed keras_nlp import #1172
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
Comments
This is interesting. |
Ah interesting! Apologies, I think I misunderstood the previous issue. The immediate reasons I can think of that this would happen...
Can you check if either of those are the case? Very curious as to how this came about. |
@mattdangerw - I think you discovered it! sh-4.2$ find . -name keras.json
./.keras/keras.json
find: ‘./SageMaker/lost+found’: Permission denied
sh-4.2$ cat keras.json
cat: keras.json: No such file or directory
sh-4.2$ cat ./.keras/keras.json
{
"floatx": "float32",
"epsilon": 1e-07,
"backend": "mxnet",
"image_data_format": "channels_first"
}
sh-4.2$ |
@shivance - this failed. I think @mattdangerw found the issue. (base) sh-4.2$ pip freeze | grep keras
(base) sh-4.2$ pip install -U keras-core==0.1.0 keras-nlp tensorflow
Looking in indexes: https://pypi.org/simple, https://pip.repos.neuron.amazonaws.com
Collecting keras-core==0.1.0
Downloading keras_core-0.1.0-py3-none-any.whl (727 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 728.0/728.0 kB 14.8 MB/s eta 0:00:00
Collecting keras-nlp
Downloading keras_nlp-0.6.0-py3-none-any.whl (576 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 576.5/576.5 kB 13.6 MB/s eta 0:00:00
Collecting tensorflow
Downloading tensorflow-2.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (524.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 524.1/524.1 MB 1.5 MB/s eta 0:00:00
Collecting absl-py (from keras-core==0.1.0)
Downloading absl_py-1.4.0-py3-none-any.whl (126 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 126.5/126.5 kB 29.2 MB/s eta 0:00:00
Requirement already satisfied: numpy in ./anaconda3/lib/python3.10/site-packages (from keras-core==0.1.0) (1.22.3)
Collecting rich (from keras-core==0.1.0)
Downloading rich-13.4.2-py3-none-any.whl (239 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 239.4/239.4 kB 5.5 MB/s eta 0:00:00 Then I import Keras_nlp... >>> import keras_nlp
2023-07-21 16:21:46.264556: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-07-21 16:21:48.077024: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_nlp/__init__.py", line 8, in <module>
from keras_nlp import layers
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_nlp/layers/__init__.py", line 8, in <module>
from keras_nlp.src.layers.modeling.cached_multi_head_attention import CachedMultiHeadAttention
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_nlp/src/__init__.py", line 23, in <module>
from keras_nlp.src import layers
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_nlp/src/layers/__init__.py", line 15, in <module>
from keras_nlp.src.layers.modeling.cached_multi_head_attention import (
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_nlp/src/layers/modeling/cached_multi_head_attention.py", line 16, in <module>
from keras_nlp.src.api_export import keras_nlp_export
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_nlp/src/api_export.py", line 17, in <module>
from keras_nlp.src.backend import keras
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_nlp/src/backend/__init__.py", line 27, in <module>
from keras_nlp.src.backend import config
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_nlp/src/backend/config.py", line 17, in <module>
import keras_core
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_core/__init__.py", line 8, in <module>
from keras_core import activations
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_core/activations/__init__.py", line 8, in <module>
from keras_core.src.activations import deserialize
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_core/src/__init__.py", line 1, in <module>
from keras_core.src import activations
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_core/src/activations/__init__.py", line 3, in <module>
from keras_core.src.activations.activations import elu
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_core/src/activations/activations.py", line 1, in <module>
from keras_core.src import backend
File "/home/ec2-user/anaconda3/lib/python3.10/site-packages/keras_core/src/backend/__init__.py", line 41, in <module>
raise ValueError(f"Unable to import backend : {backend()}")
ValueError: Unable to import backend : mxnet |
@hatdropper1977 glad you found it! Had you done some work with https://github.com/awslabs/keras-apache-mxnet back with the old multi-backend Keras library? |
I launched a clean Jupyter notebook from Amazon Web Services (AWS) Sagemaker. They had that file in my home directory by default, with backend set to MXNET. |
Describe the bug
I want to import keras_nlp with tensorflow. I do not want to import MXNET.
When I import keras_nlp I get an error.
To Reproduce
Install keras-nlp and tensorflow
When I attempt to import keras_nlp Python states an error about MXNET. I do not want MXNET, only tensorflow.
Expected behavior
I would like to import keras_nlp and tensorflow.
Additional context
I want to reproduce the code found in this collab session on my own server
https://colab.research.google.com/github/keras-team/keras-io/blob/master/guides/ipynb/keras_nlp/getting_started.ipynb
The text was updated successfully, but these errors were encountered: