ranamhamoud commited on
Commit
2db8be7
·
verified ·
1 Parent(s): 7be189a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -11,7 +11,7 @@ from peft import PeftModel
11
 
12
  # Constants
13
  MAX_MAX_NEW_TOKENS = 2048
14
- DEFAULT_MAX_NEW_TOKENS = 1024
15
  MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
16
 
17
  # Description and License Texts
@@ -54,7 +54,7 @@ class Story(Document):
54
 
55
  # Utility function for prompts
56
  def make_prompt(entry):
57
- return f"### Human: Don't repeat the assesments, limit to 1024 tokens ONLY {entry} ### Assistant:"
58
  # f"TELL A STORY, RELATE TO COMPUTER SCIENCE, INCLUDE ASSESMENTS. MAKE IT REALISTIC AND AROUND 800 WORDS, END THE STORY WITH "THE END.": {entry}"
59
 
60
  def process_text(text):
@@ -68,9 +68,9 @@ def generate(
68
  message: str,
69
  chat_history: list[tuple[str, str]],
70
  max_new_tokens: int = DEFAULT_MAX_NEW_TOKENS,
71
- temperature: float = 0.6,
72
  top_p: float = 0.7,
73
- top_k: int = 20,
74
  repetition_penalty: float = 1.0,
75
  ) -> Iterator[str]:
76
  conversation = []
 
11
 
12
  # Constants
13
  MAX_MAX_NEW_TOKENS = 2048
14
+ DEFAULT_MAX_NEW_TOKENS = 900
15
  MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
16
 
17
  # Description and License Texts
 
54
 
55
  # Utility function for prompts
56
  def make_prompt(entry):
57
+ return f"### Human:{entry} ### Assistant:"
58
  # f"TELL A STORY, RELATE TO COMPUTER SCIENCE, INCLUDE ASSESMENTS. MAKE IT REALISTIC AND AROUND 800 WORDS, END THE STORY WITH "THE END.": {entry}"
59
 
60
  def process_text(text):
 
68
  message: str,
69
  chat_history: list[tuple[str, str]],
70
  max_new_tokens: int = DEFAULT_MAX_NEW_TOKENS,
71
+ temperature: float = 0.8,
72
  top_p: float = 0.7,
73
+ top_k: int = 30,
74
  repetition_penalty: float = 1.0,
75
  ) -> Iterator[str]:
76
  conversation = []