模型:
helenai/papluca-xlm-roberta-base-language-detection-ov
这是将模型转换为 OpenVINO ,以加快推理速度的 papluca/xlm-roberta-base-language-detection 模型。
如下是对该模型进行推断的示例:
from optimum.intel.openvino import OVModelForSequenceClassification from transformers import AutoTokenizer, pipeline # model_id should be set to either a local directory or a model available on the HuggingFace hub. model_id = "helenai/papluca-xlm-roberta-base-language-detection-ov" tokenizer = AutoTokenizer.from_pretrained(model_id) model = OVModelForSequenceClassification.from_pretrained(model_id) pipe = pipeline("text-classification", model=model, tokenizer=tokenizer) result = pipe("hello world") print(result)