Ali2206 commited on
Commit
2077bae
·
verified ·
1 Parent(s): 1341ea7

Update backend/agent_instance.py

Browse files
Files changed (1) hide show
  1. backend/agent_instance.py +3 -3
backend/agent_instance.py CHANGED
@@ -1,5 +1,3 @@
1
-
2
-
3
  import sys
4
  import os
5
 
@@ -9,7 +7,9 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..",
9
  from txagent.txagent import TxAgent # ✅ Now this will work
10
 
11
  def init_agent():
12
- model_cache_dir = os.path.expanduser("~/.cache/txagent_models")
 
 
13
  os.environ["TRANSFORMERS_CACHE"] = model_cache_dir
14
  os.environ["HF_HOME"] = model_cache_dir
15
 
 
 
 
1
  import sys
2
  import os
3
 
 
7
  from txagent.txagent import TxAgent # ✅ Now this will work
8
 
9
  def init_agent():
10
+ # Use /data for persistent model caching on Hugging Face Spaces
11
+ model_cache_dir = "/data/txagent_models"
12
+ os.makedirs(model_cache_dir, exist_ok=True)
13
  os.environ["TRANSFORMERS_CACHE"] = model_cache_dir
14
  os.environ["HF_HOME"] = model_cache_dir
15