hf_ez_text_generation: Generate Text from a Prompt

View source: R/ez.R

hf_ez_text_generationR Documentation

Generate Text from a Prompt

Description

Use to continue text from a prompt. This is a very generic task.

Usage

hf_ez_text_generation(model_id = "gpt2", use_api = FALSE)

Arguments

model_id

A model_id. Run hf_search_models(...) for model_ids. Defaults to 'gpt2'.

use_api

Whether to use the Inference API to run the model (TRUE) or download and run the model locally (FALSE). Defaults to FALSE

Value

A text generation object

See Also

https://huggingface.co/docs/api-inference/detailed_parameters#text-generation-task

Examples

## Not run: 
# Load the default model and use local inference
ez <- hf_ez_text_generation()
ez$infer(string = 'The answer to the universe is')

# Use the api for inference.
ez <- hf_ez_text_generation(use_api = TRUE)
ez$infer(string = 'The answer to the universe is')

## End(Not run)

farach/huggingfaceR documentation built on Feb. 4, 2023, 10:31 p.m.