Skip to content

Commit eb211a7

Browse files
authored
Add unitxt version to inference cache keys (#1714)
Add unitxt version to cache record Signed-off-by: elronbandel <[email protected]>
1 parent 3fd8f22 commit eb211a7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/unitxt/inference.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def prepare(self):
185185
self.prepare_engine()
186186
if self.use_cache:
187187
from diskcache import Cache
188-
self._cache = Cache(get_settings().inference_engine_cache_path + self.__class__.__name__)
188+
self._cache = Cache(settings.inference_engine_cache_path + self.__class__.__name__)
189189

190190
def __call__(
191191
self,
@@ -201,6 +201,7 @@ def get_instance_cache_key(self, instance):
201201
def _get_cache_key(self, instance: Dict[str, Any]) -> str:
202202
"""Generate a unique cache key for each input."""
203203
record = self.get_instance_cache_key(instance)
204+
record["version"] = constants.version
204205
record.update(self.to_dict())
205206
instance_str = json.dumps(record, sort_keys=True)
206207
return hashlib.md5(instance_str.encode()).hexdigest()

0 commit comments

Comments
 (0)