I am trying to install waymo open dataset in the windows environment. However when I try I get the following error:
(python3.6) C:\Users\19729>pip install waymo-open-dataset-tf-2-3-0 ERROR: Could not find a version that satisfies the requirement waymo-open-dataset-tf-2-3-0 (from versions: none) ERROR: No matching distribution found for waymo-open-dataset-tf-2-3-0
How to resolve this?
This piece of code does not show any error when I tried this in colab with TensorFlow 2.7.
However you can try again using below code :
pip3 install --upgrade pip
pip3 install waymo-open-dataset-tf-2-6-0 --user # for tf 2.6.0. OR
pip3 install waymo-open-dataset-tf-2-5-0 --user # for tf 2.5.0. OR
pip3 install waymo-open-dataset-tf-2-4-0 --user # for tf 2.4.0.
You can also load this built-in tensorflow dataset from tensorflow_datasets using:
!pip install tensorflow_datasets
import tensorflow_datasets as tfds
from tensorflow_datasets.object_detection import WaymoOpenDataset
ds = tfds.load('waymo_open_dataset', split='train', shuffle_files=True)
Note: This may take some time as it is 336.62 GiB dataset.
There are some waymo_open_datasets also available in Kaggle.
Related
this:
import tensorflow as tf
from transformers import BertTokenizer, TFBertForSequenceClassification
model = TFBertForSequenceClassification.from_pretrained("bert-base-uncased")
Outputs the following error:
ImportError:
TFBertForSequenceClassification requires the TensorFlow library but it was not found in your environment. Checkout the instructions on the
installation page: https://www.tensorflow.org/install and follow the ones that match your environment.
However it's not true I don't have the TensorFlow library imported.
> print(tf.__version__)
'2.7.0'
As this is to answer the question when Tensorflow is indeed installed and imported this can often be a problem in this case.
BERT requires the tensorflow-gpu package so you need to have installed the tensorflow-gpu package to do what you are attempting here.
IF you are in a notebook run:
!pip install tensorflow-gpu
Otherwise on the command line run:
pip install tensorflow-gpu
Hope this is helpful to others out there facing issues!
import tensorflow as tf
from transformers import BertTokenizer, TFBertForSequenceClassification
Worked with
Tensorflow-2.7.0
huggingface-hub-0.2.1
tokenizers-0.10.3
transformers-4.15.0
Python-3.7
Install Tensorflow and Transformers
!pip install tensorflow
!pip install transformers
I believe you are on MacOS. If so, installing the latest version of transformers (v4.21.1) should fix this issue. (I am also running M1 pro, if that helps).
For me the latest update was giving an error with incompatible checkpoint weight files, so I had to install transformers v4.2.2 which gave me the above error.
To fix it, you need to do an editable install: https://huggingface.co/docs/transformers/installation#installing-from-source
i.e.
git clone https://github.com/huggingface/transformers.git
cd transformers
pip install -e .
Before running the above code, make the following changes:
In transformers/setup.py Line 134, change to "tokenizers==0.6.0"
In transformers/src/transformers/file_utils.py Line 87, change "tensorflow" to "tensorflow-macos"
Finally, in transformers/src/transformers/dependency_versions_check.py comment out Line 41 ("# require_version_core(deps[pkg])"
For the final step, upgrade the tokenizers library to a newer version (say 0.12.1). You cant have the newer tokenizers library before installing the transformers package - it fails to build the wheel.
Reference: https://id2thomas.medium.com/apple-silicon-experiment-1-installing-huggingface-transformers-2e45392d3d0f
https://github.com/apple/tensorflow_macos/issues/144
Transformers requires Tensorflow version >= 2.3
To see the installed Tensorflow version, run the python script below:
import tensorflow as tf
print(tf.__version__)
If tensorflow version is actually too low, you may upgrade it.
For Tensorflow of CPU version,
run the command in a notebook,
!pip install tensorflow>=2.3
or run the command in a command window:
pip install tensorflow>=2.3
For Tensorflow of GPU version,
run the command in a notebook,
!pip install tensorflow-gpu>=2.3
or run the command in a command window,
pip install tensorflow-gpu>=2.3
I'm trying to use TensorFlow as backend yesterday I can use it, but today when I use it to show some error message when I'm trying to import Keras, so here's my code:
# Install required libs
# NOTE: Run this one code, then restart this runtime and run again for next all... (PENTING!!!)
### please update Albumentations to version>=0.3.0 for `Lambda` transform support
!pip install -U segmentation-models
!pip install q tensorflow==2.1
!pip install q keras==2.3.1
!pip install tensorflow-estimator==2.1.
## Imports libs
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import cv2
import Keras
import NumPy as np
import matplotlib.pyplot as plt
it shows this error:
AttributeError Traceback (most recent call last)
<ipython-input-3-9c78a7be919d> in <module>()
5
6 import cv2
----> 7 import keras
8 import numpy as np
9 import matplotlib.pyplot as plt
8 frames
/usr/local/lib/python3.7/dist-packages/keras/initializers/__init__.py in populate_deserializable_objects()
47
48 LOCAL.ALL_OBJECTS = {}
---> 49 LOCAL.GENERATED_WITH_V2 = tf.__internal__.tf2.enabled()
50
51 # Compatibility aliases (need to exist in both V1 and V2).
AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'tf2'
while therefore I was using TensorFlow version 2.2 and Keras version 2.3.1, yesterday I can run, but today it seems can't. did I was the wrong version import for my Keras and TensorFlow for today?
Edit:
when I use from tensorFlow import keras the output I want using tensorflow backend doesn't show up, And then when I load import segmentation_models as sm it shows the same error when I use import Keras like on above.
Here is the solution to your problem, I've tested it on colab.
!pip install -U -q segmentation-models
!pip install -q tensorflow==2.1
!pip install -q keras==2.3.1
!pip install -q tensorflow-estimator==2.1.
## Imports libs
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
os.environ["SM_FRAMEWORK"] = "tf.keras"
from tensorflow import keras
import segmentation_models as sm
|████████████████████████████████| 51kB 3.3MB/s
|████████████████████████████████| 421.8MB 42kB/s
|████████████████████████████████| 450kB 35.7MB/s
|████████████████████████████████| 3.9MB 33.6MB/s
Building wheel for gast (setup.py) ... done
ERROR: tensorflow-probability 0.12.1 has requirement gast>=0.3.2,
but you'll have gast 0.2.2 which is incompatible.
|████████████████████████████████| 378kB 2.1MB/s
Segmentation Models: using `tf.keras` framework.
Update
You don't need to install any specific version of tensorflow / keras. Any version above 2.x would be ok to run, i.e tf 2.4/ 2.5/ 2.6. However, in colab, you need to restart the kernel to see the effect. but if you run on the kaggle kernel, you don't need to restart the kernel. See below:
In colab:
# Cell: 1
import os
!pip install -U -q segmentation-models --user
os.kill(os.getpid(), 9)
It will auto-restart the kernel. After restarting, run the following code in the new cell.
#Cell: 2
import os
os.environ["SM_FRAMEWORK"] = "tf.keras"
import segmentation_models as sm
In Kaggle Kernel:
import os
!pip install -U -q segmentation-models --user
os.environ["SM_FRAMEWORK"] = "tf.keras"
import segmentation_models as sm
specifying below, before importing segmentation models, alone worked for me in colab
os.environ["SM_FRAMEWORK"] = "tf.keras"
import tensorflow as tf
import keras
print(tf.__version__, keras.__version__)
output: 2.7.0 2.7.0
I tried a lot of answers but none of them worked for me.
The reason of the error: AttributeError: module 'tensorflow.compat.v2.internal.distribute' has no attribute 'strategy_supports_no_merge_call'
in my case was that I had tensorflow 2.7.0 and keras 2.6.0 installed on my device.
output while getting this error: 2.7.0 2.6.0
just match the versions, it worked for me.
I was getting this error message after upgrading Tensorflow to 2.7.0 . Downgrading to 2.5.0 is a temporary working fix.
pip install tensorflow==2.5.0
I'm trying to use TensorFlow as backend yesterday I can use it, but today when I use it to show some error message when I'm trying to import Keras, so here's my code:
# Install required libs
# NOTE: Run this one code, then restart this runtime and run again for next all... (PENTING!!!)
### please update Albumentations to version>=0.3.0 for `Lambda` transform support
!pip install -U segmentation-models
!pip install q tensorflow==2.1
!pip install q keras==2.3.1
!pip install tensorflow-estimator==2.1.
## Imports libs
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import cv2
import Keras
import NumPy as np
import matplotlib.pyplot as plt
it shows this error:
AttributeError Traceback (most recent call last)
<ipython-input-3-9c78a7be919d> in <module>()
5
6 import cv2
----> 7 import keras
8 import numpy as np
9 import matplotlib.pyplot as plt
8 frames
/usr/local/lib/python3.7/dist-packages/keras/initializers/__init__.py in populate_deserializable_objects()
47
48 LOCAL.ALL_OBJECTS = {}
---> 49 LOCAL.GENERATED_WITH_V2 = tf.__internal__.tf2.enabled()
50
51 # Compatibility aliases (need to exist in both V1 and V2).
AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'tf2'
while therefore I was using TensorFlow version 2.2 and Keras version 2.3.1, yesterday I can run, but today it seems can't. did I was the wrong version import for my Keras and TensorFlow for today?
Edit:
when I use from tensorFlow import keras the output I want using tensorflow backend doesn't show up, And then when I load import segmentation_models as sm it shows the same error when I use import Keras like on above.
Here is the solution to your problem, I've tested it on colab.
!pip install -U -q segmentation-models
!pip install -q tensorflow==2.1
!pip install -q keras==2.3.1
!pip install -q tensorflow-estimator==2.1.
## Imports libs
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
os.environ["SM_FRAMEWORK"] = "tf.keras"
from tensorflow import keras
import segmentation_models as sm
|████████████████████████████████| 51kB 3.3MB/s
|████████████████████████████████| 421.8MB 42kB/s
|████████████████████████████████| 450kB 35.7MB/s
|████████████████████████████████| 3.9MB 33.6MB/s
Building wheel for gast (setup.py) ... done
ERROR: tensorflow-probability 0.12.1 has requirement gast>=0.3.2,
but you'll have gast 0.2.2 which is incompatible.
|████████████████████████████████| 378kB 2.1MB/s
Segmentation Models: using `tf.keras` framework.
Update
You don't need to install any specific version of tensorflow / keras. Any version above 2.x would be ok to run, i.e tf 2.4/ 2.5/ 2.6. However, in colab, you need to restart the kernel to see the effect. but if you run on the kaggle kernel, you don't need to restart the kernel. See below:
In colab:
# Cell: 1
import os
!pip install -U -q segmentation-models --user
os.kill(os.getpid(), 9)
It will auto-restart the kernel. After restarting, run the following code in the new cell.
#Cell: 2
import os
os.environ["SM_FRAMEWORK"] = "tf.keras"
import segmentation_models as sm
In Kaggle Kernel:
import os
!pip install -U -q segmentation-models --user
os.environ["SM_FRAMEWORK"] = "tf.keras"
import segmentation_models as sm
specifying below, before importing segmentation models, alone worked for me in colab
os.environ["SM_FRAMEWORK"] = "tf.keras"
import tensorflow as tf
import keras
print(tf.__version__, keras.__version__)
output: 2.7.0 2.7.0
I tried a lot of answers but none of them worked for me.
The reason of the error: AttributeError: module 'tensorflow.compat.v2.internal.distribute' has no attribute 'strategy_supports_no_merge_call'
in my case was that I had tensorflow 2.7.0 and keras 2.6.0 installed on my device.
output while getting this error: 2.7.0 2.6.0
just match the versions, it worked for me.
I was getting this error message after upgrading Tensorflow to 2.7.0 . Downgrading to 2.5.0 is a temporary working fix.
pip install tensorflow==2.5.0
On my system spyder version '0.13.1' is installed and I want to use
from skimage.filters import unsharp_mask
the error comes:
ImportError: cannot import name 'unsharp_mask
then I treid to upgrade the version using:
1st passed;
!pip install scikit-image
then I passed:
!pip install --upgrade scikit-image
then still version is same which is '0.13.1'.
What should I do?
The problem is resloved with the help of Anaconda official video tutorial :
https://anaconda.cloud/tutorials/getting-started-with-anaconda-individual-edition?source=install
I'm trying plot my model on the google colab.
from keras.utils import plot_model
plot_model(model, to_file="model.png")
and I got this error:
ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.
I've installed pydot-ng and graphviz and I'm still can't get through this error.
To install pydot, run:
!pip install -q pydot
Then, restart your VM to reload keras which should then detect pydot's existence. (Runtime menu -> Restart runtime...)