bart

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2021 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package bart implements the transformer model introduced by Mike et al., 2019. "BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension" https://arxiv.org/abs/1910.13461

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	nn.BaseModel
	Config     config.Config
	Embeddings *embeddings.Model
	Encoder    *encoder.Model
	Decoder    *decoder.Model
}

Model implements a BART model.

func New

func New(config config.Config, embeddingsStoragePath string) *Model

New returns a new BART Model.

func (*Model) Close

func (m *Model) Close()

Close closes the BART model's embeddings DB.

func (*Model) Decode added in v0.5.0

func (m *Model) Decode(
	inputIDs []int,
	encoderHiddenStates []ag.Node,
	pastKeysValuesPairs decoder.KeysValuesPairs,
) ([]ag.Node, decoder.KeysValuesPairs)

Decode performs the BART decoding.

func (*Model) Encode

func (m *Model) Encode(inputIDs []int) []ag.Node

Encode performs the BART encoding.

func (*Model) Process added in v0.5.0

func (m *Model) Process(inputIDs []int) []ag.Node

Process performs the forward step for each input and returns the result.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL