Skip to content
This repository was archived by the owner on Oct 2, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bit_tf2/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
import bit_tf2.models as models
import input_pipeline_tf2_or_jax as input_pipeline

# set_memory_growth=True to prevent OOM error
gpu = tf.config.experimental.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(gpu[0], True)


def reshape_for_keras(features, batch_size, crop_size):
features["image"] = tf.reshape(features["image"], (batch_size, crop_size, crop_size, 3))
Expand Down Expand Up @@ -140,7 +144,7 @@ def main(args):

for epoch, accu in enumerate(history.history['val_accuracy']):
logger.info(
f'Step: {epoch * args.eval_every}, '
f'Step: {epoch * steps_per_epoch}, '
f'Test accuracy: {accu:0.3f}')


Expand Down