Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,9 @@ 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 演示",
|
@@ -15,9 +18,7 @@ st.set_page_config(
|
|
15 |
@st.cache_resource
|
16 |
def get_model():
|
17 |
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm2-6b-int4", trust_remote_code=True)
|
18 |
-
model =
|
19 |
-
|
20 |
-
model = llm.from_hf(model, tokenizer, dtype = "int4")
|
21 |
#model = model.eval()
|
22 |
return tokenizer, model
|
23 |
|
|
|
4 |
import streamlit as st
|
5 |
from streamlit_chat import message
|
6 |
from fastllm_pytools import llm
|
7 |
+
from huggingface_hub import snapshot_download,hf_hub_download
|
8 |
+
|
9 |
+
hf_hub_download(repo_id="huangyuyang/chatglm2-6b-int4.flm",local_dir="./", filename="chatglm2-6b-int4.flm")
|
10 |
|
11 |
st.set_page_config(
|
12 |
page_title="ChatGLM2-6b 演示",
|
|
|
18 |
@st.cache_resource
|
19 |
def get_model():
|
20 |
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm2-6b-int4", trust_remote_code=True)
|
21 |
+
model = llm.model(chatglm2-6b-int4.flm)
|
|
|
|
|
22 |
#model = model.eval()
|
23 |
return tokenizer, model
|
24 |
|