wangzhang commited on
Commit
10fcba7
·
1 Parent(s): 0382be1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -39,9 +39,9 @@ def generate(
39
  chat_history: list[tuple[str, str]],
40
  system_prompt: str,
41
  max_new_tokens: int = 1024,
42
- temperature: float = 0.6,
43
- top_p: float = 0.9,
44
- top_k: int = 50,
45
  repetition_penalty: float = 1.2,
46
  ) -> Iterator[str]:
47
  conversation = []
@@ -49,7 +49,7 @@ def generate(
49
  conversation.append({"role": "system", "content": system_prompt})
50
  for user, assistant in chat_history:
51
  conversation.extend([{"role": "user", "content": user}, {"role": "assistant", "content": assistant}])
52
- conversation.append({"role": "user", "content": message)
53
 
54
  chat = tokenizer.apply_chat_template(conversation, tokenize=False)
55
  inputs = tokenizer(chat, return_tensors="pt", add_special_tokens=False).to("cuda")
 
39
  chat_history: list[tuple[str, str]],
40
  system_prompt: str,
41
  max_new_tokens: int = 1024,
42
+ temperature: float = 0.1,
43
+ top_p: float = 0.1,
44
+ top_k: int = 10,
45
  repetition_penalty: float = 1.2,
46
  ) -> Iterator[str]:
47
  conversation = []
 
49
  conversation.append({"role": "system", "content": system_prompt})
50
  for user, assistant in chat_history:
51
  conversation.extend([{"role": "user", "content": user}, {"role": "assistant", "content": assistant}])
52
+ conversation.append({"role": "user", "content": message})
53
 
54
  chat = tokenizer.apply_chat_template(conversation, tokenize=False)
55
  inputs = tokenizer(chat, return_tensors="pt", add_special_tokens=False).to("cuda")