AttributeError: module 'numpy' has no attribute 'object' - object

AttributeError: module 'numpy' has no attribute 'object'
enter image description here
I tried reinstall numpy, and importing numpy with path

numpy.object was deprecated in version 1.20.0. You can use np.object_ instead.
From your screenshot, it looks like it is tensorflow which is referencing np.object; in this case you should either update tensorflow to a newer version that is compatible with numpy 1.20, or downgrade numpy to version 1.19 or older so it works with your tensorflow installation.

Related

AttributeError: module 'flax' has no attribute 'optim'

My code is as follows:
!pip install flax
init_params = TransporterNets().init(key, init_img, init_text, init_pix)['params']
print(f'Model parameters: {n_params(init_params):,}')
optim = flax.optim.Adam(lr=1e-4).create(init_params)
However it shows the following error:
AttributeError: module 'flax' has no attribute 'optim'
Even though I have seen documentation of optim attribute in flax module. How to fix it?
You can temporarily solve the issue by downgrading flax version from 0.6.0 to 0.5.1 at the moment.
pip install flax==0.5.1

AttributeError: module 'dill._dill' has no attribute 'stack'

Use this colab
https://colab.research.google.com/drive/12LjJazBl7Gam0XBPy_y0CTOJZeZ34c2v?usp=sharing
my CUDA Version: 11.2
when do this
train_dataset = train_dataset.map(
process_data_to_model_inputs,
batched=True,
batch_size=batch_size,
remove_columns=["article", "abstract", "section_names"],
)
AttributeError: module 'dill._dill' has no attribute 'stack'
I have try this
pip install dill==0.3.4
but not work
How to solve this problems, Thinks!
I'm the dill author. dill._dill.stack is not part of the public interface, and can't be guaranteed to be there. It was removed in 0.3.5 (and above). It is available in 0.3.4. If you have already installed 0.3.5.1 or something larger than 0.3.4, you will need to pip uninstall or force-reinstall the specific package version.
See: Installing specific package version with pip

module 'torch' has no attribute 'linalg'

I am getting this error AttributeError: module 'torch' has no attribute 'linalg' when updating the parameters using optimizer.step(model.closure).
I am using Pytorch version 1.4.0.
linalg was introduced to pytorch only on a later version (1.7.0). Update pytorch and try again.

Error: Module 'tensorflow' has no attribute 'gfile' error while running tensorflow object detection api tutorial

I am trying to use the object detection tutorial from tensor flow api. I am using python 3 and tensor flow version 2. But getting the below error.I tried several ways:
File "C:\Aniruddhya\object_detection\object_detection\utils\label_map_util.py", line 137, in load_labelmap
with tf.gfile.GFile(path, 'r') as fid:
AttributeError: module 'tensorflow' has no attribute 'gfile'
can someone help me to run this?
code link: https://drive.google.com/drive/u/3/folders/1XHpnr5rsENzOOSzoWNTvRqhEbLKXaenL
It's not called that in TensorFlow 2. You might be using a TensorFlow 1 tutorial.
Version 1
tf.gfile.GFile
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/io/gfile/GFile
Version 2
tf.io.gfile.GFile
https://www.tensorflow.org/api_docs/python/tf/io/gfile/GFile
If you have Tensorflow version 2. You can use the next module compatible with the version 1, too.
import tensorflow.compat.v1 as tf
I solved this problem by reinstalling tensor using the previous version: sudo pip3 install tensorflow==1.14.0
You may optionally downgrade to previous version of tensorflow:
!pip install tensorflow==1.12.0
import tensorflow as tf
print(tf.__version__)
otherwise , make if tf.io.gfile and import tf.io

AttributeError: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'LinearRegressor'

import tensorflow as tf
import numpy as np
feature_columns = [tf.feature_column.numeric_column("x", shape=[1])]
estimator = tf.estimator.LinearRegressor(feature_columns=feature_columns)
My code is above.
Then it shows the error
"AttributeError: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'LinearRegressor'"
Python 3.5.2
Might be you are using older tensorflow version, as tf.estimator.LinearRegressor included with tensorflow=1.3.0.
upgrade your tensorflow installation
pip install --upgrade tensorflow==1.3.0

Resources