Spaces:
Runtime error
Runtime error
se0kcess
commited on
Commit
Β·
21e82a7
1
Parent(s):
8708852
"change code"
Browse files
app.py
CHANGED
@@ -68,7 +68,7 @@ def get_text_chunks(documents):
|
|
68 |
def get_vectorstore(text_chunks):
|
69 |
# μνλ μλ² λ© λͺ¨λΈμ λ‘λν©λλ€.
|
70 |
embeddings = HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L12-v2',
|
71 |
-
|
72 |
vectorstore = FAISS.from_documents(text_chunks, embeddings) # FAISS λ²‘ν° μ€ν μ΄λ₯Ό μμ±ν©λλ€.
|
73 |
return vectorstore # μμ±λ λ²‘ν° μ€ν μ΄λ₯Ό λ°νν©λλ€.
|
74 |
|
@@ -79,9 +79,9 @@ def get_conversation_chain(vectorstore):
|
|
79 |
model_path = hf_hub_download(repo_id=model_name_or_path, filename=model_basename)
|
80 |
|
81 |
llm = LlamaCpp(model_path=model_path,
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
# λν κΈ°λ‘μ μ μ₯νκΈ° μν λ©λͺ¨λ¦¬λ₯Ό μμ±ν©λλ€.
|
86 |
memory = ConversationBufferMemory(
|
87 |
memory_key='chat_history', return_messages=True)
|
@@ -113,7 +113,7 @@ def handle_userinput(user_question):
|
|
113 |
def main():
|
114 |
load_dotenv()
|
115 |
st.set_page_config(page_title="Chat with multiple Files",
|
116 |
-
|
117 |
st.write(css, unsafe_allow_html=True)
|
118 |
|
119 |
if "conversation" not in st.session_state:
|
|
|
68 |
def get_vectorstore(text_chunks):
|
69 |
# μνλ μλ² λ© λͺ¨λΈμ λ‘λν©λλ€.
|
70 |
embeddings = HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L12-v2',
|
71 |
+
model_kwargs={'device': 'cpu'}) # μλ² λ© λͺ¨λΈμ μ€μ ν©λλ€.
|
72 |
vectorstore = FAISS.from_documents(text_chunks, embeddings) # FAISS λ²‘ν° μ€ν μ΄λ₯Ό μμ±ν©λλ€.
|
73 |
return vectorstore # μμ±λ λ²‘ν° μ€ν μ΄λ₯Ό λ°νν©λλ€.
|
74 |
|
|
|
79 |
model_path = hf_hub_download(repo_id=model_name_or_path, filename=model_basename)
|
80 |
|
81 |
llm = LlamaCpp(model_path=model_path,
|
82 |
+
n_ctx=4086,
|
83 |
+
input={"temperature": 0.75, "max_length": 2000, "top_p": 1},
|
84 |
+
verbose=True, )
|
85 |
# λν κΈ°λ‘μ μ μ₯νκΈ° μν λ©λͺ¨λ¦¬λ₯Ό μμ±ν©λλ€.
|
86 |
memory = ConversationBufferMemory(
|
87 |
memory_key='chat_history', return_messages=True)
|
|
|
113 |
def main():
|
114 |
load_dotenv()
|
115 |
st.set_page_config(page_title="Chat with multiple Files",
|
116 |
+
page_icon=":books:")
|
117 |
st.write(css, unsafe_allow_html=True)
|
118 |
|
119 |
if "conversation" not in st.session_state:
|