Skip to content

Commit 17155b4

Browse files
aichendoubletensorflower-gardener
authored andcommitted
Avoid loading hub model twice
PiperOrigin-RevId: 338249187
1 parent 7cffe10 commit 17155b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

official/nlp/tasks/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def get_encoder_from_hub(hub_model_path: str) -> tf.keras.Model:
4949
# as input and returns a dict.
5050
# TODO(chendouble): Remove the support of legacy hub model when the new ones
5151
# are released.
52-
hub_model = hub.load(hub_model_path)
53-
hub_output_signature = hub_model.signatures['serving_default'].outputs
52+
hub_output_signature = hub_layer.resolved_object.signatures[
53+
'serving_default'].outputs
5454
if len(hub_output_signature) == 2:
5555
logging.info('Use the legacy hub module with list as input/output.')
5656
pooled_output, sequence_output = hub_layer(

0 commit comments

Comments
 (0)