While running the code tf.matrix_band_part , i get the following error
AttributeError: module 'tensorflow' has no attribute 'matrix_band_part'
My tensorflow version : 2.0
Any solution for this problem is needed.
I have found the answer. So i would like to share.
Compatible version for the function for tensorflow 2.0 is
tf.compat.v1.matrix_band_part
Ref : https://www.tensorflow.org/api_docs/python/tf/linalg/band_part
if someone find this issue, just try alternate version: tf.linalg.band_part
Related
When I try to import tensorflow or any sort of deep learning models or libraries, it throws similar errors. Any suggestions on this please
I tried, uninstalling and reinstallin and downgraded but still throws different erors like
AttributeError: module 'this ' has no attribute 'this'
I tried changing log to math.log and downgraded tensorflow version to 1.4 But still got the error.Can someone Please help.Thank you.
AttributeError: in user code:
/content/Mask_RCNN/mrcnn/model.py:390 call *
roi_level = log2_graph(tf.sqrt(h * w) / (224.0 / tf.sqrt(image_area)))
/content/Mask_RCNN/mrcnn/model.py:341 log2_graph *
return tf.log(x) / tf.log(2.0)
AttributeError: module 'tensorflow' has no attribute 'log'
This problem is due to backward-compatibility.
It worked for me using python 3.6 with the following requirements:
numpy<2.0,>=1.16.0
scipy
Pillow
cython
matplotlib
scikit-image>=0.14.2
tensorflow==1.15.3
keras==2.2.4
opencv-python
h5py
imgaug
i'm trying to train a Retinanet on my Dataset with this command line :
retinanet-train --batch-size 4 --steps 349 --epochs 50 --weights logos/resnet50_coco_best_v2.1.0.h5 --snapshot-path logos/snapshots csv logos/retinanet_train.csv logos/retinanet_classes.csv
And I get this Error :
AttributeError: module 'tensorflow' has no attribute 'ConfigProto'
I know that , this is related to the version of Tensorlow , in the new version ConfigProto disappeared , but i want to fix it without 're-installing' the old version the 1.14, cause otherwise it will be a mess.
Any suggestion would be super appreciated , thank you.
Since tf.ConfigProto is deprecated in TF 2.0, use tf.compat.v1.ConfigProto() instead by replacing the occurences of tf.ConfigProto() in the retinanet-train code (assuming that's where tf.ConfigProto() is being called). Link to tensorflow doc here.
Running this example on ML engine using Cloud composer but am receiving the following error:
AttributeError: 'module' object has no attribute 'estimator'
Even though I am importing import tensorflow as tf and it exits on the following line:
estimator = tf.estimator.Estimator(model_fn = image_classifier,
Runtime version is 1.8 similar to the version using the repo.
t3 = MLEngineTrainingOperator(
task_id='ml_engine_training_op',
project_id=PROJECT_ID,
job_id=job_id,
package_uris=["gs://us-central1-ml/trainer-0.1.tar.gz"],
training_python_module=MODULE_NAME,
training_args=training_args,
region=REGION,
scale_tier='BASIC_GPU',
runtimeVersion = '1.8',
dag=dag
)
Please check the setup.py, make sure you put tensorflow in it as
REQUIRED_PACKAGES = ['tensorflow==1.8.0']. or some other version. Then don't forget to re-generate tar and upload.
Also, in my case, MLEngineTrainingOperator doesn't seem to pick runtime_version or python_version at all into ML Engine.
I am using tensorflow version 1.3. But the tutorial that I following is written on the version 1.0 and I am quite new on tensorflow. The problem that I get is:
module' object has no attribute 'prepare_attention
And the code is ;
tf.contrib.seq2seq.prepare_attention(attention_states, attention_option = "bahdanau", num_units = decoder_cell.output_size)
I couldn't figure out what the use instead of tf.contrib.seq2seq.prepare_attention() function. Is there anyone who can help?
Degrade your tensorflow and it'll work. The problem is that prepare_attention is deprecated and hence we use an older version of tf to work with it
Okay, all you need to do is create a new environment with python 3.5.4 and then install tensorflow 1.0.0. That's it. Everything will work fine.
tf.contrib.seq2seq.prepare_attention works only when the TensorFlow version is 1.0, I have version 2.3.1
My solution:
tf.contrib.seq2seq.prepare_attention = tf.compat.v1.nn.rnn_cell.prepare_attention