Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultModelTemplateForMachineTranslation is the template for machine translations models. // You can use it as the basis for constructing the default model name for the desired source // and target languages pair (iso-a2), or you can use the convenient function DefaultModelForMachineTranslation. // Model card: https://huggingface.co/Helsinki-NLP DefaultModelTemplateForMachineTranslation = "Helsinki-NLP/opus-mt-%s-%s" // DefaultModelForTextParaphrasing is a summarization model fine-tuned for text paraphrasing. // Model card: https://huggingface.co/tuner007/pegasus_paraphrase DefaultModelForTextParaphrasing = "tuner007/pegasus_paraphrase" // DefaultModelForTextSummarization is a summarization model. // Model card: https://huggingface.co/facebook/bart-large-cnn DefaultModelForTextSummarization = "facebook/bart-large-cnn" // DefaultModelForTextSummarization2 is a summarization model. // Model card: https://huggingface.co/google/pegasus-multi_news DefaultModelForTextSummarization2 = "google/pegasus-multi_news" // DefaultModelForExtremeTextSummarization is a summarization model that tries to generate one-sentence answering // the question “What is the article about?”. // Model card: https://huggingface.co/facebook/bart-large-xsum DefaultModelForExtremeTextSummarization = "facebook/bart-large-xsum" // DefaultModelForAbstractiveQuestionAnswering is a summarization model fine-tuned for answer generation. // Model card: https://huggingface.co/vblagoje/bart_lfqa/tree/main DefaultModelForAbstractiveQuestionAnswering = "vblagoje/bart_lfqa" // DefaultModelForKeywordsGeneration is a text generation model that produces a concatenated sequence of keyphrases. // Model card: https://huggingface.co/bloomberg/KeyBART DefaultModelForKeywordsGeneration = "bloomberg/KeyBART" )
Variables ¶
View Source
var ErrInputSequenceTooLong = errors.New("input sequence too long")
ErrInputSequenceTooLong means that pre-processing the input text produced a sequence that exceeds the maximum allowed length.
Functions ¶
func DefaultModelForMachineTranslation ¶
DefaultModelForMachineTranslation specializes the model template for the source and target languages (iso-a2).
func PrepareInputForAbstractiveQuestionAnswering ¶
PrepareInputForAbstractiveQuestionAnswering returns text to be input to the DefaultModelForAbstractiveQuestionAnswering.
Types ¶
type Interface ¶
type Interface interface { // Generate generates text (e.g. translation, summarization, paraphrase) from the given input. Generate(ctx context.Context, text string, opts *Options) (Response, error) }
Interface defines the main functions for the TextGeneration task.
type Options ¶
type Options struct { // Temperature is the temperature used for sampling. Temperature nullable.Type[float64] // Sample is whether to sample or greedy generation. Sample nullable.Type[bool] // TopK is the number of top-k candidates to be considered during generation. TopK nullable.Type[int] // TopP is the top-p candidates to be considered during generation. TopP nullable.Type[float64] }
Options defines the options for generating text.
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions returns the default options for generating text.
func DefaultOptionsForTextParaphrasing ¶
func DefaultOptionsForTextParaphrasing() *Options
DefaultOptionsForTextParaphrasing returns the default options for generating text with sampling.
Click to show internal directories.
Click to hide internal directories.