HuggingFace镜像/MT5_en_to_persian
模型介绍文件和版本分析
下载使用量0

在 openmind 中的使用方法

from openmind import pipeline, is_torch_npu_available

path_to_model = "huangjingwang/MT5_en_to_persian"

if is_torch_npu_available():
    print("NPU available, use device_map='auto'.")
    device_map = "npu"
else:
    print("NPU not available, use device_map='cpu'.")
    device_map = "cpu"
pipe = pipeline("translation", model=path_to_model)

input_text = "grammar: " + "If you bought something goregous, you well be very happy."

output = pipe(input_text, max_length=50)
print("Task translation")
print(input_text)
print(output[0])

# ["If you bought something gorgeous, you will be very happy."]