SiraH commited on
Commit
0f80cd2
1 Parent(s): 7895158

change chunk size, embedding model

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -159,20 +159,20 @@ class UploadDoc:
159
 
160
  return documents
161
 
162
- def split_docs(documents,chunk_size=500):
163
- text_splitter = RecursiveCharacterTextSplitter(chunk_size=chunk_size, chunk_overlap=50)
164
  sp_docs = text_splitter.split_documents(documents)
165
  return sp_docs
166
 
167
  @st.cache_resource
168
  def load_llama2_llamaCpp():
169
  core_model_name = "llama-2-7b-chat.Q4_0.gguf"
170
- n_gpu_layers = 32
171
  n_batch = 512
172
  callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
173
  llm = LlamaCpp(
174
  model_path=core_model_name,
175
- n_gpu_layers=n_gpu_layers,
176
  n_batch=n_batch,
177
  callback_manager=callback_manager,
178
  verbose=True,n_ctx = 4096, temperature = 0.1, max_tokens = 256
@@ -198,7 +198,7 @@ def set_custom_prompt():
198
 
199
  @st.cache_resource
200
  def load_embeddings():
201
- embeddings = HuggingFaceEmbeddings(model_name = "sentence-transformers/all-MiniLM-L6-v2",
202
  model_kwargs = {'device': 'cpu'})
203
  return embeddings
204
 
 
159
 
160
  return documents
161
 
162
+ def split_docs(documents,chunk_size=1000):
163
+ text_splitter = RecursiveCharacterTextSplitter(chunk_size=chunk_size, chunk_overlap=200)
164
  sp_docs = text_splitter.split_documents(documents)
165
  return sp_docs
166
 
167
  @st.cache_resource
168
  def load_llama2_llamaCpp():
169
  core_model_name = "llama-2-7b-chat.Q4_0.gguf"
170
+ #n_gpu_layers = 32
171
  n_batch = 512
172
  callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
173
  llm = LlamaCpp(
174
  model_path=core_model_name,
175
+ #n_gpu_layers=n_gpu_layers,
176
  n_batch=n_batch,
177
  callback_manager=callback_manager,
178
  verbose=True,n_ctx = 4096, temperature = 0.1, max_tokens = 256
 
198
 
199
  @st.cache_resource
200
  def load_embeddings():
201
+ embeddings = HuggingFaceEmbeddings(model_name = "thenlper/gte-base",
202
  model_kwargs = {'device': 'cpu'})
203
  return embeddings
204