Spaces:
Paused
Paused
Update app.py
Browse files
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 =
|
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:
|
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.
|
72 |
top_p: float = 0.7,
|
73 |
-
top_k: int =
|
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 = []
|