When I run my code on Colab and on my machine using the CPU the accuracy of the network improves but when running the same code using PlaidML the accuracy never improves.
My requirements.txt file is as follows:
scikit-learn
scikit-image
matplotlib
seaborn
ipython
jupyter
scipy
numpy
pandas
pillow
pydot
coremltools==3.0
plaidml==0.6.4
plaidbench==0.6.4
keras==2.2.4
tensorflow==1.14
My imports are as follows:
import os
os.environ["KERAS_BACKEND"] = "plaidml.keras.backend"
import keras
import numpy as np
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import *
from keras import optimizers, callbacks
%matplotlib inline
import matplotlib.pyplot as plt
from keras.applications.mobilenet import MobileNet
There must be an issue with my requirements or my imports.
I am trying to use a pre-trained model in Tensorflow. I am using the following code:
import tensorflow as tf
from tensorflow import keras
from keras.applications import mobilenet_v2
I get the following error:
ModuleNotFoundError: No module named 'keras'
However, the following codes do work:
from tensorflow.keras.applications import mobilenet_v2
OR
from keras_applications import mobilenet_v2
The 2 methods mentioned above work but the 1st one doesn't. Why does this happen?
I've solved this problem by downgrading tensorflow to version 2.0 using this command:
pip install tensorflow==2.0
I hope it helps you.
I am trying to load a Dataset from Tensorflow Datasets API, but it doesn't work.
The error is the following:
AttributeError: module 'tensorflow._api.v2.compat.v2.compat' has no attribute 'v1'
I have no idea what the cause could be, anyone any ideas?
Tensorflow Version: 2.0.0-beta1
tfds Version: 2.0.0
Thanks in advance
import tensorflow as tf
import tensorflow_datasets as tfds
dataset, metadata = tfds.load(name="cycle_gan/horse2zebra", with_info=True, as_supervised=True)
I am developing a fairly big model and I need to use tf.RunOptions or other debuggers to slim a little my code because I'm getting OOM errors with really small batch sizes. But I get a segfault after using tf.RunOptions.
I don't believe it's a model problem, because also the following code will give problems (while the same code without the runopt is working):
import tensorflow as tf
import tensorflow.keras.models as mm
import tensorflow.keras.layers as ll
import numpy as np
model = mm.Sequential([
ll.Dense(27,input_shape=(1,)),
ll.Activation('relu'),
ll.Dense(27),
ll.Activation('softmax')
])
runopt = tf.RunOptions(report_tensor_allocations_upon_oom = True)
model.compile(optimizer='sgd',
loss='mean_squared_error',
metrics=['accuracy'],
options=runopt)
a = np.zeros(27)*10
model.fit(a,a,epochs=10)
Got the same error on Linux 18.04 (tensorflow-gpu installed with pip, tf version 1.13.1, python version 3.6.7, CUDA 9.1.85, GeForce GTX 980 4GB) and on macOS 10.12.6 (tensorflow-cpu installed with pip, tf version 1.13.1, python version 3.7.2)
To use tf.RunOptions, you have to use also tf.RunMetadata()!
This fixed this issue:
import tensorflow as tf
import tensorflow.keras.models as mm
import tensorflow.keras.layers as ll
import numpy as np
model = mm.Sequential([
ll.Dense(27,input_shape=(1,)),
ll.Activation('relu'),
ll.Dense(27),
ll.Activation('softmax')
])
runopt = tf.RunOptions(report_tensor_allocations_upon_oom = True)
runmeta = tf.RunMetadata()
model.compile(optimizer='sgd',
loss='mean_squared_error',
metrics=['accuracy'],
options=runopt,
run_metadata=runmeta)
i tried this code
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense
import tensorflow as tf
mnist = tf.keras.datasets.mnist
print("gud to go")
(training, newtraining)= mnist.load_data()
and this error showed
https://hastebin.com/eridajexev.sql
i have tried upgrading it and tensorflow but it shows error ,may be post how to do that ,that may work
help please?
edit:
im using version 1.9.0 of tensorflow
edit2 :
i used pip3 install --upgrade tensorflow==1.10.0 and still no and note that ,im using python3