Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Revert "cache:use temp dir by default"

arnavsinghvi115b325c2021f9
diff --git a/dsp/modules/cache_utils.py b/dsp/modules/cache_utils.py
index 558d60104..a7e2bde2f 100644
--- a/dsp/modules/cache_utils.py
+++ b/dsp/modules/cache_utils.py
@@ -1,6 +1,6 @@
import os
from functools import wraps
-from tempfile import mkdtemp
+from pathlib import Path
from joblib import Memory
@@ -23,7 +23,7 @@ def noop_decorator(arg=None, *noop_args, **noop_kwargs):
return decorator
-cachedir = os.environ.get('DSP_CACHEDIR') or mkdtemp()
+cachedir = os.environ.get('DSP_CACHEDIR') or os.path.join(Path.home(), 'cachedir_joblib')
CacheMemory = Memory(location=cachedir, verbose=0)
cachedir2 = os.environ.get('DSP_NOTEBOOK_CACHEDIR')
@@ -33,6 +33,7 @@ NotebookCacheMemory.cache = noop_decorator
if cachedir2:
NotebookCacheMemory = Memory(location=cachedir2, verbose=0)
+
if not cache_turn_on:
CacheMemory = dotdict()
CacheMemory.cache = noop_decorator