ruslanmv commited on
Commit
907b637
·
1 Parent(s): 59848b6

Update webchat.py

Browse files
Files changed (1) hide show
  1. webchat.py +9 -2
webchat.py CHANGED
@@ -79,10 +79,17 @@ def get_model_test(model_type, max_tokens, min_tokens, decoding, temperature):
79
 
80
  return model
81
 
82
-
 
 
 
 
 
83
  # Embedding function
84
  class MiniLML6V2EmbeddingFunction(EmbeddingFunction):
85
- MODEL = SentenceTransformer('all-MiniLM-L6-v2')
 
 
86
 
87
  def __call__(self, texts):
88
  return MiniLML6V2EmbeddingFunction.MODEL.encode(texts).tolist()
 
79
 
80
  return model
81
 
82
+ import os
83
+ # Get the current working directory
84
+ current_dir = os.getcwd()
85
+ cache_dir = os.path.join(current_dir, ".cache")
86
+ if not os.path.exists(cache_dir):
87
+ os.makedirs(cache_dir)
88
  # Embedding function
89
  class MiniLML6V2EmbeddingFunction(EmbeddingFunction):
90
+ #MODEL = SentenceTransformer('all-MiniLM-L6-v2')
91
+ MODEL = SentenceTransformer('all-MiniLM-L6-v2', cache_dir=cache_dir)
92
+
93
 
94
  def __call__(self, texts):
95
  return MiniLML6V2EmbeddingFunction.MODEL.encode(texts).tolist()