赞
踩
google colab 运行成功:
from transformers import AutoTokenizer, AutoModel,pipeline
from huggingface_hub.hf_api import HfFolder
HfFolder.save_token('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')
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer,MT5ForConditionalGeneration
checkpoint = "distilbert/distilbert-base-uncased-finetuned-sst-2-english"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModel.from_pretrained(checkpoint)
classifier = pipeline("sentiment-analysis", model=checkpoint,tokenizer=tokenizer)
print(classifier("I hate this"));
print(classifier(["I hate this","I love you"]));
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。