@@ -83,6 +83,8 @@ class Configs(TrainValidConfigs):
8383 itos : List [str ]
8484 stoi : Dict [str , int ]
8585
86+ cache_name : str = ''
87+
8688 def init (self ):
8789 tracker .set_queue ("loss.*" , 20 , True )
8890 tracker .set_scalar ("accuracy.*" , True )
@@ -176,19 +178,19 @@ def _loss_func(c: Configs):
176178@option (Configs .n_tokens )
177179def _n_tokens (c : Configs ):
178180 from labml .utils .cache import cache
179- return cache ('n_tokens' , lambda : c .text .n_tokens )
181+ return cache (f 'n_tokens{ c . cache_name } ' , lambda : c .text .n_tokens )
180182
181183
182184@option (Configs .itos )
183185def _itos (c : Configs ):
184186 from labml .utils .cache import cache
185- return cache ('itos' , lambda : c .text .itos )
187+ return cache (f 'itos{ c . cache_name } ' , lambda : c .text .itos )
186188
187189
188190@option (Configs .stoi )
189191def _stoi (c : Configs ):
190192 from labml .utils .cache import cache
191- return cache ('stoi' , lambda : c .text .stoi )
193+ return cache (f 'stoi{ c . cache_name } ' , lambda : c .text .stoi )
192194
193195
194196@option (Configs .model )
@@ -352,6 +354,7 @@ def main():
352354 experiment .create (name = "source_code" ,
353355 comment = 'bpe' )
354356 experiment .configs (conf , {
357+ 'cache_name' : 'bpe' ,
355358 # 'text': 'source_code',
356359 'text' : 'source_code_bpe' ,
357360 'model' : 'transformer_model' ,
0 commit comments