Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,11 +26,7 @@ LICENSE = """
|
|
| 26 |
As a derivate work of [Llama-2-7b-chat](https://huggingface.co/meta-llama/Llama-2-7b-chat) by Meta,
|
| 27 |
this demo is governed by the original [license](https://huggingface.co/spaces/huggingface-projects/llama-2-7b-chat/blob/main/LICENSE.txt) and [acceptable use policy](https://huggingface.co/spaces/huggingface-projects/llama-2-7b-chat/blob/main/USE_POLICY.md).
|
| 28 |
"""
|
| 29 |
-
|
| 30 |
-
<p/>
|
| 31 |
-
---
|
| 32 |
-
Keep in mind that the examples are cached.
|
| 33 |
-
"""
|
| 34 |
if not torch.cuda.is_available():
|
| 35 |
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"
|
| 36 |
|
|
@@ -55,17 +51,18 @@ class Story(Document):
|
|
| 55 |
story_id = SequenceField(primary_key=True)
|
| 56 |
|
| 57 |
def make_prompt(entry):
|
| 58 |
-
return f"### Human: YOUR INSTRUCTION HERE,ALWAYS USE A STORY,INCLUDE ASSESMENTS THROUGHOUT AND A TECHNICAL SUMMARY: {entry} ### Assistant:"
|
| 59 |
|
| 60 |
@spaces.GPU
|
| 61 |
def generate(
|
| 62 |
message: str,
|
| 63 |
chat_history: list[tuple[str, str]],
|
| 64 |
max_new_tokens: int = 1024,
|
| 65 |
-
temperature: float = 0.
|
| 66 |
-
top_p: float = 0.
|
| 67 |
-
top_k: int =
|
| 68 |
-
repetition_penalty: float = 1.
|
|
|
|
| 69 |
) -> Iterator[str]:
|
| 70 |
conversation = []
|
| 71 |
for user, assistant in chat_history:
|
|
@@ -119,7 +116,6 @@ chat_interface = gr.ChatInterface(
|
|
| 119 |
with gr.Blocks(css="style.css") as demo:
|
| 120 |
gr.Markdown(DESCRIPTION)
|
| 121 |
chat_interface.render()
|
| 122 |
-
gr.Markdown(EXAMPLES)
|
| 123 |
gr.Markdown(LICENSE)
|
| 124 |
|
| 125 |
if __name__ == "__main__":
|
|
|
|
| 26 |
As a derivate work of [Llama-2-7b-chat](https://huggingface.co/meta-llama/Llama-2-7b-chat) by Meta,
|
| 27 |
this demo is governed by the original [license](https://huggingface.co/spaces/huggingface-projects/llama-2-7b-chat/blob/main/LICENSE.txt) and [acceptable use policy](https://huggingface.co/spaces/huggingface-projects/llama-2-7b-chat/blob/main/USE_POLICY.md).
|
| 28 |
"""
|
| 29 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
if not torch.cuda.is_available():
|
| 31 |
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"
|
| 32 |
|
|
|
|
| 51 |
story_id = SequenceField(primary_key=True)
|
| 52 |
|
| 53 |
def make_prompt(entry):
|
| 54 |
+
return f"### Human: YOUR INSTRUCTION HERE,ALWAYS USE A STORY,INCLUDE ASSESMENTS THROUGHOUT AND A TECHNICAL SUMMARY,REPLY BASED ON STORY WHEN USER ANSWERS: {entry} ### Assistant:"
|
| 55 |
|
| 56 |
@spaces.GPU
|
| 57 |
def generate(
|
| 58 |
message: str,
|
| 59 |
chat_history: list[tuple[str, str]],
|
| 60 |
max_new_tokens: int = 1024,
|
| 61 |
+
temperature: float = 0.7,
|
| 62 |
+
top_p: float = 0.8,
|
| 63 |
+
top_k: int = 40,
|
| 64 |
+
repetition_penalty: float = 1.2,
|
| 65 |
+
|
| 66 |
) -> Iterator[str]:
|
| 67 |
conversation = []
|
| 68 |
for user, assistant in chat_history:
|
|
|
|
| 116 |
with gr.Blocks(css="style.css") as demo:
|
| 117 |
gr.Markdown(DESCRIPTION)
|
| 118 |
chat_interface.render()
|
|
|
|
| 119 |
gr.Markdown(LICENSE)
|
| 120 |
|
| 121 |
if __name__ == "__main__":
|