Skip to content

Commit 39f4e42

Browse files
Fix to match the tf.gfile API change in tf2.0.
PiperOrigin-RevId: 288042402
1 parent 62bf6fc commit 39f4e42

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

official/nlp/xlnet/xlnet_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def init_from_flags(self, flags):
102102
setattr(self, key, getattr(flags, key))
103103

104104
def init_from_json(self, json_path):
105-
with tf.gfile.Open(json_path) as f:
105+
with tf.io.gfile.GFile(json_path) as f:
106106
json_data = json.load(f)
107107
self.init_from_dict(json_data)
108108

@@ -113,9 +113,9 @@ def to_json(self, json_path):
113113
json_data[key] = getattr(self, key)
114114

115115
json_dir = os.path.dirname(json_path)
116-
if not tf.gfile.Exists(json_dir):
117-
tf.gfile.MakeDirs(json_dir)
118-
with tf.gfile.Open(json_path, 'w') as f:
116+
if not tf.io.gfile.exists(json_dir):
117+
tf.io.gfile.makedirs(json_dir)
118+
with tf.io.gfile.GFile(json_path, 'w') as f:
119119
json.dump(json_data, f, indent=4, sort_keys=True)
120120

121121

0 commit comments

Comments
 (0)