New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forward unification 1: add output type family, HasForward instances #477
base: master
Are you sure you want to change the base?
Conversation
bcf0381
to
47ebd27
Compare
@@ -34,9 +35,9 @@ dropoutForward :: | |||
IO (Tensor device dtype shape) | |||
dropoutForward Dropout {..} dropoutTrain = dropout dropoutProb dropoutTrain | |||
|
|||
instance HasForward Dropout (Tensor device dtype shape) (Tensor device dtype shape) where | |||
instance HasForward Dropout (Tensor device dtype shape) where | |||
type Output Dropout (Tensor device dtype shape) = Tensor device dtype shape | |||
forward dropout input = unsafePerformIO $ dropoutForward dropout False input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright, I guess here we are blocked because there isn't a dropout implementation yet that supports generators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, makes sense. My initial goal was just to get everything to compile, but makes sense that this is not very useful until we can augment the output type to make it stochastic.
@mcwitt This looks great! |
Output | ||
(TransformerLM numAttnLayers numHeads ffnDim paddingIdx numEmbeds embedDim dtype device) | ||
(Tensor device 'D.Int64 '[batchSize, seqLen]) = | ||
Tensor device dtype '[batchSize, seqLen, numEmbeds] | ||
forward model input = unsafePerformIO $ transformerLM model False input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. I hope we can get a dropout soon that takes a generator as argument. otherwise, we can't train these models with dropout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this still isn't resolved :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, too bad. When I find some time I'm hoping to try to reproduce the test failure in Junji's PR and see if I can make any progress..
hey, do you want to revisit this for |
@tscholak yep, I'm pretty excited to try this out! |
Breaking up #459 into a series of more manageable chunks.
In this PR the goals are to:
Update
HasForward
, replacing output type parameterb
with a type family and removingfowardStoch
. Stochastic vs. deterministic will now be determined by the associated type family for each instance, with types of the formGenerator -> (a, Generator)
stochastic.Add
HasForwardProduct
,HasForwardSum
instances for products and sums. Eventually (not in this PR), we can dispatch toforwardProduct
andforwardSum
via a generic implementation offorward
.Get everything to compile! This means updating all existing
HasForward
instances.HasForward
instance progress