| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
RL.Model
Synopsis
- activation :: forall (dev :: (DeviceType, Nat)) (shape :: [Nat]). IsValidDevice dev => QTensor dev shape -> QTensor dev shape
- expandAs :: Tensor -> Tensor -> Tensor
- traceDyn :: forall (a :: (DeviceType, Nat)) (b :: DType) (c :: [Nat]). Tensor a b c -> Tensor a b c
- unsafeReshape :: forall (dev :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) (shape' :: [Nat]). [Int] -> Tensor dev dtype shape -> Tensor dev dtype shape'
- data ConstEmbSpec (dev :: k) (shape :: [Nat]) = ConstEmbSpec
- newtype ConstEmb (dev :: (DeviceType, Nat)) (shape :: [Nat]) = ConstEmb (Parameter dev QDType shape)
- data SliceSpec (dev :: k) = SliceSpec
- data SliceEncoder (dev :: (DeviceType, Nat)) = SliceEncoder {}
- data TransitionSpec (dev :: k) = TransitionSpec
- data TransitionEncoder (dev :: (DeviceType, Nat)) = TransitionEncoder {
- trL1Passing :: !(Conv2d 2 QTransHidden FifthSize OctaveSize QDType dev)
- trL1Inner :: !(Conv2d 2 QTransHidden FifthSize OctaveSize QDType dev)
- trL1Left :: !(Conv2d 1 QTransHidden 1 1 QDType dev)
- trL1Right :: !(Conv2d 1 QTransHidden 1 1 QDType dev)
- trL1Root :: !(ConstEmb dev '[QTransHidden])
- trL2 :: !(Conv2d QTransHidden EmbSize FifthSize OctaveSize QDType dev)
- data ActionSpec (dev :: k) = ActionSpec
- data ActionEncoder (dev :: (DeviceType, Nat)) = ActionEncoder {
- actTop1sl :: !(Conv2d EmbSize QActionHidden FifthSize OctaveSize QDType dev)
- actTop1sm :: !(Conv2d EmbSize QActionHidden FifthSize OctaveSize QDType dev)
- actTop1sr :: !(Conv2d EmbSize QActionHidden FifthSize OctaveSize QDType dev)
- actTop1t1 :: !(Conv2d EmbSize QActionHidden FifthSize OctaveSize QDType dev)
- actTop1t2 :: !(Conv2d EmbSize QActionHidden FifthSize OctaveSize QDType dev)
- actTop2 :: !(Conv2d QActionHidden EmbSize FifthSize OctaveSize QDType dev)
- actSplit :: ConstEmb dev '[EmbSize - 3]
- actSpread :: ConstEmb dev '[EmbSize - 3]
- actFreeze :: ConstEmb dev '[EmbSize - 3]
- opTypes :: forall (dev :: (DeviceType, Nat)). KnownDevice dev => QTensor dev '[6, 3]
- data StateSpec (dev :: k) = StateSpec
- data StateEncoder (dev :: (DeviceType, Nat)) = StateEncoder {
- stL1mid :: Conv2d EmbSize QStateHidden FifthSize OctaveSize QDType dev
- stL1frozenSlc :: Conv2d EmbSize QStateHidden FifthSize OctaveSize QDType dev
- stL1frozenTr :: Conv2d EmbSize QStateHidden FifthSize OctaveSize QDType dev
- stL1openSlc :: Conv2d EmbSize QStateHidden FifthSize OctaveSize QDType dev
- stL1openTr :: Conv2d EmbSize QStateHidden FifthSize OctaveSize QDType dev
- stL2 :: Conv2d QStateHidden QStateHidden FifthSize OctaveSize QDType dev
- stL3 :: Conv2d QStateHidden EmbSize FifthSize OctaveSize QDType dev
- data QSpec (dev :: k) = QSpec
- data QModel (dev :: (DeviceType, Nat)) = QModel {
- qModelSlc :: !(SliceEncoder dev)
- qModelTr :: !(TransitionEncoder dev)
- qModelAct :: !(ActionEncoder dev)
- qModelSt :: !(StateEncoder dev)
- qModelFinal1 :: !(Conv2d EmbSize QOutHidden FifthSize OctaveSize QDType dev)
- qModelNorm1 :: !(LayerNorm '[QOutHidden] QDType dev)
- qModelFinal2 :: !(Linear QOutHidden 1 QDType dev)
- qModelValue1 :: !(Linear EmbSize QOutHidden QDType dev)
- qModelValueNorm :: !(LayerNorm '[QOutHidden] QDType dev)
- qModelValue2 :: !(Linear QOutHidden 1 QDType dev)
- forwardQModel :: forall (dev :: (DeviceType, Nat)). IsValidDevice dev => QModel dev -> QEncoding dev ('[] :: [Nat]) -> QTensor dev '[1]
- forwardQModelBatched :: forall (dev :: (DeviceType, Nat)) (batchSize :: Nat). (IsValidDevice dev, 1 <= batchSize) => QModel dev -> QEncoding dev '[batchSize] -> QTensor dev '[batchSize, 1]
- forwardPolicy :: forall (dev :: (DeviceType, Nat)). (GeluDTypeIsValid dev QDType, RandDTypeIsValid dev QDType, BasicArithmeticDTypeIsValid dev QDType, SumDTypeIsValid dev QDType, MeanDTypeValidation dev QDType, StandardFloatingPointDTypeValidation dev QDType, KnownDevice dev) => QModel dev -> QEncoding dev ('[] :: [Nat]) -> QTensor dev '[1]
- forwardPolicyBatched :: forall (dev :: (DeviceType, Nat)) (batchSize :: Nat). (OrdCond (CmpNat 1 batchSize) 'True 'True 'False ~ 'True, GeluDTypeIsValid dev QDType, RandDTypeIsValid dev QDType, BasicArithmeticDTypeIsValid dev QDType, SumDTypeIsValid dev QDType, MeanDTypeValidation dev QDType, StandardFloatingPointDTypeValidation dev QDType, KnownDevice dev) => QModel dev -> QEncoding dev '[batchSize] -> QTensor dev '[batchSize, 1]
- forwardValue :: forall (dev :: (DeviceType, Nat)). IsValidDevice dev => QModel dev -> StateEncoding dev -> QTensor dev '[1]
- fakeLoss :: forall (dev :: (DeviceType, Nat)) (ps :: [Type]). (IsValidDevice dev, ps ~ Parameters (QModel dev)) => QModel dev -> QTensor dev ('[] :: [Nat])
- mkQModel :: forall (dev :: (DeviceType, Nat)). IsValidDevice dev => IO (QModel dev)
- loadModel :: forall (dev :: (DeviceType, Nat)). IsValidDevice dev => FilePath -> IO (QModel dev)
- saveModel :: forall (dev :: (DeviceType, Nat)). FilePath -> QModel dev -> IO ()
- modelSize :: forall (dev :: (DeviceType, Nat)). QModel dev -> Int
- runQ :: forall (dev :: (DeviceType, Nat)) s a. IsValidDevice dev => (s -> a -> QEncoding dev ('[] :: [Nat])) -> QModel dev -> s -> a -> QType
- runQ' :: forall (dev :: (DeviceType, Nat)) s a. IsValidDevice dev => (s -> a -> QEncoding dev ('[] :: [Nat])) -> QModel dev -> s -> a -> QTensor dev '[1]
- runBatchedPolicy :: forall (dev :: (DeviceType, Nat)) (batchSize :: Nat). (IsValidDevice dev, KnownNat batchSize) => QModel dev -> QEncoding dev '[batchSize] -> Tensor
Documentation
activation :: forall (dev :: (DeviceType, Nat)) (shape :: [Nat]). IsValidDevice dev => QTensor dev shape -> QTensor dev shape Source #
traceDyn :: forall (a :: (DeviceType, Nat)) (b :: DType) (c :: [Nat]). Tensor a b c -> Tensor a b c Source #
unsafeReshape :: forall (dev :: (DeviceType, Nat)) (dtype :: DType) (shape :: [Nat]) (shape' :: [Nat]). [Int] -> Tensor dev dtype shape -> Tensor dev dtype shape' Source #
data ConstEmbSpec (dev :: k) (shape :: [Nat]) Source #
Constructors
| ConstEmbSpec |
Instances
| (IsValidDevice dev, TensorOptions shape QDType dev) => Randomizable (ConstEmbSpec dev shape) (ConstEmb dev shape) Source # | |
newtype ConstEmb (dev :: (DeviceType, Nat)) (shape :: [Nat]) Source #
Instances
| NFData (ConstEmb dev shape) Source # | |||||
| Generic (ConstEmb dev shape) Source # | |||||
Defined in RL.Model Associated Types
| |||||
| Show (ConstEmb dev shape) Source # | |||||
| Parameterized (ConstEmb dev shape) Source # | |||||
Defined in RL.Model Associated Types
Methods flattenParameters :: ConstEmb dev shape -> HList (Parameters (ConstEmb dev shape)) # replaceParameters :: ConstEmb dev shape -> HList (Parameters (ConstEmb dev shape)) -> ConstEmb dev shape # | |||||
| NoThunks (ConstEmb dev shape) Source # | |||||
| HasForward (ConstEmb dev size) () (QTensor dev size) Source # | |||||
| (IsValidDevice dev, TensorOptions shape QDType dev) => Randomizable (ConstEmbSpec dev shape) (ConstEmb dev shape) Source # | |||||
| type Rep (ConstEmb dev shape) Source # | |||||
Defined in RL.Model type Rep (ConstEmb dev shape) = D1 ('MetaData "ConstEmb" "RL.Model" "protovoices-rl-0.1.0.0-JjFFM1P77sPCI8QyjRIHUO" 'True) (C1 ('MetaCons "ConstEmb" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Parameter dev QDType shape)))) | |||||
| type Parameters (ConstEmb dev shape) Source # | |||||
Defined in RL.Model | |||||
data SliceSpec (dev :: k) Source #
Constructors
| SliceSpec |
Instances
| IsValidDevice dev => Randomizable (SliceSpec dev) (SliceEncoder dev) Source # | |
data SliceEncoder (dev :: (DeviceType, Nat)) Source #
Constructors
| SliceEncoder | |
Instances
data TransitionSpec (dev :: k) Source #
Constructors
| TransitionSpec |
Instances
| IsValidDevice dev => Randomizable (TransitionSpec dev) (TransitionEncoder dev) Source # | |
Defined in RL.Model Methods sample :: TransitionSpec dev -> IO (TransitionEncoder dev) # | |
data TransitionEncoder (dev :: (DeviceType, Nat)) Source #
Constructors
| TransitionEncoder | |
Fields
| |
Instances
| NFData (TransitionEncoder dev) Source # | |||||
Defined in RL.Model Methods rnf :: TransitionEncoder dev -> () # | |||||
| Generic (TransitionEncoder dev) Source # | |||||
Defined in RL.Model Associated Types
Methods from :: TransitionEncoder dev -> Rep (TransitionEncoder dev) x # to :: Rep (TransitionEncoder dev) x -> TransitionEncoder dev # | |||||
| Show (TransitionEncoder dev) Source # | |||||
Defined in RL.Model Methods showsPrec :: Int -> TransitionEncoder dev -> ShowS # show :: TransitionEncoder dev -> String # showList :: [TransitionEncoder dev] -> ShowS # | |||||
| Parameterized (TransitionEncoder dev) Source # | |||||
Defined in RL.Model Associated Types
Methods flattenParameters :: TransitionEncoder dev -> HList (Parameters (TransitionEncoder dev)) # replaceParameters :: TransitionEncoder dev -> HList (Parameters (TransitionEncoder dev)) -> TransitionEncoder dev # | |||||
| NoThunks (TransitionEncoder dev) Source # | |||||
Defined in RL.Model Methods noThunks :: Context -> TransitionEncoder dev -> IO (Maybe ThunkInfo) # wNoThunks :: Context -> TransitionEncoder dev -> IO (Maybe ThunkInfo) # showTypeOf :: Proxy (TransitionEncoder dev) -> String # | |||||
| (IsValidDevice dev, embshape ~ (batchSize ': (EmbSize ': PShape))) => HasForward (TransitionEncoder dev) (TransitionEncoding dev '[batchSize]) (QTensor dev embshape) Source # | HasForward for transitions (batched) | ||||
Defined in RL.Model Methods forward :: TransitionEncoder dev -> TransitionEncoding dev '[batchSize] -> QTensor dev embshape # forwardStoch :: TransitionEncoder dev -> TransitionEncoding dev '[batchSize] -> IO (QTensor dev embshape) # | |||||
| (IsValidDevice dev, embshape ~ (EmbSize ': PShape)) => HasForward (TransitionEncoder dev) (TransitionEncoding dev ('[] :: [Nat])) (QTensor dev embshape) Source # | HasForward for transitions (unbatched) | ||||
Defined in RL.Model Methods forward :: TransitionEncoder dev -> TransitionEncoding dev ('[] :: [Nat]) -> QTensor dev embshape # forwardStoch :: TransitionEncoder dev -> TransitionEncoding dev ('[] :: [Nat]) -> IO (QTensor dev embshape) # | |||||
| (IsValidDevice dev, outShape ~ (batchSize ': (EmbSize ': PShape)), 1 <= batchSize) => HasForward (ActionEncoder dev) (SliceEncoder dev, TransitionEncoder dev, ActionEncoding dev '[batchSize]) (QTensor dev outShape) Source # | HasForward for actions (batched) | ||||
Defined in RL.Model Methods forward :: ActionEncoder dev -> (SliceEncoder dev, TransitionEncoder dev, ActionEncoding dev '[batchSize]) -> QTensor dev outShape # forwardStoch :: ActionEncoder dev -> (SliceEncoder dev, TransitionEncoder dev, ActionEncoding dev '[batchSize]) -> IO (QTensor dev outShape) # | |||||
| (IsValidDevice dev, outShape ~ (EmbSize ': PShape)) => HasForward (StateEncoder dev) (SliceEncoder dev, TransitionEncoder dev, StateEncoding dev) (QTensor dev outShape) Source # | HasForward for the parsing state (doesn't need batching) | ||||
Defined in RL.Model Methods forward :: StateEncoder dev -> (SliceEncoder dev, TransitionEncoder dev, StateEncoding dev) -> QTensor dev outShape # forwardStoch :: StateEncoder dev -> (SliceEncoder dev, TransitionEncoder dev, StateEncoding dev) -> IO (QTensor dev outShape) # | |||||
| IsValidDevice dev => Randomizable (TransitionSpec dev) (TransitionEncoder dev) Source # | |||||
Defined in RL.Model Methods sample :: TransitionSpec dev -> IO (TransitionEncoder dev) # | |||||
| type Rep (TransitionEncoder dev) Source # | |||||
Defined in RL.Model type Rep (TransitionEncoder dev) = D1 ('MetaData "TransitionEncoder" "RL.Model" "protovoices-rl-0.1.0.0-JjFFM1P77sPCI8QyjRIHUO" 'False) (C1 ('MetaCons "TransitionEncoder" 'PrefixI 'True) ((S1 ('MetaSel ('Just "trL1Passing") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d 2 QTransHidden FifthSize OctaveSize QDType dev)) :*: (S1 ('MetaSel ('Just "trL1Inner") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d 2 QTransHidden FifthSize OctaveSize QDType dev)) :*: S1 ('MetaSel ('Just "trL1Left") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d 1 QTransHidden 1 1 QDType dev)))) :*: (S1 ('MetaSel ('Just "trL1Right") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d 1 QTransHidden 1 1 QDType dev)) :*: (S1 ('MetaSel ('Just "trL1Root") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ConstEmb dev '[QTransHidden])) :*: S1 ('MetaSel ('Just "trL2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d QTransHidden EmbSize FifthSize OctaveSize QDType dev)))))) | |||||
| type Parameters (TransitionEncoder dev) Source # | |||||
Defined in RL.Model | |||||
data ActionSpec (dev :: k) Source #
Constructors
| ActionSpec |
Instances
| IsValidDevice dev => Randomizable (ActionSpec dev) (ActionEncoder dev) Source # | |
Defined in RL.Model Methods sample :: ActionSpec dev -> IO (ActionEncoder dev) # | |
data ActionEncoder (dev :: (DeviceType, Nat)) Source #
Constructors
| ActionEncoder | |
Fields
| |
Instances
| NFData (ActionEncoder dev) Source # | |||||
Defined in RL.Model Methods rnf :: ActionEncoder dev -> () # | |||||
| Generic (ActionEncoder dev) Source # | |||||
Defined in RL.Model Associated Types
Methods from :: ActionEncoder dev -> Rep (ActionEncoder dev) x # to :: Rep (ActionEncoder dev) x -> ActionEncoder dev # | |||||
| Show (ActionEncoder dev) Source # | |||||
Defined in RL.Model Methods showsPrec :: Int -> ActionEncoder dev -> ShowS # show :: ActionEncoder dev -> String # showList :: [ActionEncoder dev] -> ShowS # | |||||
| Parameterized (ActionEncoder dev) Source # | |||||
Defined in RL.Model Associated Types
Methods flattenParameters :: ActionEncoder dev -> HList (Parameters (ActionEncoder dev)) # replaceParameters :: ActionEncoder dev -> HList (Parameters (ActionEncoder dev)) -> ActionEncoder dev # | |||||
| NoThunks (ActionEncoder dev) Source # | |||||
Defined in RL.Model Methods noThunks :: Context -> ActionEncoder dev -> IO (Maybe ThunkInfo) # wNoThunks :: Context -> ActionEncoder dev -> IO (Maybe ThunkInfo) # showTypeOf :: Proxy (ActionEncoder dev) -> String # | |||||
| (IsValidDevice dev, outShape ~ (batchSize ': (EmbSize ': PShape)), 1 <= batchSize) => HasForward (ActionEncoder dev) (SliceEncoder dev, TransitionEncoder dev, ActionEncoding dev '[batchSize]) (QTensor dev outShape) Source # | HasForward for actions (batched) | ||||
Defined in RL.Model Methods forward :: ActionEncoder dev -> (SliceEncoder dev, TransitionEncoder dev, ActionEncoding dev '[batchSize]) -> QTensor dev outShape # forwardStoch :: ActionEncoder dev -> (SliceEncoder dev, TransitionEncoder dev, ActionEncoding dev '[batchSize]) -> IO (QTensor dev outShape) # | |||||
| IsValidDevice dev => Randomizable (ActionSpec dev) (ActionEncoder dev) Source # | |||||
Defined in RL.Model Methods sample :: ActionSpec dev -> IO (ActionEncoder dev) # | |||||
| type Rep (ActionEncoder dev) Source # | |||||
Defined in RL.Model type Rep (ActionEncoder dev) = D1 ('MetaData "ActionEncoder" "RL.Model" "protovoices-rl-0.1.0.0-JjFFM1P77sPCI8QyjRIHUO" 'False) (C1 ('MetaCons "ActionEncoder" 'PrefixI 'True) (((S1 ('MetaSel ('Just "actTop1sl") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d EmbSize QActionHidden FifthSize OctaveSize QDType dev)) :*: S1 ('MetaSel ('Just "actTop1sm") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d EmbSize QActionHidden FifthSize OctaveSize QDType dev))) :*: (S1 ('MetaSel ('Just "actTop1sr") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d EmbSize QActionHidden FifthSize OctaveSize QDType dev)) :*: S1 ('MetaSel ('Just "actTop1t1") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d EmbSize QActionHidden FifthSize OctaveSize QDType dev)))) :*: ((S1 ('MetaSel ('Just "actTop1t2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d EmbSize QActionHidden FifthSize OctaveSize QDType dev)) :*: S1 ('MetaSel ('Just "actTop2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d QActionHidden EmbSize FifthSize OctaveSize QDType dev))) :*: (S1 ('MetaSel ('Just "actSplit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ConstEmb dev '[EmbSize - 3])) :*: (S1 ('MetaSel ('Just "actSpread") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ConstEmb dev '[EmbSize - 3])) :*: S1 ('MetaSel ('Just "actFreeze") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ConstEmb dev '[EmbSize - 3]))))))) | |||||
| type Parameters (ActionEncoder dev) Source # | |||||
Defined in RL.Model | |||||
opTypes :: forall (dev :: (DeviceType, Nat)). KnownDevice dev => QTensor dev '[6, 3] Source #
data StateSpec (dev :: k) Source #
Constructors
| StateSpec |
Instances
| IsValidDevice dev => Randomizable (StateSpec dev) (StateEncoder dev) Source # | |
data StateEncoder (dev :: (DeviceType, Nat)) Source #
Constructors
| StateEncoder | |
Fields
| |
Instances
| NFData (StateEncoder dev) Source # | |||||
Defined in RL.Model Methods rnf :: StateEncoder dev -> () # | |||||
| Generic (StateEncoder dev) Source # | |||||
Defined in RL.Model Associated Types
Methods from :: StateEncoder dev -> Rep (StateEncoder dev) x # to :: Rep (StateEncoder dev) x -> StateEncoder dev # | |||||
| Show (StateEncoder dev) Source # | |||||
Defined in RL.Model Methods showsPrec :: Int -> StateEncoder dev -> ShowS # show :: StateEncoder dev -> String # showList :: [StateEncoder dev] -> ShowS # | |||||
| Parameterized (StateEncoder dev) Source # | |||||
Defined in RL.Model Associated Types
Methods flattenParameters :: StateEncoder dev -> HList (Parameters (StateEncoder dev)) # replaceParameters :: StateEncoder dev -> HList (Parameters (StateEncoder dev)) -> StateEncoder dev # | |||||
| NoThunks (StateEncoder dev) Source # | |||||
Defined in RL.Model Methods noThunks :: Context -> StateEncoder dev -> IO (Maybe ThunkInfo) # wNoThunks :: Context -> StateEncoder dev -> IO (Maybe ThunkInfo) # showTypeOf :: Proxy (StateEncoder dev) -> String # | |||||
| (IsValidDevice dev, outShape ~ (EmbSize ': PShape)) => HasForward (StateEncoder dev) (SliceEncoder dev, TransitionEncoder dev, StateEncoding dev) (QTensor dev outShape) Source # | HasForward for the parsing state (doesn't need batching) | ||||
Defined in RL.Model Methods forward :: StateEncoder dev -> (SliceEncoder dev, TransitionEncoder dev, StateEncoding dev) -> QTensor dev outShape # forwardStoch :: StateEncoder dev -> (SliceEncoder dev, TransitionEncoder dev, StateEncoding dev) -> IO (QTensor dev outShape) # | |||||
| IsValidDevice dev => Randomizable (StateSpec dev) (StateEncoder dev) Source # | |||||
| type Rep (StateEncoder dev) Source # | |||||
Defined in RL.Model type Rep (StateEncoder dev) = D1 ('MetaData "StateEncoder" "RL.Model" "protovoices-rl-0.1.0.0-JjFFM1P77sPCI8QyjRIHUO" 'False) (C1 ('MetaCons "StateEncoder" 'PrefixI 'True) ((S1 ('MetaSel ('Just "stL1mid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Conv2d EmbSize QStateHidden FifthSize OctaveSize QDType dev)) :*: (S1 ('MetaSel ('Just "stL1frozenSlc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Conv2d EmbSize QStateHidden FifthSize OctaveSize QDType dev)) :*: S1 ('MetaSel ('Just "stL1frozenTr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Conv2d EmbSize QStateHidden FifthSize OctaveSize QDType dev)))) :*: ((S1 ('MetaSel ('Just "stL1openSlc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Conv2d EmbSize QStateHidden FifthSize OctaveSize QDType dev)) :*: S1 ('MetaSel ('Just "stL1openTr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Conv2d EmbSize QStateHidden FifthSize OctaveSize QDType dev))) :*: (S1 ('MetaSel ('Just "stL2") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Conv2d QStateHidden QStateHidden FifthSize OctaveSize QDType dev)) :*: S1 ('MetaSel ('Just "stL3") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Conv2d QStateHidden EmbSize FifthSize OctaveSize QDType dev)))))) | |||||
| type Parameters (StateEncoder dev) Source # | |||||
Defined in RL.Model | |||||
data QModel (dev :: (DeviceType, Nat)) Source #
Constructors
| QModel | |
Fields
| |
Instances
| NFData (QModel dev) Source # | |||||
| Generic (QModel dev) Source # | |||||
Defined in RL.Model Associated Types
| |||||
| Show (QModel dev) Source # | |||||
| Parameterized (QModel dev) Source # | |||||
Defined in RL.Model Associated Types
Methods flattenParameters :: QModel dev -> HList (Parameters (QModel dev)) # replaceParameters :: QModel dev -> HList (Parameters (QModel dev)) -> QModel dev # | |||||
| NoThunks (QModel dev) Source # | |||||
| (IsValidDevice dev, KnownNat batchSize, 1 <= batchSize, CheckIsSuffixOf '[QOutHidden] '[batchSize, QOutHidden] (QOutHidden == QOutHidden)) => HasForward (QModel dev) (QEncoding dev '[batchSize]) (QTensor dev '[batchSize, 1]) Source # | HasForward for model (batched) | ||||
| (IsValidDevice dev, CheckIsSuffixOf '[QOutHidden] '[1, QOutHidden] (QOutHidden == QOutHidden)) => HasForward (QModel dev) (QEncoding dev ('[] :: [Nat])) (QTensor dev '[1]) Source # | HasForward for model (unbatched) | ||||
| IsValidDevice dev => Randomizable (QSpec dev) (QModel dev) Source # | |||||
| type Rep (QModel dev) Source # | |||||
Defined in RL.Model type Rep (QModel dev) = D1 ('MetaData "QModel" "RL.Model" "protovoices-rl-0.1.0.0-JjFFM1P77sPCI8QyjRIHUO" 'False) (C1 ('MetaCons "QModel" 'PrefixI 'True) (((S1 ('MetaSel ('Just "qModelSlc") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (SliceEncoder dev)) :*: S1 ('MetaSel ('Just "qModelTr") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TransitionEncoder dev))) :*: (S1 ('MetaSel ('Just "qModelAct") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ActionEncoder dev)) :*: (S1 ('MetaSel ('Just "qModelSt") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StateEncoder dev)) :*: S1 ('MetaSel ('Just "qModelFinal1") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Conv2d EmbSize QOutHidden FifthSize OctaveSize QDType dev))))) :*: ((S1 ('MetaSel ('Just "qModelNorm1") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (LayerNorm '[QOutHidden] QDType dev)) :*: S1 ('MetaSel ('Just "qModelFinal2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Linear QOutHidden 1 QDType dev))) :*: (S1 ('MetaSel ('Just "qModelValue1") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Linear EmbSize QOutHidden QDType dev)) :*: (S1 ('MetaSel ('Just "qModelValueNorm") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (LayerNorm '[QOutHidden] QDType dev)) :*: S1 ('MetaSel ('Just "qModelValue2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Linear QOutHidden 1 QDType dev))))))) | |||||
| type Parameters (QModel dev) Source # | |||||
Defined in RL.Model | |||||
forwardQModel :: forall (dev :: (DeviceType, Nat)). IsValidDevice dev => QModel dev -> QEncoding dev ('[] :: [Nat]) -> QTensor dev '[1] Source #
forwardQModelBatched :: forall (dev :: (DeviceType, Nat)) (batchSize :: Nat). (IsValidDevice dev, 1 <= batchSize) => QModel dev -> QEncoding dev '[batchSize] -> QTensor dev '[batchSize, 1] Source #
forwardPolicy :: forall (dev :: (DeviceType, Nat)). (GeluDTypeIsValid dev QDType, RandDTypeIsValid dev QDType, BasicArithmeticDTypeIsValid dev QDType, SumDTypeIsValid dev QDType, MeanDTypeValidation dev QDType, StandardFloatingPointDTypeValidation dev QDType, KnownDevice dev) => QModel dev -> QEncoding dev ('[] :: [Nat]) -> QTensor dev '[1] Source #
forwardPolicyBatched :: forall (dev :: (DeviceType, Nat)) (batchSize :: Nat). (OrdCond (CmpNat 1 batchSize) 'True 'True 'False ~ 'True, GeluDTypeIsValid dev QDType, RandDTypeIsValid dev QDType, BasicArithmeticDTypeIsValid dev QDType, SumDTypeIsValid dev QDType, MeanDTypeValidation dev QDType, StandardFloatingPointDTypeValidation dev QDType, KnownDevice dev) => QModel dev -> QEncoding dev '[batchSize] -> QTensor dev '[batchSize, 1] Source #
forwardValue :: forall (dev :: (DeviceType, Nat)). IsValidDevice dev => QModel dev -> StateEncoding dev -> QTensor dev '[1] Source #
fakeLoss :: forall (dev :: (DeviceType, Nat)) (ps :: [Type]). (IsValidDevice dev, ps ~ Parameters (QModel dev)) => QModel dev -> QTensor dev ('[] :: [Nat]) Source #
A loss for any model with 0 gradients everywhere. Can be used to ensure that all parameters have a gradient, if not all parameters are used in the real loss.
mkQModel :: forall (dev :: (DeviceType, Nat)). IsValidDevice dev => IO (QModel dev) Source #
loadModel :: forall (dev :: (DeviceType, Nat)). IsValidDevice dev => FilePath -> IO (QModel dev) Source #
runQ :: forall (dev :: (DeviceType, Nat)) s a. IsValidDevice dev => (s -> a -> QEncoding dev ('[] :: [Nat])) -> QModel dev -> s -> a -> QType Source #
runQ' :: forall (dev :: (DeviceType, Nat)) s a. IsValidDevice dev => (s -> a -> QEncoding dev ('[] :: [Nat])) -> QModel dev -> s -> a -> QTensor dev '[1] Source #
runBatchedPolicy :: forall (dev :: (DeviceType, Nat)) (batchSize :: Nat). (IsValidDevice dev, KnownNat batchSize) => QModel dev -> QEncoding dev '[batchSize] -> Tensor Source #