Update app.py
Browse files
app.py
CHANGED
|
@@ -145,7 +145,7 @@ class Translators:
|
|
| 145 |
prompt = f"Translate the following segment into {self.tl}, without additional explanation.\n\n{self.input_text}."
|
| 146 |
tokenizer = AutoTokenizer.from_pretrained(self.model_name)
|
| 147 |
model = AutoModelForCausalLM.from_pretrained(self.model_name, device_map="auto", dtype=torch.bfloat16)
|
| 148 |
-
systemprompt = {"role": "system", "content": "You are a professional translator, translating in a formal tone and providing only translation, no other comments or explanations"
|
| 149 |
messages = [systemprompt, {"role": "user", "content": prompt}]
|
| 150 |
# Tokenize the conversation
|
| 151 |
tokenized_chat = tokenizer.apply_chat_template(
|
|
|
|
| 145 |
prompt = f"Translate the following segment into {self.tl}, without additional explanation.\n\n{self.input_text}."
|
| 146 |
tokenizer = AutoTokenizer.from_pretrained(self.model_name)
|
| 147 |
model = AutoModelForCausalLM.from_pretrained(self.model_name, device_map="auto", dtype=torch.bfloat16)
|
| 148 |
+
systemprompt = {"role": "system", "content": "You are a professional translator, translating in a formal tone and providing only translation, no other comments or explanations"}
|
| 149 |
messages = [systemprompt, {"role": "user", "content": prompt}]
|
| 150 |
# Tokenize the conversation
|
| 151 |
tokenized_chat = tokenizer.apply_chat_template(
|