vpcom commited on
Commit
539297a
1 Parent(s): 7900969

fix: seed had some odd issue

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -28,24 +28,20 @@ client = InferenceClient(
28
  def format_prompt(message, history, system_prompt):
29
  prompt = ""
30
  if system_prompt:
31
- prompt += f"System: {system_prompt}\n"
32
  for user_prompt, bot_response in history:
33
- prompt += f"User: {user_prompt}\n"
34
- prompt += f"PersianGPT: {bot_response}\n" # Response already contains "PersianGPT: "
35
- prompt += f"""User: {message}
36
- Falcon:"""
37
  return prompt
38
 
39
- seed = 42
40
-
41
  def generate(
42
- prompt, history, system_prompt="<|endoftext|>", temperature=0.9, max_new_tokens=100, top_p=0.95, repetition_penalty=1.0,
43
  ):
44
  temperature = float(temperature)
45
  if temperature < 1e-2:
46
  temperature = 1e-2
47
  top_p = float(top_p)
48
- global seed
49
  generate_kwargs = dict(
50
  temperature=temperature,
51
  max_new_tokens=max_new_tokens,
 
28
  def format_prompt(message, history, system_prompt):
29
  prompt = ""
30
  if system_prompt:
31
+ prompt += f"{system_prompt}"
32
  for user_prompt, bot_response in history:
33
+ prompt += f"{user_prompt}"
34
+ prompt += f"{bot_response}"
35
+ prompt += f"""{message}"""
 
36
  return prompt
37
 
 
 
38
  def generate(
39
+ prompt, history, system_prompt="<|endoftext|>", temperature=0.9, max_new_tokens=100, top_p=0.95, repetition_penalty=1.0, seed=42,
40
  ):
41
  temperature = float(temperature)
42
  if temperature < 1e-2:
43
  temperature = 1e-2
44
  top_p = float(top_p)
 
45
  generate_kwargs = dict(
46
  temperature=temperature,
47
  max_new_tokens=max_new_tokens,