From efdd9a9a2c76451d01f5aefbe692f11413ec31bb Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 22 Jun 2021 15:09:09 -0700 Subject: [PATCH] Switch to tf.io.gfile for validating vocabulary files. PiperOrigin-RevId: 380901988 --- keras/layers/preprocessing/index_lookup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/keras/layers/preprocessing/index_lookup.py b/keras/layers/preprocessing/index_lookup.py index caa0188c4ceb..1bcff31bd81b 100644 --- a/keras/layers/preprocessing/index_lookup.py +++ b/keras/layers/preprocessing/index_lookup.py @@ -17,7 +17,6 @@ # pylint: disable=g-classes-have-attributes import collections -import os from keras import backend from keras.engine import base_layer_utils @@ -372,7 +371,7 @@ def set_vocabulary(self, vocabulary, idf_weights=None): "TF_IDF. output_mode is {}.".format(self.output_mode)) if isinstance(vocabulary, str): - if not os.path.exists(vocabulary): + if not tf.io.gfile.exists(vocabulary): raise ValueError( "Vocabulary file {} does not exist.".format(vocabulary)) if self.output_mode == TF_IDF: