nesl / physiogan

6 stars 2 forks source link

Error when attempting to install tensorflow versions for Python 3.7 #2

Open JamesTimothyMeech opened 3 years ago

JamesTimothyMeech commented 3 years ago

python3.7 -m pip install -r requirements.txt Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: matplotlib in /Users/james/Library/Python/3.7/lib/python/site-packages (from -r requirements.txt (line 1)) (3.4.1) Requirement already satisfied: scikit-learn in /Users/james/Library/Python/3.7/lib/python/site-packages (from -r requirements.txt (line 2)) (0.24.1) ERROR: Could not find a version that satisfies the requirement tensorflow-gpu==1.14.0 ERROR: No matching distribution found for tensorflow-gpu==1.14.0

JamesTimothyMeech commented 3 years ago

And a presumably related error when attempting to train the classifiers:

Jamess-MacBook-Pro-2:physiogan james$ python3.7 classification_model.py --dataset=har --num_epochs=200 Traceback (most recent call last): File "classification_model.py", line 4, in from data_utils import DataFactory File "/Users/james/Desktop/physiogan/data_utils.py", line 11, in from ecg_dataset import ECGDataset File "/Users/james/Desktop/physiogan/ecg_dataset.py", line 13, in tf.enable_eager_execution() AttributeError: module 'tensorflow' has no attribute 'enable_eager_execution'

malzantot commented 3 years ago

for the first problem, I think this error is because you are running on Mac which doesn't support Tensorflow-GPU. You can install Tensorflow without GPU on MAC but it will much slower. Also I think you may need (need sure) an older version (Python 3.5) to install the older version of tensorflow 1.14.

The second problem is also related: The code was written with Tensorflow 1.14.0. If you want to use TensorFlow 2.0 then code has to be updated.

JamesTimothyMeech commented 3 years ago

Thanks, running with python 3.5 allowed me to train the classifier but now I run into this error when attempting to train the generative model. Am I missing something obvious here?

Jamess-MacBook-Pro-2:physiogan james$ python3.5 crnn_model.py --model_type=crvae --num_epochs=15000 --dataset=har --aux_restore=logs --batch_size=1024 --num_units=128 --z_dim=16 --bidir_encoder=True --z_context=True /Users/james/Library/Python/3.5/lib/python/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) /Users/james/Library/Python/3.5/lib/python/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /Users/james/Library/Python/3.5/lib/python/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) /Users/james/Library/Python/3.5/lib/python/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /Users/james/Library/Python/3.5/lib/python/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) /Users/james/Library/Python/3.5/lib/python/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) /Users/james/Library/Python/3.5/lib/python/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) /Users/james/Library/Python/3.5/lib/python/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /Users/james/Library/Python/3.5/lib/python/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) /Users/james/Library/Python/3.5/lib/python/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /Users/james/Library/Python/3.5/lib/python/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) /Users/james/Library/Python/3.5/lib/python/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) WARNING:tensorflow:From /Users/james/Desktop/physiogan/ecg_dataset.py:13: The name tf.enable_eager_execution is deprecated. Please use tf.compat.v1.enable_eager_execution instead.

WARNING:tensorflow:From /Users/james/Desktop/physiogan/train_utils.py:6: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

(array([0, 1, 2, 3, 4, 5], dtype=int32), array([1226, 1073, 986, 1286, 1374, 1407])) (7352, 32, 6) (array([0, 1, 2, 3, 4, 5], dtype=int32), array([496, 471, 420, 491, 532, 537])) (2947, 32, 6) 2021-04-26 08:48:44.712686: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA WARNING:tensorflow:From crnn_model.py:94: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead.

Aux. classifier Model restored from logs WARNING:tensorflow:From crnn_model.py:125: The name tf.random_normal is deprecated. Please use tf.random.normal instead.

Traceback (most recent call last): File "crnn_model.py", line 130, in labels=fixed_sampling_labels, z=fixed_sampling_z, max_len=metadata.max_len) File "/Users/james/Desktop/physiogan/models.py", line 250, in sample step_input, last_state, labels) File "/Users/james/Desktop/physiogan/models.py", line 158, in call output1, last_state1 = self.gru1(rnn_input, hidden[0]) File "/Users/james/Library/Python/3.5/lib/python/site-packages/tensorflow/python/keras/layers/recurrent.py", line 669, in call return super(RNN, self).call(inputs, **kwargs) File "/Users/james/Library/Python/3.5/lib/python/site-packages/tensorflow/python/keras/engine/base_layer.py", line 676, in call self._maybe_build(inputs) File "/Users/james/Library/Python/3.5/lib/python/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1881, in _maybe_build self.build(input_shapes) File "/Users/james/Library/Python/3.5/lib/python/site-packages/tensorflow/python/keras/layers/recurrent.py", line 550, in build self._validate_state_spec(state_size, self.state_spec) File "/Users/james/Library/Python/3.5/lib/python/site-packages/tensorflow/python/keras/layers/recurrent.py", line 581, in _validate_state_spec raise validation_error ValueError: An initial_state was passed that is not compatible with cell.state_size. Received state_spec=ListWrapper([InputSpec(shape=(18, 128), ndim=2)]); however cell.state_size is [128, 128]