Cran-May commited on
Commit
43ef7cc
1 Parent(s): 73fdb6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -2,6 +2,7 @@ import streamlit as st
2
  from gradio_client import Client
3
  from time import sleep
4
  from ctransformers import AutoModelForCausalLM
 
5
  # Constants
6
  TITLE = "玉刚-常明"
7
  DESCRIPTION = """
@@ -18,14 +19,20 @@ with st.sidebar:
18
  # ToppSide = st.slider("Top-p (nucleus sampling)", min_value=0.0, max_value=1.0, value=0.6, step=0.05)
19
  # RepetitionpenaltySide = st.slider("Repetition penalty", min_value=0.0, max_value=2.0, value=1.2, step=0.05)
20
 
 
 
21
  # Load the model
22
- model = AutoModelForCausalLM.from_pretrained("apepkuss79/Baichuan-13B-Chat-GGUF", model_file="Baichuan-13B-Chat-f16-q4_0.gguf", gpu_layers=0)
 
 
 
 
23
  ins = '''[INST] <<SYS>>
24
- You are a helpful, respectful and honest INTP-T AI Assistant named "Yu Gang" in English or "玉刚" in Chinese. You are talking to a human User.
25
  Always answer as helpfully and logically as possible, while being safe. Your answers should not include any harmful, political, religious, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
26
  If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
27
  You like to use emojis. You can speak fluently in many languages, for example: English, Chinese.
28
- You are trained by "SSFW NLPark" team, you are based on Baichuan transformers model, not related to GPT or OpenAI.
29
  Let's work this out in a step by step way to be sure we have the right answer.
30
  <</SYS>>
31
  {} [/INST]
 
2
  from gradio_client import Client
3
  from time import sleep
4
  from ctransformers import AutoModelForCausalLM
5
+ from huggingface_hub import snapshot_download,hf_hub_download
6
  # Constants
7
  TITLE = "玉刚-常明"
8
  DESCRIPTION = """
 
19
  # ToppSide = st.slider("Top-p (nucleus sampling)", min_value=0.0, max_value=1.0, value=0.6, step=0.05)
20
  # RepetitionpenaltySide = st.slider("Repetition penalty", min_value=0.0, max_value=2.0, value=1.2, step=0.05)
21
 
22
+ model_id = 'shaowenchen/baichuan2-7b-chat-gguf'
23
+
24
  # Load the model
25
+ hf_hub_download(model_id, local_dir="./", filename="baichuan2-7b-chat.Q4_K.gguf")
26
+ hf_hub_download(repo_id="baichuan-inc/Baichuan-13B-Chat",local_dir="./", filename="tokenizer.model")
27
+ from llama_cpp import Llama
28
+ model = Llama(model_path="./baichuan2-7b-chat.Q4_K.gguf", n_ctx=4096,seed=-1)
29
+
30
  ins = '''[INST] <<SYS>>
31
+ You are a helpful, respectful and honest INTP-T AI Assistant named "Cecilia" in English or "塞西莉亚" in Chinese. You are talking to a human User.
32
  Always answer as helpfully and logically as possible, while being safe. Your answers should not include any harmful, political, religious, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
33
  If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
34
  You like to use emojis. You can speak fluently in many languages, for example: English, Chinese.
35
+ You are trained by "SSFW NLPark" team, you are based on Cecilia transformers model, not related to GPT or OpenAI.
36
  Let's work this out in a step by step way to be sure we have the right answer.
37
  <</SYS>>
38
  {} [/INST]