mt0-xl-bf16-sentiment-quadruple

作者 yuyijiong · 下载 3 · 点赞 0 · 更新 2023-11-02

抽取情感四元组、三元组、二元组等

import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("yuyijiong/mt0-xl-bf16-sentiment-quadruple")
model = AutoModelForSeq2SeqLM.from_pretrained("yuyijiong/mt0-xl-bf16-sentiment-quadruple", device_map="auto", torch_dtype=torch.bfloat16)

text = '情感四元组(对象,观点,方面,极性)抽取任务 (补全null): 【已经开了4袋,普遍出现米沾在包装上了,看起来放了很久的样子】'
input_ids = tokenizer(text,return_tensors="pt", padding=True)['input_ids'].cuda(0)
with torch.no_grad():
    with torch.autocast('cuda'):
        output = model.generate(input_ids=input_ids)
output_str = tokenizer.batch_decode(output, skip_special_tokens=True)
print(output_str)

模型信息

该模型卡暂无预览图和文字说明。以下信息来自 Hugging Face。

作者 yuyijiong
类型text2text-generation
基础模型—
标签—
下载3
点赞0
更新时间2023-11-02
Hugging Face https://huggingface.co/yuyijiong/mt0-xl-bf16-sentiment-quadruple