hasktorch-gradually-typed-0.2.0.0: experimental project for hasktorch
Safe HaskellSafe-Inferred
LanguageHaskell2010

Torch.GraduallyTyped.NN.Transformer.T5.Generation

Synopsis

Documentation

data Beams a b where Source #

Constructors

Beams 

Fields

Instances

Instances details
(Show a, Show b) => Show (Beams a b) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.T5.Generation

Methods

showsPrec :: Int -> Beams a b -> ShowS Source #

show :: Beams a b -> String Source #

showList :: [Beams a b] -> ShowS Source #

data Hypothesis (isFinished :: IsFinished) a b where Source #

Constructors

InitialHypothesis :: forall a b. Hypothesis 'Unfinished a b 
UnfinishedHypothesis 

Fields

FinishedHypothesis 

Fields

Instances

Instances details
(Show a, Show b) => Show (Hypothesis 'Finished a b) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.T5.Generation

(Show a, Show b) => Show (Hypothesis 'Unfinished a b) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.T5.Generation

(Eq a, Eq b) => Eq (Hypothesis 'Finished a b) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.T5.Generation

(Eq a, Eq b) => Eq (Hypothesis 'Unfinished a b) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.T5.Generation

(Ord a, Ord b) => Ord (Hypothesis 'Finished a b) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.T5.Generation

(Ord a, Ord b) => Ord (Hypothesis 'Unfinished a b) Source # 
Instance details

Defined in Torch.GraduallyTyped.NN.Transformer.T5.Generation

getTokens :: forall a b. Hypothesis 'Unfinished a b -> [a] Source #

getScore :: forall a b. Hypothesis 'Unfinished a b -> Float Source #

data SomeHypothesis a b Source #

Constructors

forall isFinished. SomeHypothesis 

Fields

beamSearch :: forall a b m. Monad m => Int -> Int -> ([Hypothesis 'Unfinished a b] -> m [SomeHypothesis a b]) -> m [Beams a b] Source #

beamSearchStep :: forall a b m. Functor m => ([Hypothesis 'Unfinished a b] -> m [SomeHypothesis a b]) -> Beams a b -> m (Beams a b) Source #

runBeamSearch :: forall model input decoderInput encoderOutput encoderOutputShape encoderOutput' inputPaddingMask decoderOutput generatorDevice. (HasForward model (SimplifiedEncoderDecoderTransformerInput input decoderInput) generatorDevice (SimplifiedEncoderDecoderTransformerOutput decoderOutput encoderOutput decoderInput inputPaddingMask) generatorDevice, encoderOutput ~ Tensor ('Gradient 'WithGradient) ('Layout 'Dense) ('Device 'CPU) T5DataType encoderOutputShape, 'UncheckedShape ~ BroadcastShapesF encoderOutputShape 'UncheckedShape, SGetShape encoderOutputShape, HasForward model (SimplifiedEncoderDecoderTransformerGenerationInput decoderInput encoderOutput' inputPaddingMask) generatorDevice (SimplifiedEncoderDecoderTransformerOutput decoderOutput encoderOutput' decoderInput inputPaddingMask) generatorDevice, encoderOutput' ~ Tensor ('Gradient 'WithGradient) ('Layout 'Dense) ('Device 'CPU) T5DataType 'UncheckedShape, decoderInput ~ Tensor ('Gradient 'WithoutGradient) ('Layout 'Dense) ('Device 'CPU) ('DataType 'Int64) ('Shape '['Dim ('Name "*") 'UncheckedSize, 'Dim ('Name "*") 'UncheckedSize]), decoderOutput ~ Tensor ('Gradient 'WithGradient) ('Layout 'Dense) ('Device 'CPU) T5DataType 'UncheckedShape, generatorDevice ~ 'Device 'CPU) => Int -> Int -> model -> input -> Generator generatorDevice -> IO [Beams Int [Int]] Source #

next :: forall t b i a. (i ~ Int, Show i, MonadTrans t, Monad (t (StateT [i] b)), Alternative (t (StateT [i] b)), Monad b, Foldable b) => t (StateT [i] b) i -> Parser (StateT [i] b) i a -> (Parser (StateT [i] b) i a -> t (StateT [i] b) a) -> t (StateT [i] b) a Source #

notNull :: (Monad b, Foldable b) => Parser (StateT [i] b) i a -> StateT [i] b Bool Source #

hasFree :: (Monad b, Foldable b) => Parser (StateT [i] b) i a -> StateT [i] b Bool Source #

transParser :: MonadPlus b => Map Int String -> Parser b Char a -> Parser b Int a Source #

transParser vocab p transforms a parser p over characters Char into a parser over token indices Int using the vocabulary vocab.

getIs :: forall model input generatorDevice b decoderInput encoderOutput decoderOutput inputPaddingMask s. (Alternative b, MonadThrow b, s ~ (Maybe (encoderOutput, inputPaddingMask), Generator generatorDevice), decoderInput ~ Tensor ('Gradient 'WithoutGradient) ('Layout 'Dense) ('Device 'CPU) ('DataType 'Int64) ('Shape '['Dim ('Name "*") ('Size 1), 'Dim ('Name "*") 'UncheckedSize]), decoderOutput ~ Tensor ('Gradient 'WithGradient) ('Layout 'Dense) ('Device 'CPU) T5DataType 'UncheckedShape, HasForward model (SimplifiedEncoderDecoderTransformerInput input decoderInput) generatorDevice (SimplifiedEncoderDecoderTransformerOutput decoderOutput encoderOutput decoderInput inputPaddingMask) generatorDevice, HasForward model (SimplifiedEncoderDecoderTransformerGenerationInput decoderInput encoderOutput inputPaddingMask) generatorDevice (SimplifiedEncoderDecoderTransformerOutput decoderOutput encoderOutput decoderInput inputPaddingMask) generatorDevice) => Int -> model -> input -> StateT s (StateT [Int] b) Int Source #

Get continuations from model

runParser :: forall model input generatorDevice b a. _ => Int -> model -> input -> Generator generatorDevice -> Parser (StateT [Int] b) Int a -> b (a, [Int]) Source #

t5Text :: MonadPlus b => Parser b Char String Source #

t5Text parses a Char sequence delimited by /s as a String.

t5Sql :: (TokenParsing (FreeT ((->) Char) b), MonadPlus b) => Parser b Char SpiderSQL Source #

t5Sql parses a Char sequence starting with " and ending with " /s as SpiderSQL.

Orphan instances

(Alternative b, Foldable b, MonadPlus b) => CharParsing (FreeT ((->) Char) (StateT [Int] b)) Source # 
Instance details

Methods

satisfy :: (Char -> Bool) -> FreeT ((->) Char) (StateT [Int] b) Char Source #

char :: Char -> FreeT ((->) Char) (StateT [Int] b) Char Source #

notChar :: Char -> FreeT ((->) Char) (StateT [Int] b) Char Source #

anyChar :: FreeT ((->) Char) (StateT [Int] b) Char Source #

string :: String -> FreeT ((->) Char) (StateT [Int] b) String Source #

text :: Text -> FreeT ((->) Char) (StateT [Int] b) Text Source #

(Alternative b, Foldable b, MonadPlus b) => Parsing (FreeT ((->) Char) (StateT [Int] b)) Source # 
Instance details

Methods

try :: FreeT ((->) Char) (StateT [Int] b) a -> FreeT ((->) Char) (StateT [Int] b) a Source #

(<?>) :: FreeT ((->) Char) (StateT [Int] b) a -> String -> FreeT ((->) Char) (StateT [Int] b) a Source #

skipMany :: FreeT ((->) Char) (StateT [Int] b) a -> FreeT ((->) Char) (StateT [Int] b) () Source #

skipSome :: FreeT ((->) Char) (StateT [Int] b) a -> FreeT ((->) Char) (StateT [Int] b) () Source #

unexpected :: String -> FreeT ((->) Char) (StateT [Int] b) a Source #

eof :: FreeT ((->) Char) (StateT [Int] b) () Source #

notFollowedBy :: Show a => FreeT ((->) Char) (StateT [Int] b) a -> FreeT ((->) Char) (StateT [Int] b) () Source #

(Alternative b, Foldable b, MonadPlus b) => TokenParsing (FreeT ((->) Char) (StateT [Int] b)) Source # 
Instance details

Methods

someSpace :: FreeT ((->) Char) (StateT [Int] b) () Source #

nesting :: FreeT ((->) Char) (StateT [Int] b) a -> FreeT ((->) Char) (StateT [Int] b) a Source #

semi :: FreeT ((->) Char) (StateT [Int] b) Char Source #

highlight :: Highlight -> FreeT ((->) Char) (StateT [Int] b) a -> FreeT ((->) Char) (StateT [Int] b) a Source #

token :: FreeT ((->) Char) (StateT [Int] b) a -> FreeT ((->) Char) (StateT [Int] b) a Source #