Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to🌟 [Buil
|
|
38 |
"""
|
39 |
|
40 |
# Initialize model and tokenizer
|
41 |
-
model_id = "OpenLLM-France/Lucie-7B-Instruct"
|
42 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
43 |
|
44 |
# Get the token from environment variables
|
@@ -77,13 +77,29 @@ def format_model_info(config):
|
|
77 |
value = value.name
|
78 |
info.append(f"**{key}:** {value}")
|
79 |
return "\n".join(info)
|
|
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
@spaces.GPU
|
82 |
def generate_response(system_prompt, user_prompt, temperature, max_new_tokens, top_p, repetition_penalty, top_k):
|
83 |
# Construct the full prompt with system and user messages
|
84 |
-
full_prompt = f"""<|
|
85 |
-
|
86 |
-
<|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
# Prepare the input prompt
|
89 |
inputs = tokenizer(full_prompt, return_tensors="pt").to(device)
|
|
|
38 |
"""
|
39 |
|
40 |
# Initialize model and tokenizer
|
41 |
+
model_id = "OpenLLM-France/Lucie-7B-Instruct-v1.1"
|
42 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
43 |
|
44 |
# Get the token from environment variables
|
|
|
77 |
value = value.name
|
78 |
info.append(f"**{key}:** {value}")
|
79 |
return "\n".join(info)
|
80 |
+
|
81 |
|
82 |
+
|
83 |
+
<s><|start_header_id|>system<|end_header_id|>
|
84 |
+
|
85 |
+
{SYSTEM}<|eot_id|><|start_header_id|>user<|end_header_id|>
|
86 |
+
|
87 |
+
{INPUT}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
|
88 |
+
|
89 |
+
{OUTPUT}<|eot_id|>
|
90 |
+
|
91 |
@spaces.GPU
|
92 |
def generate_response(system_prompt, user_prompt, temperature, max_new_tokens, top_p, repetition_penalty, top_k):
|
93 |
# Construct the full prompt with system and user messages
|
94 |
+
full_prompt = f"""<s><|start_header_id|>system<|end_header_id|>
|
95 |
+
|
96 |
+
{user_prompt}<|eot_id|><|start_header_id|>user<|end_header_id|>
|
97 |
+
|
98 |
+
{user_prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>"""
|
99 |
+
|
100 |
+
# <|system|>{system_prompt}</s>
|
101 |
+
# <|user|>{user_prompt}</s>
|
102 |
+
# <|assistant|>"""
|
103 |
|
104 |
# Prepare the input prompt
|
105 |
inputs = tokenizer(full_prompt, return_tensors="pt").to(device)
|