Radosław Wolnik commited on
Commit
9c551fd
·
1 Parent(s): 89e328a
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import discord
 
2
  from discord.ext import commands
3
  from ChatAI.chat_ai import pipe as ai
4
 
@@ -17,7 +18,6 @@ message_counts = {}
17
  async def on_message(message):
18
  guild = message.guild # Get the guild (server) the message is from
19
  channel = discord.utils.get(guild.text_channels, name=DEFAULT_CHATTER_CHANNEL)
20
-
21
  # Verification
22
  if message.channel != channel or message.author.bot: return;
23
  # Ensure tracking exists for this channel
@@ -51,17 +51,19 @@ async def respond_to_chat(message: str) ->str:
51
  await channel.send(part)
52
  return str("\n".join(parts))
53
 
 
 
54
 
55
  def split_string(text: str) -> list[str]:
56
  """Helper function to split text into chunks"""
57
  return [text[i:i+3900] for i in range(0, len(text), 3900)]
58
 
59
  def generate(
60
- prompt, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0
61
  ):
 
62
  temperature = float(temperature)
63
- if temperature < 1e-2:
64
- temperature = 1e-2
65
  top_p = float(top_p)
66
 
67
  generate_kwargs = dict(
 
1
  import discord
2
+ import random
3
  from discord.ext import commands
4
  from ChatAI.chat_ai import pipe as ai
5
 
 
18
  async def on_message(message):
19
  guild = message.guild # Get the guild (server) the message is from
20
  channel = discord.utils.get(guild.text_channels, name=DEFAULT_CHATTER_CHANNEL)
 
21
  # Verification
22
  if message.channel != channel or message.author.bot: return;
23
  # Ensure tracking exists for this channel
 
51
  await channel.send(part)
52
  return str("\n".join(parts))
53
 
54
+ def x():
55
+ pass
56
 
57
  def split_string(text: str) -> list[str]:
58
  """Helper function to split text into chunks"""
59
  return [text[i:i+3900] for i in range(0, len(text), 3900)]
60
 
61
  def generate(
62
+ prompt, temperature=0.0, max_new_tokens=2048, top_p=0.95, repetition_penalty=1.0
63
  ):
64
+ if temperature == 0.0: temperature = random.uniform(1e-2, 0.9)
65
  temperature = float(temperature)
66
+
 
67
  top_p = float(top_p)
68
 
69
  generate_kwargs = dict(