Skip to content

Commit c463965

Browse files
EddyLXJfacebook-github-bot
authored andcommitted
Adding util func to get inference threshold for feature score eviction. (meta-pytorch#3321)
Summary: Since the eviction threshold for feature score eviction is dynamic changed, we have to recalculate the threshold in publish to evict based on max inference id pre rank to avoid inference oom. Reviewed By: emlin Differential Revision: D80880936
1 parent caebdb1 commit c463965

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

torchrec/modules/embedding_configs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ class FeatureScoreBasedEvictionPolicy(VirtualTableEvictionPolicy):
222222
eviction_ttl_mins: int = (
223223
0 # if not 0, means we will use timestamp based policy but not feature score policy
224224
)
225+
max_inference_id_num_per_rank: int = (
226+
0 # max number of inference ids per rank, default is max_training_id_num_per_rank
227+
)
225228
inference_eviction_feature_score_threshold: Optional[float] = (
226229
None # 0 means no eviction
227230
)
@@ -232,6 +235,8 @@ def __post_init__(self) -> None:
232235
self.inference_eviction_feature_score_threshold = 0
233236
if self.inference_eviction_ttl_mins is None:
234237
self.inference_eviction_ttl_mins = self.eviction_ttl_mins
238+
if self.max_inference_id_num_per_rank == 0:
239+
self.max_inference_id_num_per_rank = self.max_training_id_num_per_rank
235240

236241

237242
@dataclass

0 commit comments

Comments
 (0)