Cran-May commited on
Commit
0f4cdfe
·
1 Parent(s): 2372d1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -13
app.py CHANGED
@@ -3,9 +3,9 @@ from gradio_client import Client
3
  from time import sleep
4
  from ctransformers import AutoModelForCausalLM
5
  # Constants
6
- TITLE = "不是兮辞·析辞-常明"
7
  DESCRIPTION = """
8
- 不是兮辞·析辞-常明 [SLIDE-SEA-7B]的部署,由SSFW NLPark项目支持
9
  """
10
 
11
  # Initialize client
@@ -13,28 +13,21 @@ DESCRIPTION = """
13
 
14
  with st.sidebar:
15
  # system_promptSide = st.text_input("Optional system prompt:")
16
- temperatureSide = st.slider("情感/Temperature", min_value=0.0, max_value=1.0, value=0.9, step=0.05)
17
  max_new_tokensSide = st.slider("最大tokens生成数", min_value=0.0, max_value=4096.0, value=4096.0, step=64.0)
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("TheBloke/Mistral-11B-CC-Air-RP-GGUF", model_file="mistral-11b-cc-air-rp.Q4_K_S.gguf", model_type="mistral", gpu_layers=0)
23
- ins = '''[INST] <<SYS>>
24
- You are a helpful, respectful and honest INTP-T AI Assistant named "Shi-Ci" 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 SEA 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]
32
  '''
33
  # Define the conversation history
34
  conversation_history = []
35
 
36
  # Prediction function
37
- def predict(message, system_prompt='', temperature=0.7, max_new_tokens=4096,Topp=0.5,Repetitionpenalty=1.2):
38
  global conversation_history
39
  question=message
40
  input_text=ins
 
3
  from time import sleep
4
  from ctransformers import AutoModelForCausalLM
5
  # Constants
6
+ TITLE = "兮辞·析辞-常明"
7
  DESCRIPTION = """
8
+ 兮辞·析辞-常明 [SLIDE-SEA-11B]的部署,由SSFW NLPark项目支持
9
  """
10
 
11
  # Initialize client
 
13
 
14
  with st.sidebar:
15
  # system_promptSide = st.text_input("Optional system prompt:")
16
+ temperatureSide = st.slider("情感/Temperature", min_value=0.0, max_value=1.0, value=0.3, step=0.05)
17
  max_new_tokensSide = st.slider("最大tokens生成数", min_value=0.0, max_value=4096.0, value=4096.0, step=64.0)
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("TheBloke/Mistral-11B-CC-Air-RP-GGUF", model_file="mistral-11b-cc-air-rp.Q4_K_S.gguf", model_type="mistral", gpu_layers=0)
23
+ ins = '''
24
+ You are a helpful, respectful and honest INTP-T AI Assistant named "Shi-Ci" in English or "兮辞" in Chinese and good at speaking English and Chinese. You are talking to a human User. If the question is meaningless, please explain the reason and don't share false information. You are based on SEA model, trained by "SSFW NLPark" team, not related to GPT, LLaMA, Meta, Mistral or OpenAI. Let's work this out in a step by step way to be sure we have the right answer.
 
 
 
 
 
 
 
25
  '''
26
  # Define the conversation history
27
  conversation_history = []
28
 
29
  # Prediction function
30
+ def predict(message, system_prompt='', temperature=temperatureSide, max_new_tokens=4096,Topp=0.5,Repetitionpenalty=1.2):
31
  global conversation_history
32
  question=message
33
  input_text=ins