Exemple #1
0
def get_checkpoints_directory():
    """Returns checkpoint directory within Luminoth's homedir."""
    # Checkpoint directory, `$LUMI_HOME/checkpoints/`. Create if not present.
    path = os.path.join(get_luminoth_home(), CHECKPOINT_PATH)
    if not os.path.exists(path):
        tf.gfile.MakeDirs(path)
    return path
Exemple #2
0
def save_run(config,
             environment=None,
             comment=None,
             extra_config=None,
             filename=DEFAULT_FILENAME):
    if environment == "cloud":
        # We don't write runs inside Google Cloud, we run it before.
        return

    diff = get_diff()
    lumi_version = get_luminoth_version()
    tf_version = get_tensorflow_version()

    experiment = {
        "environment": environment,
        "datetime": str(datetime.datetime.utcnow()) + "Z",
        "diff": diff,
        "luminoth_version": lumi_version,
        "tensorflow_version": tf_version,
        "config": config,
        "extra_config": extra_config,
    }

    path = get_luminoth_home()
    file_path = os.path.join(path, filename)
    tf.gfile.MakeDirs(path)

    with tf.gfile.Open(file_path, "a") as log:
        log.write(json.dumps(experiment) + "\n")
Exemple #3
0
def save_run(config,
             environment=None,
             comment=None,
             extra_config=None,
             filename=DEFAULT_FILENAME):
    if environment == 'cloud':
        # We don't write runs inside Google Cloud, we run it before.
        return

    diff = get_diff()
    lumi_version = get_luminoth_version()
    tf_version = get_tensorflow_version()

    experiment = {
        'environment': environment,
        'datetime': str(datetime.datetime.utcnow()) + 'Z',
        'diff': diff,
        'luminoth_version': lumi_version,
        'tensorflow_version': tf_version,
        'config': config,
        'extra_config': extra_config,
    }

    path = get_luminoth_home()
    file_path = os.path.join(path, filename)
    tf.gfile.MakeDirs(path)

    with tf.gfile.Open(file_path, 'a') as log:
        log.write(json.dumps(experiment) + '\n')
def get_default_path():
    if 'TF_CONFIG' in os.environ:
        tf_config = json.loads(os.environ['TF_CONFIG'])
        job_dir = tf_config.get('job', {}).get('job_dir')
        if job_dir:
            # Instead of using the job_dir we create a folder inside.
            job_dir = os.path.join(job_dir, 'pretrained_checkpoints/')
            return job_dir

    return get_luminoth_home()
Exemple #5
0
def get_default_path():
    if "TF_CONFIG" in os.environ:
        tf_config = json.loads(os.environ["TF_CONFIG"])
        job_dir = tf_config.get("job", {}).get("job_dir")
        if job_dir:
            # Instead of using the job_dir we create a folder inside.
            job_dir = os.path.join(job_dir, "pretrained_checkpoints/")
            return job_dir

    return get_luminoth_home()