Skip to content

Commit

Permalink
update work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxiaoyi committed Jun 22, 2024
1 parent cea5fe9 commit 19f18d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
logger = logging.get_logger(__name__)

from openxlab.model import download
#download(model_repo='ljnyyds/zhangsan_say_law',output='./model')
#download(model_repo='OpenLMLab/internlm2-base-1.8b',output='./OpenLMLab/internlm2-base-1.8b')

def init():
model_dir = snapshot_download('admlrz/lirongzhen-pufa-model'
model_dir = snapshot_download('kongfoo/internTA'
, cache_dir='./')
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
# 下载模型
Expand Down Expand Up @@ -171,11 +171,11 @@ def on_btn_click():
@st.cache_resource
def load_model():
model = (
AutoModelForCausalLM.from_pretrained("admlrz/lirongzhen-pufa-model", trust_remote_code=True)
AutoModelForCausalLM.from_pretrained("kongfoo/internTA", trust_remote_code=True)
.to(torch.bfloat16)
.cuda()
)
tokenizer = AutoTokenizer.from_pretrained("admlrz/lirongzhen-pufa-model", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("kongfoo/internTA", trust_remote_code=True)
return model, tokenizer


Expand All @@ -199,7 +199,7 @@ def prepare_generation_config():
def combine_history(prompt):
messages = st.session_state.messages
meta_instruction = (
"你是一个由上海人工智能实验室提供支持开发的法律大模型。现在你是一个法律学专家,我有一些关于民法典的问题,请你用专业的知识帮我解决。"
"你是一个由躬富科技提供支持开发的聊天机器人E.CoPI。现在你是我的助教,我有一些关于学习《合成生物学》课本的问题,请你用专业的知识帮我解决。"
)
total_prompt = f"<s><|im_start|>system\n{meta_instruction}<|im_end|>\n"
for message in messages:
Expand All @@ -221,10 +221,10 @@ def main():
model, tokenizer = load_model()
print("load model end.")

user_avator = "assets/user.png"
robot_avator = "assets/robot.png"
user_avator = "momo.png"
robot_avator = "robot.png"

st.title("张三普法")
st.title("我是E.CoPI老师,你的《合成生物学》助教~")

generation_config = prepare_generation_config()

Expand Down
Binary file added momo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added robot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 19f18d3

Please sign in to comment.