Which seeds have to be set where to realize 100% reproducibility of training results in tensorflow?

前端 未结 2 1003
暗喜
暗喜 2020-11-29 12:17

In a general tensorflow setup like

model = construct_model()
with tf.Session() as sess:
    train_model(sess)

Where construct_model()

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-29 13:07

    The best solution which works as of today with GPU is to install tensorflow-determinism with the following:

    pip install tensorflow-determinism
    

    Then include the following code to your code

    import tensorflow as tf
    import os
    os.environ['TF_DETERMINISTIC_OPS'] = '1'
    
    

    source: https://github.com/NVIDIA/tensorflow-determinism

提交回复
热议问题