I was running transformer[link] code in my jupyter notebook by looking at the google collab code. The tfds.load was able to load ted_hrlr_translate/pt_to_en dataset in collab but was unable in jupyter notebook. The error that hit the screen was :
Failed to construct dataset ted_hrlr_translate: Message type
"tensorflow_datasets.DatasetInfo" has no field named "releaseNotes".
Available Fields(except extensions): ['name', 'description',
'version', 'configName', 'configDescription', 'citation',
'sizeInBytes', 'downloadSize', 'location', 'downloadChecksums',
'schema', 'splits', 'supervisedKeys', 'redistributionInfo',
'moduleName', 'disableShuffling', 'fileFormat']
Is this a bug or I am too dumb to understand the error?
Do I need to download the dataset? If so then i was able to load mnist data in jupyter notebook without downloading it.
This did not show any error to me when I tried to import this dataset using same line of code in jupyter notebook with TensorFlow 2.7. However please let us know which TensorFlow version are you using to replicate the issue into the same.
Meanwhile, you can try with installing below packages before of importing datasets in jupyter notebook.
#For the stable version, released every few months.
!pip install tensorflow-datasets
#Released every day, contains the last versions of the datasets.
!pip install tfds-nightly
Related
I am trying to play around with a custom object detection model that builds of a pretrained model. All I want is for my model is to detect a specific logo in a picture. The problem is, the guide that I am following is having problems with the libraries.
import tensorflow as tf
from imageai.Detection.Custom import DetectionModelTrainer
trainer = DetectionModelTrainer()
trainer.setModelTypeAsYOLOv3()
trainer.setDataDirectory(data_directory="/content/drive/MyDrive/Logo_Model2/")
trainer.setTrainConfig(object_names_array=["logo"], batch_size=4, num_experiments=122, train_from_pretrained_model="/content/drive/MyDrive/pretrained-yolov3.h5")
trainer.trainModel()
My error is coming when I import imageai.Detection.Custom import DetectionModelTrainer. I am doing this on google colab and I checked the versions and they seem to be all up to date.
ModuleNotFoundError: No module named 'tensorflow.keras'
Any ideas? I have looked around stack for similar problems yet I haven't been able to resolve my issue. It doesn't seem to be a tensorflow problem since I am able to build my models just fine until I add imageai.
Seems to be an issue with the latest tensorflow==2.8.0. git issue
For now, you can revert back to the older version of tensorflow
pip install tensorflow==2.7
And upgrade imageAI :
pip install imageai --upgrade
I tried running this command but i get erros that i dont have tenserflow 2.2 or higher. But I checked and I have the correct version of tenserflow. I also did pip3 install keras command
I know for a fact that all of the code is correct because it worked for my teacher the other day and nothing has changed. I just need to run his commands but i keep running into problems
I am doing this course following everything he does in a recorded video so there must be no issue there but for some reason it just doesn't work
just install tensorflow as requested in the last line of the error message: pip install tensorflow. It is needed as backend for Keras.
Also, since keras is part of tensorflow now, I recommend to write imports as from tensorflow.keras.[submodule name] import instead of from keras.[submodule name] import
I am trying to convert .onnx model to .pb format by using onnx-tf package, however, after invoking onnx_tf.backend.prepare function, the python kernel crashes. I am using the code below:
import onnx
from onnx_tf.backend import prepare
import tensorflow
onnx_model = onnx.load(<path-to-model>) # load onnx model
tf_rep = prepare(onnx_model) # <------ That's where python crashes
tf_rep.export_graph(<output-path>) # export the model
I have double-checked package version dependencies, as wrong dependencies caused different errors while loading the .onnx model, and those are as follows:
onnx==1.7.0
onnx-tf==1.6.0
tensorflow==2.2.0
tensorflow-addons==0.10.0
torch==1.6.0+cu101
However, the dependencies seem to be correct, according to Github pages.
There were large changes between ONNX 1.6 and 1.7 that caused many dependency issues. Try with Onnx 1.6, which may be the source of your issue. Where did you find 1.7 mentioned as the required version?
Additionally, you mention the Python kernel crashing? Are you running in a Jupyter notebook?
I've found this package to be a lot more unstable in Juypter notebook, and not print out all of the relevant errors. If you could test your system in a standalone Python script you may get more information.
Importing onnx and onnx-tf related libraries before tf and pytorch should help. The problem is probably caused by a version clash since both onnx and onnx-tf use tf.
Can you install onnx-tf of this commit 7d8fa7d88fab469253d75e5e11cf9cdcb90104c4
Between order of imports and this commit the issue was solved for me
When I try to run code using keras and numpy or keras and Matplotlib in one Jupyter notebook I always get the message: The kernel appears to have died. It will restart automatically.
When I run the code in two different notebooks it works perfectly fine. I have installed it using anaconda and I am using macOS. I would really appreciate an answer, everything else I've found and tried so far did not work. Thank you!
I have been trying to get the classification report in the form of a dictionary.
So according to the scikit-learn 0.20 documentation, I do:
from sklearn import metrics
rep = metrics.classification_report(y_true, y_pred, output_dict=True)
But get an error saying
TypeError: classification_report() got an unexpected keyword argument 'output_dict'
The scikit-learn module in my machine was initially 0.19.1 but even after updating it to 0.20, the same error message shows.
This error should not show up as long as you have scikit-learn 0.20.0 installed. If you are trying this in a jupyter notebook, make sure the correct version reflects in your notebook using:
import sklearn
print(sklearn.__version__)
If you've upgraded scikit-learn but jupyter shows the wrong version of the package, make sure jupyter is installed in your current environment (and restart jupyter in a new terminal).