From 10f596c91f12052b7b9ac005155ef0ce0915bebd Mon Sep 17 00:00:00 2001 From: MoFHeka Date: Fri, 15 Dec 2023 00:27:47 +0800 Subject: [PATCH] [fix] Unable to load KV files in FileSystem Saver when using name_scope, such as optimizer variable. --- .../python/ops/dynamic_embedding_variable.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tensorflow_recommenders_addons/dynamic_embedding/python/ops/dynamic_embedding_variable.py b/tensorflow_recommenders_addons/dynamic_embedding/python/ops/dynamic_embedding_variable.py index b299de79a..3080ba6a7 100644 --- a/tensorflow_recommenders_addons/dynamic_embedding/python/ops/dynamic_embedding_variable.py +++ b/tensorflow_recommenders_addons/dynamic_embedding/python/ops/dynamic_embedding_variable.py @@ -174,8 +174,10 @@ def _list_de_variable_saved_files_from_file_system(de_variable_name, else: keys_pattern = '_mht_*of*_rank*_size{}-keys'.format(proc_size) values_pattern = '_mht_*of*_rank*_size{}-values'.format(proc_size) + de_variable_saveable_name = string_ops.regex_replace(de_variable_name, "/", + "_") _shard_name_base_dir = string_ops.string_join( - [de_variable_folder_path, de_variable_name], separator='/') + [de_variable_folder_path, de_variable_saveable_name], separator='/') _shard_name_keys_pattern = string_ops.string_join( [_shard_name_base_dir, keys_pattern], separator='') shard_keys_file_list = gen_io_ops.matching_files(_shard_name_keys_pattern)