knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(huggingfaceR)
This vignette is the third of a three-part set which aims at two things:
To get users new to Hugging Face's transformers
library familiar with the three main abstractions:
Pipelines
Tokenizers
Models
To give users familiar with transformers
a whistle-stop tour of the syntax they'll need to get started with each abstraction.
TODO (discuss with Sam&Alex whether this will be the recommendation)
We recommend starting with the Introduction To Pipelines
vignette, as this gives users the quickest path to using tokenizers and models in tandem and is the highest-level abstraction.
It's important to remember when using Python that everything is an object. Models are no different, and the models that we use via transformers
are a special type of model object - namely AutoModel objects.
As you get more comfortable using the huggingfaceR
/ transformers
you'll gain an appreciation for why it's important to differentiate AutoModel's from AutoModelForX's - but for now it's ok to just be aware that there is a difference.
model <- hf_load_model("bert-base-uncased") task_model <- hf_load_AutoModel( model_type = "AutoModelForSequenceClassification", model_id = "bert-base-uncased" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.