Spaces:
Runtime error
Runtime error
lhzstar
commited on
Commit
•
56e0560
1
Parent(s):
b7b070d
new commits
Browse files- celebbot.py +2 -2
celebbot.py
CHANGED
@@ -103,11 +103,11 @@ class CelebBot():
|
|
103 |
## have a conversation
|
104 |
else:
|
105 |
if re.search(re.compile(rf'\b(you|your|{self.name})\b', flags=re.IGNORECASE), self.text) != None:
|
106 |
-
instruction1 = f
|
107 |
|
108 |
knowledge = self.retrieve_knowledge_assertions()
|
109 |
else:
|
110 |
-
instruction1 = f'
|
111 |
query = f"Context: {instruction1} {knowledge}\n\nQuestion: {self.text}\n\nAnswer:"
|
112 |
input_ids = self.QA_tokenizer(f"{query}", return_tensors="pt").input_ids
|
113 |
outputs = self.QA_model.generate(input_ids, max_length=1024)
|
|
|
103 |
## have a conversation
|
104 |
else:
|
105 |
if re.search(re.compile(rf'\b(you|your|{self.name})\b', flags=re.IGNORECASE), self.text) != None:
|
106 |
+
instruction1 = f"You are a celebrity named {self.name}. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."
|
107 |
|
108 |
knowledge = self.retrieve_knowledge_assertions()
|
109 |
else:
|
110 |
+
instruction1 = f"Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."
|
111 |
query = f"Context: {instruction1} {knowledge}\n\nQuestion: {self.text}\n\nAnswer:"
|
112 |
input_ids = self.QA_tokenizer(f"{query}", return_tensors="pt").input_ids
|
113 |
outputs = self.QA_model.generate(input_ids, max_length=1024)
|