Views
No views yet

import torch
from transformers import AutoModelForCausalLM
from transformers import AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("DeyangKong/Qwen1.5-7B-Translator", torch_dtype=torch.float16, device_map="auto", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("DeyangKong/Qwen1.5-7B-Translator", trust_remote_code=True)
sentence = "Photocatalytic reduction of nitrate with TiO2 progressed with varied kinetics and to different products based on applied wavelengths."
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": f"As a professional translator, you're requested to convey the following English text into Chinese, ensuring the exactitude of specialized terminology:\n{sentence}"}
]
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
generated_ids = model.generate(encodeds, max_new_tokens=1024)
decoded = tokenizer.batch_decode(generated_ids)
print(decoded[0])Given your proficiency in English-Chinese translation, please ensure the following text is translated with precision, especially concerning technical and specialized terms:
Utilize your translation skills to accurately transform the following English sentences into Chinese, paying special attention to the proper translation of technical terms:
As a professional translator, you're requested to convey the following English text into Chinese, ensuring the exactitude of specialized terminology:
In your role as a language translation authority, accurately interpret the next English segment into Chinese, with emphasis on the precise translation of terminologies:
You are tasked with translating the subsequent English text into Chinese, as a translation specialist, ensuring that all technical terms are accurately translated:
Drawing upon your translation expertise, please meticulously translate the following English text into Chinese, ensuring the fidelity of specialized terms: