Spaces:
Running
Running
Commit
·
649259c
1
Parent(s):
3804b73
bugfix: fix minor bugs
Browse files
utils/completion_reward.py
CHANGED
@@ -205,7 +205,7 @@ class OpenAIAgent:
|
|
205 |
self.temperature = 0.8
|
206 |
self.frequency_penalty = 0
|
207 |
self.presence_penalty = 0
|
208 |
-
self.max_tokens =
|
209 |
|
210 |
def get_story(self, user_log):
|
211 |
system_prompt = """
|
@@ -306,7 +306,7 @@ class AWSAgent:
|
|
306 |
try:
|
307 |
completion = client.completions.create(
|
308 |
model="anthropic.claude-v2",
|
309 |
-
max_tokens_to_sample=
|
310 |
prompt=f"{anthropic_bedrock.HUMAN_PROMPT}{system_prompt},以下是我的故事紀錄```{user_log}``` {anthropic_bedrock.AI_PROMPT}",
|
311 |
)
|
312 |
chinese_converter = OpenCC("s2tw")
|
@@ -511,10 +511,10 @@ class ImageProcessor:
|
|
511 |
body_x, body_y = left + 20, title_y + 60 # Adjust position as needed
|
512 |
|
513 |
for line in paragraph.split("\n"):
|
514 |
-
wrapped_lines = textwrap.wrap(line, width=
|
515 |
for wrapped_line in wrapped_lines:
|
516 |
draw.text((body_x, body_y), wrapped_line, font=body_font, fill="black")
|
517 |
-
body_y +=
|
518 |
|
519 |
# Save the image with the text
|
520 |
|
|
|
205 |
self.temperature = 0.8
|
206 |
self.frequency_penalty = 0
|
207 |
self.presence_penalty = 0
|
208 |
+
self.max_tokens = 2048
|
209 |
|
210 |
def get_story(self, user_log):
|
211 |
system_prompt = """
|
|
|
306 |
try:
|
307 |
completion = client.completions.create(
|
308 |
model="anthropic.claude-v2",
|
309 |
+
max_tokens_to_sample=2048,
|
310 |
prompt=f"{anthropic_bedrock.HUMAN_PROMPT}{system_prompt},以下是我的故事紀錄```{user_log}``` {anthropic_bedrock.AI_PROMPT}",
|
311 |
)
|
312 |
chinese_converter = OpenCC("s2tw")
|
|
|
511 |
body_x, body_y = left + 20, title_y + 60 # Adjust position as needed
|
512 |
|
513 |
for line in paragraph.split("\n"):
|
514 |
+
wrapped_lines = textwrap.wrap(line, width=55)
|
515 |
for wrapped_line in wrapped_lines:
|
516 |
draw.text((body_x, body_y), wrapped_line, font=body_font, fill="black")
|
517 |
+
body_y += 20
|
518 |
|
519 |
# Save the image with the text
|
520 |
|