Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data IsFinished
- data Beams a b where
- data Hypothesis (isFinished :: IsFinished) a b where
- InitialHypothesis :: forall a b. Hypothesis 'Unfinished a b
- UnfinishedHypothesis :: forall a b. {..} -> Hypothesis 'Unfinished a b
- FinishedHypothesis :: forall a b. {..} -> Hypothesis 'Finished a b
- getTokens :: forall a b. Hypothesis 'Unfinished a b -> [a]
- getScore :: forall a b. Hypothesis 'Unfinished a b -> Float
- data SomeHypothesis a b = forall isFinished.SomeHypothesis {
- unSomeHypothesis :: Hypothesis isFinished a b
- beamSearch :: forall a b m. Monad m => Int -> Int -> ([Hypothesis 'Unfinished a b] -> m [SomeHypothesis a b]) -> m [Beams a b]
- beamSearchStep :: forall a b m. Functor m => ([Hypothesis 'Unfinished a b] -> m [SomeHypothesis a b]) -> Beams a b -> m (Beams a b)
- 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]]
- testBeamSearch :: IO ()
- 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
- notNull :: (Monad b, Foldable b) => Parser (StateT [i] b) i a -> StateT [i] b Bool
- hasFree :: (Monad b, Foldable b) => Parser (StateT [i] b) i a -> StateT [i] b Bool
- transParser :: MonadPlus b => Map Int String -> Parser b Char a -> Parser b Int a
- 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
- runParser :: forall model input generatorDevice b a. _ => Int -> model -> input -> Generator generatorDevice -> Parser (StateT [Int] b) Int a -> b (a, [Int])
- t5Text :: MonadPlus b => Parser b Char String
- t5Test :: MonadPlus b => Parser b Char String
- t5Sql :: (TokenParsing (FreeT ((->) Char) b), MonadPlus b) => Parser b Char SpiderSQL
Documentation
Beams | |
|
data Hypothesis (isFinished :: IsFinished) a b where Source #
InitialHypothesis :: forall a b. Hypothesis 'Unfinished a b | |
UnfinishedHypothesis | |
| |
FinishedHypothesis | |
|
Instances
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 #
forall isFinished. SomeHypothesis | |
|
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 #
testBeamSearch :: IO () 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 #
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 #