IC4T commited on
Commit
b2630ad
1 Parent(s): e3eab2e
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -5,7 +5,7 @@ import os
5
  os.system('pip install -e ./langchain')
6
  import gradio as gr
7
  from dotenv import load_dotenv
8
- from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
9
  from langchain.chains import RetrievalQA
10
  from langchain.embeddings import LlamaCppEmbeddings
11
  # from langchain.llms import GPT4All, LlamaCpp
@@ -50,7 +50,7 @@ embeddings = HuggingFaceEmbeddings(model_name=embeddings_model_name)
50
  db = Chroma(persist_directory=persist_directory, embedding_function=embeddings, client_settings=CHROMA_SETTINGS)
51
  retriever = db.as_retriever(search_kwargs={"k": target_source_chunks})
52
  # Prepare the LLM
53
- callbacks = [StreamingStdOutCallbackHandler()]
54
 
55
  match model_type:
56
  case "dolly-v2-3b":
@@ -60,8 +60,8 @@ match model_type:
60
  # Return the full text, because this is what the HuggingFacePipeline expects.
61
  model=model, tokenizer=tokenizer, return_full_text=True, task="text-generation", max_new_tokens=model_n_ctx))#, max_new_tokens=model_n_ctx
62
  #))
63
- case "GPT4All":
64
- llm = GPT4All(model=model_path, n_ctx=model_n_ctx, backend='gptj', callbacks=callbacks, verbose=False)
65
  case _default:
66
  print(f"Model {model_type} not supported!")
67
  exit;
 
5
  os.system('pip install -e ./langchain')
6
  import gradio as gr
7
  from dotenv import load_dotenv
8
+ # from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
9
  from langchain.chains import RetrievalQA
10
  from langchain.embeddings import LlamaCppEmbeddings
11
  # from langchain.llms import GPT4All, LlamaCpp
 
50
  db = Chroma(persist_directory=persist_directory, embedding_function=embeddings, client_settings=CHROMA_SETTINGS)
51
  retriever = db.as_retriever(search_kwargs={"k": target_source_chunks})
52
  # Prepare the LLM
53
+ # callbacks = [StreamingStdOutCallbackHandler()]
54
 
55
  match model_type:
56
  case "dolly-v2-3b":
 
60
  # Return the full text, because this is what the HuggingFacePipeline expects.
61
  model=model, tokenizer=tokenizer, return_full_text=True, task="text-generation", max_new_tokens=model_n_ctx))#, max_new_tokens=model_n_ctx
62
  #))
63
+ # case "GPT4All":
64
+ # llm = GPT4All(model=model_path, n_ctx=model_n_ctx, backend='gptj', callbacks=callbacks, verbose=False)
65
  case _default:
66
  print(f"Model {model_type} not supported!")
67
  exit;