chshin10/epinet

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

Yuanzhisheng opened this issue · 5 comments

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 !!

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

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

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?

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

conda install tensorflow-gpu=1.10

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.