Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

questions about AttributeError: 'threadsafe_iter' object has no attribute 'shape' #16

Open
Yuanzhisheng opened this issue Feb 13, 2020 · 5 comments

Comments

@Yuanzhisheng
Copy link

I have a problem when I try to run the code:
Traceback (most recent call last):
File "EPINET_train.py", line 278, in
initial_epoch=iter00, verbose=1,workers=1)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/engine/training.py", line 1426, in fit_generator
initial_epoch=initial_epoch)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/engine/training_generator.py", line 115, in model_iteration
shuffle=shuffle)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/engine/training_generator.py", line 377, in convert_to_generator_like
num_samples = int(nest.flatten(data)[0].shape[0])
AttributeError: 'threadsafe_iter' object has no attribute 'shape'

Anyone may give me some suggestions about it?
Thanks a lot !!

@Cimino023
Copy link

I have the same problem, did someone fix this already?

@Cimino023
Copy link

This worked for me: update tensorflow, then change in func_epinetmodel.py

from tensorflow.contrib.keras.api.keras.optimizers import RMSprop
from tensorflow.python.keras.utils.data_utils import Sequence
from tensorflow.contrib.keras.api.keras.models import Model, Sequential
from tensorflow.contrib.keras.api.keras.layers import Input , Activation
from tensorflow.contrib.keras.api.keras.layers import Conv2D, Reshape
from tensorflow.contrib.keras.api.keras.layers import Dropout,BatchNormalization
from tensorflow.contrib.keras.api.keras.layers import concatenate

into

from keras.optimizers import RMSprop
from keras.utils.data_utils import Sequence
from keras.models import Model, Sequential
from keras.layers import Input , Activation
from keras.layers import Conv2D, Reshape
from keras.layers import Dropout,BatchNormalization
from keras.layers import concatenate

@Vishwanathts01
Copy link

This worked for me: update TensorFlow, then change in func_epinetmodel.py

from tensorflow.contrib.keras.api.keras.optimizers import RMSprop
from tensorflow.python.keras.utils.data_utils import Sequence
from tensorflow.contrib.keras.api.keras.models import Model, Sequential
from tensorflow.contrib.keras.api.keras.layers import Input , Activation
from tensorflow.contrib.keras.api.keras.layers import Conv2D, Reshape
from tensorflow.contrib.keras.api.keras.layers import Dropout,BatchNormalization
from tensorflow.contrib.keras.api.keras.layers import concatenate

into

from keras.optimizers import RMSprop
from keras.utils.data_utils import Sequence
from keras.models import Model, Sequential
from keras.layers import Input , Activation
from keras.layers import Conv2D, Reshape
from keras.layers import Dropout,BatchNormalization
from keras.layers import concatenate

Yes, I've tried changing it. But, I am still facing the same problem.
Could you please help me in fixing this problem?

@chaowentao
Copy link

I fixed the problem. downgrade the tensorflow-gpu=1.10. You can try it.

conda install tensorflow-gpu=1.10

@Liaowan
Copy link

Liaowan commented Jan 21, 2022

I installed tensorflow-gpu=1.10 to run this code,but apendented a error showing that 'version_info' object has no attribute 'version' when i install matplotlib,another problem is my memory is not enough. can you help me solve both question,thinks very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants