Posts

Post not yet marked as solved
1 Replies
243 Views
Dear developers, I am encountering a bug when using TensorFlow-Metal. When I do the following: random_1 = tf.random.Generator.from_seed(42) random_1 = random_1.normal(shape=(3,2)) random_1 I got the following error: NotFoundError: No registered 'RngReadAndSkip' OpKernel for 'GPU' devices compatible with node {{node RngReadAndSkip}} . Registered: device='CPU' [Op:RngReadAndSkip] But it works fine when creating random tensors with cpu like the following: with tf.device('/cpu:0'):     random_1 = tf.random.Generator.from_seed(42)     random_1 = random_1.normal(shape=(3,2))  random_1
Posted
by Leozz99.
Last updated
.
Post not yet marked as solved
5 Replies
338 Views
I am noticing huge memory usage with TensorFlow. The memory usage will keep on increasing up to 36GB of memory usage only after one epoch. The following is the dataset preprocessing process: with tf.device('CPU: 0'): data_augmentation = keras.Sequential([ keras.layers.experimental.preprocessing.RandomFlip("horizontal"), keras.layers.experimental.preprocessing.RandomRotation(0.2), keras.layers.experimental.preprocessing.RandomHeight(0.2), keras.layers.experimental.preprocessing.RandomWidth(0.2), keras.layers.experimental.preprocessing.RandomZoom(0.2), ], name="data_augmentation") train_data = train_data.map(map_func=lambda x, y: (data_augmentation(x), y), num_parallel_calls=tf.data.AUTOTUNE).prefetch(buffer_size=tf.data.AUTOTUNE) test_data = test_data.prefetch(buffer_size=tf.data.AUTOTUNE) And the following is the model I used base_model = keras.applications.EfficientNetB0(include_top=False) base_model.trainable = False inputs = keras.layers.Input(shape=(224, 224, 3), name='input_layer') x = base_model(inputs, training=False) x = keras.layers.GlobalAveragePooling2D(name='global_average_pooling')(x) outputs = keras.layers.Dense(101, activation='softmax', name='output_layer')(x) model = keras.Model(inputs, outputs) # Compile model.compile(loss="categorical_crossentropy", optimizer=tf.keras.optimizers.Adam(), # use Adam with default settings metrics=["accuracy"]) from tqdm.keras import TqdmCallback tqdm_callback = TqdmCallback() # Fit history_all_classes_10_percent = model.fit(train_data, verbose=0, epochs=5, validation_data=test_data, validation_steps=int(0.15 * len(test_data)), callbacks=[checkpoint_callback, tqdm_callback]) # save best model weights to file
Posted
by Leozz99.
Last updated
.