Skip to content

Commit 31dd19c

Browse files
EddyLXJfacebook-github-bot
authored andcommitted
Add util func for kvzch eviction mask (#1645)
Summary: Pull Request resolved: facebookresearch/FBGEMM#1645 Differential Revision: D79045178
1 parent cabf6aa commit 31dd19c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

torchrec/modules/embedding_configs.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ class CountBasedEvictionPolicy(VirtualTableEvictionPolicy):
194194
15 # eviction threshold for count based eviction policy. 0 means no eviction
195195
)
196196
decay_rate: float = 0.99 # default decay by default
197+
inference_eviction_threshold: int = (
198+
eviction_threshold # eviction threshold for inference count based eviction policy. 0 means no eviction
199+
)
197200

198201

199202
@dataclass
@@ -203,6 +206,7 @@ class TimestampBasedEvictionPolicy(VirtualTableEvictionPolicy):
203206
"""
204207

205208
eviction_ttl_mins: int = 24 * 60 # 1 day. 0 means no eviction
209+
inference_eviction_ttl_mins: int = eviction_ttl_mins # 0 means no eviction
206210

207211

208212
@dataclass
@@ -216,6 +220,13 @@ class CountTimestampMixedEvictionPolicy(VirtualTableEvictionPolicy):
216220
)
217221
decay_rate: float = 0.99 # default decay by default
218222
eviction_ttl_mins: int = 24 * 60 # 1 day. 0 means no eviction based on timestamp
223+
inference_eviction_threshold: int = (
224+
eviction_threshold # eviction threshold for inference count based eviction policy. 0 means no eviction based on count
225+
)
226+
227+
inference_eviction_ttl_mins: int = (
228+
eviction_ttl_mins # 0 means no eviction based on timestamp
229+
)
219230

220231

221232
@dataclass
@@ -227,6 +238,7 @@ class FeatureL2NormBasedEvictionPolicy(VirtualTableEvictionPolicy):
227238
eviction_threshold: float = (
228239
0.0 # eviction threshold for feature l2 norm based eviction policy. 0.0 means no eviction
229240
)
241+
inference_eviction_threshold: float = eviction_threshold
230242

231243

232244
@dataclass

0 commit comments

Comments
 (0)