代码拉取完成,页面将自动刷新
import tensorflow as tf
gpus = tf.config.experimental.list_physical_devices('GPU')
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
if gpus:
try:
# Currently, memory growth needs to be the same across GPUs
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
logical_gpus = tf.config.experimental.list_logical_devices('GPU')
print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs")
except RuntimeError as e:
# Memory growth must be set before GPUs have been initialized
print("MESSAGE", e)
from models.example_model import ActorModel, IsingModel
from algorithms.example_trainer import POTrainer
from utils.config import process_config
from utils.utils import get_args
def main():
# capture the config path from the run arguments
# then process the json configuration file
config = process_config(get_args())
# create an instance of the model you want
actor = ActorModel(config)
# create your data generator§
env = IsingModel(config)
# create tensorboard logger
# logger = Logger(config)
# create trainer and pass all the previous components to it
trainer = POTrainer(actor, env, config)
#load model if exists
# model.load(sess)
# here you train your model
trainer.train()
if __name__ == '__main__':
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。