-
Notifications
You must be signed in to change notification settings - Fork 0
/
export_candidates.py
24 lines (19 loc) · 910 Bytes
/
export_candidates.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from marketbasket.settings import settings # Setup. Must to be first
from marketbasket.model.model import create_model
from marketbasket.labels import Labels
from datetime import datetime
from marketbasket.predict import Prediction
import tensorflow as tf
def export_model(rating_model: bool):
settings.features.load_label_files()
model = create_model(rating_model)
# Load weights from last train checkpoint
latest_cp = tf.train.latest_checkpoint( settings.get_model_path(rating_model, Prediction.CHECKPOINTS_DIR) )
model.load_weights(latest_cp)
model.summary()
# Save full model
model.save( settings.get_model_path(rating_model, Prediction.EXPORTED_MODEL_DIR), include_optimizer=False )
if __name__ == "__main__":
print(datetime.now(), "Process start: Export candidates model")
export_model(False)
print(datetime.now(), "Process end: Export candidates model")