Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
from transformers import AutoModel, AutoTokenizer
|
| 4 |
import streamlit as st
|
| 5 |
from streamlit_chat import message
|
| 6 |
-
|
| 7 |
|
| 8 |
st.set_page_config(
|
| 9 |
page_title="ChatGLM2-6b 演示",
|
|
@@ -16,7 +16,9 @@ st.set_page_config(
|
|
| 16 |
def get_model():
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm2-6b-int4", trust_remote_code=True)
|
| 18 |
model = AutoModel.from_pretrained("THUDM/chatglm2-6b-int4", trust_remote_code=True).float()
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
return tokenizer, model
|
| 21 |
|
| 22 |
|
|
|
|
| 3 |
from transformers import AutoModel, AutoTokenizer
|
| 4 |
import streamlit as st
|
| 5 |
from streamlit_chat import message
|
| 6 |
+
from fastllm_pytools import llm
|
| 7 |
|
| 8 |
st.set_page_config(
|
| 9 |
page_title="ChatGLM2-6b 演示",
|
|
|
|
| 16 |
def get_model():
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm2-6b-int4", trust_remote_code=True)
|
| 18 |
model = AutoModel.from_pretrained("THUDM/chatglm2-6b-int4", trust_remote_code=True).float()
|
| 19 |
+
|
| 20 |
+
model = llm.from_hf(model, tokenizer, dtype = "int4")
|
| 21 |
+
#model = model.eval()
|
| 22 |
return tokenizer, model
|
| 23 |
|
| 24 |
|