Skip to content

Commit b41f636

Browse files
authored
get most recent saved model to export (#58)
1 parent 89d4cd9 commit b41f636

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/tf_container/serve.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2-
#
2+
#
33
# Licensed under the Apache License, Version 2.0 (the "License").
44
# You may not use this file except in compliance with the License.
55
# A copy of the License is located at
6-
#
6+
#
77
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# or in the "license" file accompanying this file. This file is distributed
10-
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11-
# express or implied. See the License for the specific language governing
8+
#
9+
# or in the "license" file accompanying this file. This file is distributed
10+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
# express or implied. See the License for the specific language governing
1212
# permissions and limitations under the License.
1313

1414
import json
@@ -50,8 +50,8 @@ def export_saved_model(checkpoint_dir, model_path, s3=boto3.client('s3')):
5050
except KeyError as e:
5151
logger.error("Failed to download saved model. File does not exist in {}".format(checkpoint_dir))
5252
raise e
53-
54-
saved_model_path = saved_model_path_array[0]
53+
# Select most recent saved_model.pb
54+
saved_model_path = saved_model_path_array[-1]
5555

5656
variables_path = [x['Key'] for x in contents if 'variables/variables' in x['Key']]
5757
variable_names_to_paths = {v.split('/').pop(): v for v in variables_path}

0 commit comments

Comments
 (0)