Spaces:
Sleeping
Sleeping
refactor: simplify model initialization and remove caching
Browse files
app.py
CHANGED
@@ -4,15 +4,15 @@ from huggingface_hub import login
|
|
4 |
import os
|
5 |
from langchain.memory import ConversationBufferMemory
|
6 |
|
7 |
-
@st.cache_resource
|
8 |
-
def init_model():
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
# return load("mlx-community/Mixtral-8x7B-Instruct-v0.1")
|
14 |
-
|
15 |
-
model, tokenizer =
|
16 |
|
17 |
if "memory" not in st.session_state:
|
18 |
st.session_state.memory = ConversationBufferMemory(return_messages=True)
|
|
|
4 |
import os
|
5 |
from langchain.memory import ConversationBufferMemory
|
6 |
|
7 |
+
# @st.cache_resource
|
8 |
+
# def init_model():
|
9 |
+
# token = os.getenv("HF_TOKEN")
|
10 |
+
# if token:
|
11 |
+
# login(token=token)
|
12 |
+
# return load("Rafii/f1llama")
|
13 |
# return load("mlx-community/Mixtral-8x7B-Instruct-v0.1")
|
14 |
+
token = os.getenv("HF_TOKEN")
|
15 |
+
model, tokenizer = load("Rafii/f1llama")
|
16 |
|
17 |
if "memory" not in st.session_state:
|
18 |
st.session_state.memory = ConversationBufferMemory(return_messages=True)
|