Startonix / Modular-AI

Advanced AI Training and Building Repository
0 stars 0 forks source link

TPU Configuration #135

Open Startonix opened 1 month ago

Startonix commented 1 month ago

tpu_configuration.py

import tensorflow as tf

resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu='grpc://') tf.config.experimental_connect_to_cluster(resolver) tf.tpu.experimental.initialize_tpu_system(resolver)

strategy = tf.distribute.TPUStrategy(resolver) with strategy.scope(): model = tf.keras.models.load_model('path/to/model.h5')