iShare commited on
Commit
2a5ea04
·
1 Parent(s): 0b971fa

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -7
main.py CHANGED
@@ -21,18 +21,16 @@ repo_id = os.environ.get('repo_id')
21
  llm = HuggingFaceHub(repo_id=repo_id,
22
  #huggingfacehub_api_token="hf_p***K",
23
  huggingfacehub_api_token=hf_token,
24
- model_kwargs={"min_length":1024,
25
- "max_new_tokens":5632, "do_sample":True,
26
  "temperature":0.1,
27
  "top_k":50,
28
  "top_p":0.95, "eos_token_id":49155})
29
 
30
  prompt_template = """
31
- <<SYS>>You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
32
- 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.
33
- In each conversation, question is placed after [INST] while your answer should be placed after [/INST].<</SYS>>
34
- [INST] {user_question} [/INST]
35
- assistant:
36
  """
37
 
38
  llm_chain = LLMChain(llm=llm, prompt=PromptTemplate.from_template(prompt_template))
 
21
  llm = HuggingFaceHub(repo_id=repo_id,
22
  #huggingfacehub_api_token="hf_p***K",
23
  huggingfacehub_api_token=hf_token,
24
+ model_kwargs={"min_length":100,
25
+ "max_new_tokens":1024, "do_sample":True,
26
  "temperature":0.1,
27
  "top_k":50,
28
  "top_p":0.95, "eos_token_id":49155})
29
 
30
  prompt_template = """
31
+ You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
32
+ 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. Here is the user question {user_question}.
33
+ Helpful AI Answer:
 
 
34
  """
35
 
36
  llm_chain = LLMChain(llm=llm, prompt=PromptTemplate.from_template(prompt_template))