alfredplpl commited on
Commit
3ebb14f
·
verified ·
1 Parent(s): c660705

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -11,9 +11,7 @@ from threading import Thread
11
  DESCRIPTION = '''
12
  <div>
13
  <h1 style="text-align: center;">Meta Llama3 8B</h1>
14
- <p>This Space demonstrates the instruction-tuned model <a href="https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct"><b>Meta Llama3 8b Chat</b></a>. Meta Llama3 is the new open LLM and comes in two sizes: 8b and 70b. Feel free to play with it, or duplicate to run privately!</p>
15
- <p>🔎 For more details about the Llama3 release and how to use the model with <code>transformers</code>, take a look <a href="https://huggingface.co/blog/llama3">at our blog post</a>.</p>
16
- <p>🦕 Looking for an even more powerful model? Check out the <a href="https://huggingface.co/chat/"><b>Hugging Chat</b></a> integration for Meta Llama 3 70b</p>
17
  </div>
18
  '''
19
 
@@ -71,6 +69,7 @@ def chat_llama3_8b(message: str,
71
  str: The generated response.
72
  """
73
  conversation = []
 
74
  for user, assistant in history:
75
  conversation.extend([{"role": "user", "content": user}, {"role": "assistant", "content": assistant}])
76
  conversation.append({"role": "user", "content": message})
@@ -85,6 +84,8 @@ def chat_llama3_8b(message: str,
85
  max_new_tokens=max_new_tokens,
86
  do_sample=True,
87
  temperature=temperature,
 
 
88
  eos_token_id=terminators,
89
  )
90
  # This will enforce greedy generation (do_sample=False) when the temperature is passed 0, avoiding the crash.
 
11
  DESCRIPTION = '''
12
  <div>
13
  <h1 style="text-align: center;">Meta Llama3 8B</h1>
14
+ <p>日本語向け Llama 3 のデモだよ。 <a href="https://huggingface.co/alfredplpl/Llama-3-8B-Instruct-Ja"><b>日本語向け Llama3 8b Chat</b></a>.</p>
 
 
15
  </div>
16
  '''
17
 
 
69
  str: The generated response.
70
  """
71
  conversation = []
72
+ conversation.append({"role": "system", "content": "あなたは日本語で回答するAIアシスタントです。"})
73
  for user, assistant in history:
74
  conversation.extend([{"role": "user", "content": user}, {"role": "assistant", "content": assistant}])
75
  conversation.append({"role": "user", "content": message})
 
84
  max_new_tokens=max_new_tokens,
85
  do_sample=True,
86
  temperature=temperature,
87
+ top_p=0.95,
88
+ repetition_penalty=1.1,
89
  eos_token_id=terminators,
90
  )
91
  # This will enforce greedy generation (do_sample=False) when the temperature is passed 0, avoiding the crash.