Hugging Face快速入门

Hugging Face快速上手

参考视频: Getting Started With Hugging Face in 15 Minutes
https://www.google.com/search?q=Huggingface+tutorial&oq=Huggingface+tutorial&aqs=chrome…69i57j0l5.9301j0j8&sourceid=chrome&ie=UTF-8#fpstate=ive&vld=cid:61ceeebe,vid:QEaBAZQCtwE

Hugging Face transformer 库是目前最受欢迎的机器学习库,可以帮助初学者快速上手

Tansformers安装

需要先安装好 Pytorch或TensorFlow2.0或Flax
pip install transformers

1. PipeLine-一些可以直接拿来调用的功能模块流程

具体调用方法见下面的例子
from transformers import pipeline
第一个例子使用了情感分析流程的默认模型

from transformers import pipeline
classifier = pipeline("sentiment-analysis") # default model
res = classier("I'd love to learn the HuggingFace course")
print(res)

第二个例子使用了指定的模型

from transformers import pipeline
generator = pipeline("text-generation",model="distilgpt2")
res = generator(
    "In this workshop, we will help you finish",
    max_length=
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值