-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_model.py
More file actions
29 lines (24 loc) · 925 Bytes
/
run_model.py
File metadata and controls
29 lines (24 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
""" This script runs an autoencoder model. It parses a .json file
"""
import tensorflow as tf
import argparse
from shutil import copy
import json
from pathlib import Path
from img_common.autoencoder import AutoEnc
def load_config_procedures():
""" Function to read the configurations from the specified config file """
parser = argparse.ArgumentParser()
parser.add_argument('--config_file')
config_file = Path(parser.parse_args().config_file)
with open(config_file, 'r') as config:
json_c = json.load(config)
return json_c, config_file
if __name__ == '__main__':
devices = tf.config.experimental.list_physical_devices('GPU')
list(map(lambda d: tf.config.experimental.set_memory_growth(d, True),
devices))
configs, config_file = load_config_procedures()
autoenc = AutoEnc(configs)
copy(config_file, autoenc.out_folder / config_file.name)
autoenc.run()