@@ -39,6 +39,8 @@ def _get_tpu_embedding_feature_config(
39
39
max_ids_per_chip_per_sample : Optional [int ] = None ,
40
40
max_ids_per_table : Optional [Union [int , List [int ]]] = None ,
41
41
max_unique_ids_per_table : Optional [Union [int , List [int ]]] = None ,
42
+ allow_id_dropping : bool = False ,
43
+ initialize_tables_on_host : bool = False ,
42
44
) -> Tuple [
43
45
Dict [str , tf .tpu .experimental .embedding .FeatureConfig ],
44
46
Optional [tf .tpu .experimental .embedding .SparseCoreEmbeddingConfig ],
@@ -57,6 +59,10 @@ def _get_tpu_embedding_feature_config(
57
59
sample.
58
60
max_ids_per_table: Maximum number of embedding ids per table.
59
61
max_unique_ids_per_table: Maximum number of unique embedding ids per table.
62
+ allow_id_dropping: bool to allow id dropping.
63
+ initialize_tables_on_host: bool : if the embedding table size is more than
64
+ what HBM can handle, this flag will help initialize the full embedding
65
+ tables on host and then copy shards to HBM.
60
66
61
67
Returns:
62
68
A dictionary of feature_name, FeatureConfig pairs.
@@ -140,7 +146,8 @@ def _get_tpu_embedding_feature_config(
140
146
max_ids_per_chip_per_sample = max_ids_per_chip_per_sample ,
141
147
max_ids_per_table = max_ids_per_table_dict ,
142
148
max_unique_ids_per_table = max_unique_ids_per_table_dict ,
143
- allow_id_dropping = False ,
149
+ allow_id_dropping = allow_id_dropping ,
150
+ initialize_tables_on_host = initialize_tables_on_host ,
144
151
)
145
152
146
153
return feature_config , sparsecore_config
@@ -248,6 +255,8 @@ def build_model(self) -> tf_keras.Model:
248
255
max_ids_per_chip_per_sample = self .task_config .model .max_ids_per_chip_per_sample ,
249
256
max_ids_per_table = self .task_config .model .max_ids_per_table ,
250
257
max_unique_ids_per_table = self .task_config .model .max_unique_ids_per_table ,
258
+ allow_id_dropping = self .task_config .model .allow_id_dropping ,
259
+ initialize_tables_on_host = self .task_config .model .initialize_tables_on_host ,
251
260
)
252
261
)
253
262
0 commit comments