Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,8 @@ import torch
|
|
11 |
import streamlit as st
|
12 |
from streamlit_chat import message
|
13 |
|
14 |
-
|
|
|
15 |
|
16 |
def preprocess(text):
|
17 |
text = text.replace("\n", "\\n").replace("\t", "\\t")
|
@@ -54,8 +55,6 @@ st.markdown("[Github](https://github.com/scutcyr)")
|
|
54 |
@st.cache_resource
|
55 |
def load_model():
|
56 |
model = T5ForConditionalGeneration.from_pretrained("ClueAI/ChatYuan-large-v1")
|
57 |
-
# 修改colab笔记本设置为gpu,推理更快
|
58 |
-
device = torch.device('cpu')
|
59 |
model.to(device)
|
60 |
print('Model Load done!')
|
61 |
return model
|
|
|
11 |
import streamlit as st
|
12 |
from streamlit_chat import message
|
13 |
|
14 |
+
# 修改colab笔记本设置为gpu,推理更快
|
15 |
+
device = torch.device('cpu')
|
16 |
|
17 |
def preprocess(text):
|
18 |
text = text.replace("\n", "\\n").replace("\t", "\\t")
|
|
|
55 |
@st.cache_resource
|
56 |
def load_model():
|
57 |
model = T5ForConditionalGeneration.from_pretrained("ClueAI/ChatYuan-large-v1")
|
|
|
|
|
58 |
model.to(device)
|
59 |
print('Model Load done!')
|
60 |
return model
|