emar commited on
Commit
d829f59
1 Parent(s): b7463ad

return to bge

Browse files
app.py CHANGED
@@ -15,8 +15,7 @@ PERSIST_DIR = './storage'
15
  # Configure the settings
16
  DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
17
 
18
- Settings.embed_model = OpenAIEmbedding()
19
- # Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-base-en-v1.5", device="cpu")
20
 
21
  Settings.llm = HuggingFaceLLM(
22
  model_name="meta-llama/Meta-Llama-3-8B-Instruct",
@@ -39,17 +38,28 @@ query_engine = index.as_query_engine(streaming=True, similarity_top_k=1, node_po
39
 
40
 
41
  @spaces.GPU
42
- def chatbot_response(message, history):
 
 
 
43
  response = query_engine.query(message)
44
  return str(response)
45
 
46
- iface = gr.ChatInterface(
47
  fn=chatbot_response,
48
- title="UESP Lore Chatbot: Running on top of Meta-Llama-3-8B-Instruct (currently) It works 'okay'",
 
 
 
 
 
 
 
 
49
  description="Github page for use case, general information, local installs, etc: https://github.com/emarron/UESP-lore",
50
- examples=["Who is Zaraphus?", "What is the relation between dragonbreak and chim?", "What is the Lunar Lorkhan?"],
51
- cache_examples=True,
52
  )
53
 
 
 
54
  if __name__ == "__main__":
55
  iface.launch()
 
15
  # Configure the settings
16
  DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
17
 
18
+ Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-base-en-v1.5", device="cpu")
 
19
 
20
  Settings.llm = HuggingFaceLLM(
21
  model_name="meta-llama/Meta-Llama-3-8B-Instruct",
 
38
 
39
 
40
  @spaces.GPU
41
+ def chatbot_response(message, context_window, max_new_tokens, temperature, top_k, top_p):
42
+ Settings.llm.context_window = context_window
43
+ Settings.llm.max_new_tokens = max_new_tokens
44
+ Settings.llm.generate_kwargs = {"temperature": temperature, "top_k": top_k, "top_p": top_p, "do sample": True}
45
  response = query_engine.query(message)
46
  return str(response)
47
 
48
+ iface = gr.Interface(
49
  fn=chatbot_response,
50
+ inputs=[
51
+ gr.Slider(minimum=512, maximum=4096, step=256, value=2048, label="Context Window"),
52
+ gr.Slider(minimum=32, maximum=512, step=32, value=256, label="Max New Tokens"),
53
+ gr.Slider(minimum=0.1, maximum=1.0, step=0.1, value=0.7, label="Temperature: Lower number is by the book, higher number is make stuff up"),
54
+ gr.Slider(minimum=1, maximum=100, step=1, value=50, label="Top K"),
55
+ gr.Slider(minimum=0.5, maximum=1.0, step=0.05, value=0.95, label="Top P"),
56
+ ],
57
+ outputs=gr.Textbox(label="Response"),
58
+ title="UESP Lore Chatbot: Running on top of Meta-Llama-3-8B-Instruct + BGE_LARGE. This is inferior to the downloadable ones.",
59
  description="Github page for use case, general information, local installs, etc: https://github.com/emarron/UESP-lore",
 
 
60
  )
61
 
62
+
63
+
64
  if __name__ == "__main__":
65
  iface.launch()
storage/default__vector_store.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:eb0befaddec7950c565951a9cc8e60acaba5d197c2d4886f419dcee6896680b2
3
- size 397136247
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d5b72dceac75e8648eeafd9a9e1b6d62aa24ef560b3fb1116e0e43c65d5ccb4
3
+ size 197975710
storage/docstore.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:46fd63226ff854bab49a645a2194317b3883247b4ecb98f7944438044e06349f
3
  size 44043711
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9793071f910c4d3c66e206d6cf0930d9a869c243f1fad99e19b25d3612df161
3
  size 44043711
storage/index_store.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:00d5d0f5b20c06f13b0dd622d898396862fd12d77a1fd5e55550704bda465c6d
3
  size 959947
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c31d504b2c3a15e815dcfe5af9215cb8bbd7e5d5530cf0cd7d0dd8511413477a
3
  size 959947