I just imported the tensorflow module, can anyone tell me why this message keeps coming up on my console every time I run my program and how I can get rid of it?
EDIT: I found that using
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
before
import tensorflow
helped clear my console.
Related
I am a beginner who just learned about TensorFlow using Google Colab.
As in the attached image file, numbers 10 to 13 are underlined in tensorflow.keras~, what is the problem?
It's probably a function that indicates a typo, but there's nothing wrong with running it.
enter image description here
This underline error was an ongoing issue earlier in Google Colab, which is resolved now. Please try again replicating the same code in Google colab what you mentioned in the screen shot and let us know if the issue still persists at your end.
Please check the code below: (I replicated the same in Google Colab with python 3.8.10 and TensorFlow 2.9.2)
from keras.preprocessing import Sequence will show the error as you are not giving proper alias to import the Sequence API which is provided correctly in next line (using tensorflow.keras.preprocessing prefix or tensorflow.keras.utils).
I have installed pycharm , anaconda and python and trying to import numpy.I have changed the interpeter(system interpeter path to anaconda3/python.exe) path and have succesfully installed numpy (at least according to pycharm) and use the "import numpy as np" code to import it but for some reason numpy doesnt seem to work. When I try to create a 2d array , I get an error about how a list must be indices or slices and not tuple.I am pretty sure this means that numpy isn't actually imported. I would appreciate if you guys tell me what I am doing wrong because this is really frustrating me.
Thanks in advance for your answers.
Your session crashed for an unknown reason
when I run the following cell in Google Colab:
from keras import backend as K
if 'tensorflow' == K.backend():
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
config.gpu_options.visible_device_list = "0"
set_session(tf.Session(config=config))
I receive this message since I have uploaded two data sets to google drive.
Does anyone know this message and can give me some advice?
Many thanks for every hint.
Update:
I always receive the message
Update
I have removed the data sets from Google Drive, but the session is still crashing.
Google Colab is crashing because you are trying to Run Code related to GPU with Runtime as CPU.
The execution is successful if you change the Runtime as GPU. Steps for the same are mentioned below:
Runtime -> Change Runtime -> GPU (Select from dropdown).
Please find the Working code in Github Gist.
Just a side note: sometimes you may want to reinstall an litle older version of the related module (see from the error log). It works for me in a case.
This error happens when the expected device and the actual device are different.
For example, if you run the code that is written with torch_xla, which is for TPU training, on the GPU (cuda) then the Colab will return you this error.
It is really tricky since it does not give you an actual debugging message, etc, which makes you hard to find what is the actual problem.
I use Google colab (python3 GPU)
I want to run for example this repo codes but I have an error when running demo ipynb in these lines:
import tensorflow as tf
from layers import (_causal_linear, _output_linear, conv1d, dilated_conv1d)
When I run these two lines I have an error "no module layer"
I don't think this is a bug or something, because this repo has over 1000 stars.
I think this is rather a tf version problem.
Any ideas how to solve this?
"Layers" is a module in the package that you linked NOT in Tensorflow. See here.
BTW if you wanted to import from a submodule of tensor flow you would have to do from tensorflow.package import ....
I'm learning an article called "Attention is all you need", and I'm Trying to learn the code (of the official article from github), and I'm getting weird error, the error is:
"AttributeError: module 'tensorflow.python.layers.layers' has no attribute 'Layer'"
The code generating the error:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
class Attention(tf.layers.Layer)://this is the line the generating the error
Now this is weird because when checking online, all the solutions were version problem of tensorflow, and I have a sufficient version (by the answers online) 1.7.0, Also my python version is 3.6.4.
One more thing is it normal that in the error description it's written:"tensorflow.python.layers.layers" and not just "tensorflow.layers"?
Thanks a lot for your help.
So I faced the same error but discovered that my version of tensorflow (which
is 2.0) moved layers from the tf package (tf.layers) to tf.keras.
An easy fix would be to replace tf.layers with tf.keras.layers
From: https://www.tensorflow.org/api_docs/python/tf/layers/Layer
tf.layers.Layer is considered legacy, and we recommend the use
of tf.keras.layers.Layer instead
After this you may get another error regarding Keras since tensorflow needs to be version > 1.4 so update tf like so:
pip install --upgrade tensorflow