| hf_ez_fill_mask | R Documentation |
Tries to fill in a hole with a missing word (token to be precise). That’s the base task for BERT models.
hf_ez_fill_mask(model_id = "google-bert/bert-base-uncased", use_api = FALSE)
model_id |
A model_id. Run hf_search_models(...) for model_ids. Defaults to 'bert-base-uncased'. |
use_api |
Whether to use the Inference API to run the model (TRUE) or download and run the model locally (FALSE). Defaults to FALSE |
A fill mask object
https://huggingface.co/docs/api-inference/detailed_parameters#fill-mask-task
## Not run:
# Load the default model and use local inference
ez <- hf_ez_fill_mask()
ez$infer(string = "The answer to the universe is [MASK].")
# Load a specific model and use the API for inference.
# Note the mask is different for different models.
ez <- hf_ez_fill_mask(model_id = 'xlm-roberta-base', use_api = TRUE)
ez$infer(string = "The answer to the universe is <MASK>.")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.