Why TF waiting a lot of time before start work?

Hi, everyone!

I need help with strange behaveor of TF. Before start training network program waiting 20 minutes. During of tthis pouse programm use only 20% CPU, without GPU. How to fix it?

input_train, output_train, input_test, output_test = DataManager.GetDataSet(10, 2, 10000, 3, True)

model = Sequential([
    keras.layers.Conv1D(input_shape=(30000, 1), filters = 64, kernel_size = 50, strides=10, padding='same', activation='relu'),
    keras.layers.MaxPool1D(pool_size=10,strides=3),
    keras.layers.Conv1D(filters = 128, kernel_size = 50, strides=10, padding='same', activation='relu'),
    keras.layers.MaxPool1D(pool_size=10,strides=10),
    keras.layers.Flatten(),
    keras.layers.Dense(128, activation="relu"),
    keras.layers.Dense(1, activation="softmax")
])

model.compile(
    optimizer='adam',
    loss='sparse_categorical_crossentropy',
    metrics=['accuracy']
)

model.fit(input_train, output_train, epochs=5)
model.evaluate(input_test, output_test)

Hi @Andreno

Welcome to the TensorFlow Forum!

The issue can be in the first line of your provided code that how big the dataset is and how you are accessing and loading the dataset into memory for performing model training which could cause more time consumption.

You can try alternative methods of fetching dataset and data preprocessing for efficient computation and model training.

Please refer to this turtorial how you can configure the dataset for better performance or can use tf.data for optimized memory utilisation… Thank you