Skip to content

Commit

Permalink
Switch to tf.io.gfile for validating vocabulary files.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 380901988
  • Loading branch information
tensorflower-gardener committed Jun 22, 2021
1 parent 1abd9a1 commit efdd9a9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions keras/layers/preprocessing/index_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit efdd9a9

Please sign in to comment.