martinvityk commited on
Commit
1b4dab3
·
1 Parent(s): 4fda9e6
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -60,10 +60,11 @@ def respond(
60
  if system_message and system_message.strip():
61
  # How a system message is used can vary. For this model, prepending it might work.
62
  # Or, it could be part of the initial "USER:" turn if the model expects that.
63
- # The example prompt is `USER: {prompt}
64
- ASSISTANT:`
 
65
  # We will integrate system_message as part of the first user turn or as general context.
66
- # For now, let's prepend it simply.
67
  prompt_parts.append(system_message)
68
 
69
  for user_msg, assistant_msg in history:
@@ -100,8 +101,8 @@ ASSISTANT:`
100
  # top_k=50, # Another sampling param
101
  )
102
 
103
- # Ensure temperature is valid
104
- if generation_kwargs['temperature'] <= 0:
105
  generation_kwargs['temperature'] = 0.01 # A very small value for near-deterministic
106
  generation_kwargs['do_sample'] = False
107
  else:
 
60
  if system_message and system_message.strip():
61
  # How a system message is used can vary. For this model, prepending it might work.
62
  # Or, it could be part of the initial "USER:" turn if the model expects that.
63
+ # The example prompt format for some models is:
64
+ # USER: {prompt}
65
+ # ASSISTANT: {response}
66
  # We will integrate system_message as part of the first user turn or as general context.
67
+ # For now, let's prepend it simply to the overall prompt.
68
  prompt_parts.append(system_message)
69
 
70
  for user_msg, assistant_msg in history:
 
101
  # top_k=50, # Another sampling param
102
  )
103
 
104
+ # Ensure temperature is valid for sampling
105
+ if generation_kwargs['temperature'] <= 1e-4: # Using a small epsilon for float comparison
106
  generation_kwargs['temperature'] = 0.01 # A very small value for near-deterministic
107
  generation_kwargs['do_sample'] = False
108
  else: