英文

t5-small-ov

这是将 t5-small 模型转换为 OpenVINO 的模型,用于加速推理。

模型权重被压缩为FP16。

基于 T5 documentation 的示例,如何对此模型进行推理:

from optimum.intel.openvino import OVModelForSeq2SeqLM
from transformers import AutoTokenizer, pipeline

model_id = "t5-small-ov"
model = OVModelForSeq2SeqLM.from_pretrained(model_id)
tokenizer = AutoTokenizer.from_pretrained(model_id)
input_ids = tokenizer("translate English to German: The house is wonderful.", return_tensors="pt").input_ids
outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))