Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -18,6 +18,14 @@ class Item(BaseModel):
|
|
| 18 |
#repetition_penalty: float = 1.0
|
| 19 |
#trust_remote_code = True
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
def format_prompt(message, history):
|
| 22 |
prompt = "<s>"
|
| 23 |
for user_prompt, bot_response in history:
|
|
@@ -43,7 +51,7 @@ def generate(item: Item):
|
|
| 43 |
|
| 44 |
#formatted_prompt = format_prompt(f"{item.system_prompt}, {item.prompt}", item.history)
|
| 45 |
text = item.prompt
|
| 46 |
-
|
| 47 |
labels = ["Requirement", "Information"]
|
| 48 |
stream = client.zero_shot_classification(text, labels)
|
| 49 |
#stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
|
|
|
| 18 |
#repetition_penalty: float = 1.0
|
| 19 |
#trust_remote_code = True
|
| 20 |
|
| 21 |
+
#def format_prompt(message, history):
|
| 22 |
+
# prompt = "<s>"
|
| 23 |
+
# for user_prompt, bot_response in history:
|
| 24 |
+
# prompt += f"[INST] {user_prompt} [/INST]"
|
| 25 |
+
# prompt += f" {bot_response}</s> "
|
| 26 |
+
# prompt += f"[INST] {message} [/INST]"
|
| 27 |
+
# return prompt
|
| 28 |
+
|
| 29 |
def format_prompt(message, history):
|
| 30 |
prompt = "<s>"
|
| 31 |
for user_prompt, bot_response in history:
|
|
|
|
| 51 |
|
| 52 |
#formatted_prompt = format_prompt(f"{item.system_prompt}, {item.prompt}", item.history)
|
| 53 |
text = item.prompt
|
| 54 |
+
print(item.prompt)
|
| 55 |
labels = ["Requirement", "Information"]
|
| 56 |
stream = client.zero_shot_classification(text, labels)
|
| 57 |
#stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|