Spaces:
Paused
Paused
Update space
Browse files
app.py
CHANGED
@@ -7,7 +7,25 @@ REPO_ID = "MaziyarPanahi/Meta-Llama-3-70B-Instruct-GGUF"
|
|
7 |
MODEL_NAME = "Meta-Llama-3-70B-Instruct.Q3_K_L.gguf"
|
8 |
MAX_CONTEXT_LENGTH = 8192
|
9 |
CUDA = True
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
TOKEN_STOP = ["<|eot_id|>"]
|
12 |
SYS_MSG = "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nSYSTEM_PROMPT<|eot_id|>\n"
|
13 |
USER_PROMPT = (
|
@@ -18,35 +36,9 @@ END_ASSIS_PREVIOUS_RESPONSE = "<|eot_id|>\n"
|
|
18 |
|
19 |
TASK_PROMPT = {
|
20 |
"Assistant": SYSTEM_PROMPT,
|
21 |
-
"Translate": "You are an expert translator. Translate the following text into English.",
|
22 |
-
"Summarization": "Summarizing information is my specialty. Let me know what you'd like summarized.",
|
23 |
-
"Grammar correction": "Grammar is my forte! Feel free to share the text you'd like me to proofread and correct.",
|
24 |
-
"Stable diffusion prompt generator": "You are a stable diffusion prompt generator. Break down the user's text and create a more elaborate prompt.",
|
25 |
-
"Play Trivia": "Engage the user in a trivia game on various topics.",
|
26 |
-
"Share Fun Facts": "Share interesting and fun facts on various topics.",
|
27 |
-
"Explain code": "You are an expert programmer guiding someone through a piece of code step by step, explaining each line and its function in detail.",
|
28 |
-
"Paraphrase Master": "You have the knack for transforming complex or verbose text into simpler, clearer language while retaining the original meaning and essence.",
|
29 |
-
"Recommend Movies": "Recommend movies based on the user's preferences.",
|
30 |
-
"Offer Motivational Quotes": "Offer motivational quotes to inspire the user.",
|
31 |
-
"Recommend Books": "Recommend books based on the user's favorite genres or interests.",
|
32 |
-
"Philosophical discussion": "Engage the user in a philosophical discussion",
|
33 |
-
"Music recommendation": "Tune time! What kind of music are you in the mood for? I'll find the perfect song for you.",
|
34 |
-
"Generate a Joke": "Generate a witty joke suitable for a stand-up comedy routine.",
|
35 |
-
"Roleplay as a Detective": "Roleplay as a detective interrogating a suspect in a murder case.",
|
36 |
-
"Act as a News Reporter": "Act as a news reporter covering breaking news about an alien invasion.",
|
37 |
-
"Play as a Space Explorer": "Play as a space explorer encountering a new alien civilization.",
|
38 |
-
"Be a Medieval Knight": "Imagine yourself as a medieval knight embarking on a quest to rescue a princess.",
|
39 |
-
"Act as a Superhero": "Act as a superhero saving a city from a supervillain's evil plot.",
|
40 |
-
"Play as a Pirate Captain": "Play as a pirate captain searching for buried treasure on a remote island.",
|
41 |
-
"Be a Famous Celebrity": "Imagine yourself as a famous celebrity attending a glamorous red-carpet event.",
|
42 |
-
"Design a New Invention": "Imagine you're an inventor tasked with designing a revolutionary new invention that will change the world.",
|
43 |
-
"Act as a Time Traveler": "You've just discovered time travel! Describe your adventures as you journey through different eras.",
|
44 |
-
"Play as a Magical Girl": "You are a magical girl with extraordinary powers, battling dark forces to protect your city and friends.",
|
45 |
-
"Act as a Shonen Protagonist": "You are a determined and spirited shonen protagonist on a quest for strength, friendship, and victory.",
|
46 |
-
"Roleplay as a Tsundere Character": "You are a tsundere character, initially cold and aloof but gradually warming up to others through unexpected acts of kindness.",
|
47 |
}
|
48 |
|
49 |
-
css = ".gradio-container {background-image: url('file=./assets/background.png'); background-size: cover; background-position: center; background-repeat: no-repeat;}"
|
50 |
|
51 |
|
52 |
class ChatLLM:
|
@@ -129,7 +121,7 @@ def clear_chat(chat_history_state, chat_message):
|
|
129 |
|
130 |
|
131 |
def gui(llm_chat):
|
132 |
-
with gr.Blocks(theme="NoCrypt/miku"
|
133 |
gr.Markdown("# Llama 3 70B Instruct GGUF")
|
134 |
gr.Markdown(
|
135 |
f"""
|
|
|
7 |
MODEL_NAME = "Meta-Llama-3-70B-Instruct.Q3_K_L.gguf"
|
8 |
MAX_CONTEXT_LENGTH = 8192
|
9 |
CUDA = True
|
10 |
+
|
11 |
+
SYSTEM_PROMPT = "You are controlling a 2 DOF robot on a 50x50 grid. The robot can move one step in any of the four cardinal directions. The robot can perform the following actions:\n\n"
|
12 |
+
"- 'up': Move one unit up (increasing y coordinate by 1).\n"
|
13 |
+
"- 'down': Move one unit down (decreasing y coordinate by 1).\n"
|
14 |
+
"- 'left': Move one unit left (decreasing x coordinate by 1).\n"
|
15 |
+
"- 'right': Move one unit right (increasing x coordinate by 1).\n\n"
|
16 |
+
"Given a target coordinate, your task is to calculate and output the shortest sequence of commands that will move the robot from its current position to the target position.\n\n"
|
17 |
+
"Output Format:\n"
|
18 |
+
"- Begin with the exact phrase: 'The full list is:'.\n"
|
19 |
+
"- Provide the sequence of commands as a JSON array, with each command as a string. Commands must be exactly 'up', 'down', 'left', or 'right'.\n"
|
20 |
+
"- All coordinates should be formatted as JSON objects with keys 'x' and 'y' and integer values. For example, the starting position should be output as {'x': 0, 'y': 0}.\n"
|
21 |
+
"- When calling tools, ensure that all arguments use this JSON object format for coordinates, with keys 'x' and 'y'.\n"
|
22 |
+
"- Example of correct output:\n"
|
23 |
+
" If the target coordinate is {'x': 2, 'y': 3}, your response should include:\n"
|
24 |
+
" 'The full list is: [\"right\", \"right\", \"up\", \"up\", \"up\"]'\n"
|
25 |
+
" And for tool calls, use:\n"
|
26 |
+
" 'tool_calls': [{'function': {'name': 'validate_path', 'arguments': {'commands': [\"right\", \"right\", \"up\", \"up\", \"up\"], 'start_position': {'x': 0, 'y': 0}, 'target_position': {'x': 2, 'y': 3}}}}]'\n\n"
|
27 |
+
"Please ensure that all output strictly adheres to these formats. If any output is not in the correct format, redo the task and correct the output before providing the final answer."
|
28 |
+
|
29 |
TOKEN_STOP = ["<|eot_id|>"]
|
30 |
SYS_MSG = "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nSYSTEM_PROMPT<|eot_id|>\n"
|
31 |
USER_PROMPT = (
|
|
|
36 |
|
37 |
TASK_PROMPT = {
|
38 |
"Assistant": SYSTEM_PROMPT,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
+
# css = ".gradio-container {background-image: url('file=./assets/background.png'); background-size: cover; background-position: center; background-repeat: no-repeat;}"
|
42 |
|
43 |
|
44 |
class ChatLLM:
|
|
|
121 |
|
122 |
|
123 |
def gui(llm_chat):
|
124 |
+
with gr.Blocks(theme="NoCrypt/miku") as app:
|
125 |
gr.Markdown("# Llama 3 70B Instruct GGUF")
|
126 |
gr.Markdown(
|
127 |
f"""
|