Skip to content
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

Zygote AD backend #783

Merged
merged 18 commits into from
Mar 15, 2020
Merged

Zygote AD backend #783

merged 18 commits into from
Mar 15, 2020

Conversation

mohamed82008
Copy link
Member

This is a WIP PR that introduces Zygote to our AD family. MvNormal is still not working and some inplace operations are tripping Zygote, so I need to figure out how to make them play well together.

@xukai92
Copy link
Member

xukai92 commented May 14, 2019

By inplace operations do you mean the way we use vi::VarInfo requires the following?

vi[spl] = theta
model(vi, spl)

@mohamed82008
Copy link
Member Author

Seems so https://travis-ci.org/TuringLang/Turing.jl/jobs/531342906#L624, it is unclear to me what the solution here is.

@cpfiffer
Copy link
Member

cpfiffer commented May 14, 2019

Doesn't seem like much, so far: FluxML/Zygote.jl#75. The PR to fix this hasn't made it through and may have some caveats for our case.

@yebai
Copy link
Member

yebai commented May 29, 2019

@mohamed82008 @willtebbutt Just a quick thought, can we use Tracker to define an in-place mutation function together with customised gradient rules, and then use it inside Zygote?

@yebai
Copy link
Member

yebai commented Dec 17, 2019

@mohamed82008 Perhaps revisit this PR when refactoring VarInfo?

@mohamed82008
Copy link
Member Author

Sure, I will give it another look. Although the underlying issue in Zygote (FluxML/Zygote.jl#265) was not resolved yet. But maybe I can work-around it.

@mohamed82008
Copy link
Member Author

FluxML/Zygote.jl#459

@mohamed82008
Copy link
Member Author

@mohamed82008
Copy link
Member Author

src/core/ad.jl Outdated Show resolved Hide resolved
Project.toml Outdated Show resolved Hide resolved
src/core/ad.jl Outdated Show resolved Hide resolved
@mohamed82008
Copy link
Member Author

I added tests for Zygote, many of which are currently failing. I will try shooting them down one by one in the next few days.

@mohamed82008
Copy link
Member Author

Ran into FluxML/Zygote.jl#468 for Wishart distribution.

@mohamed82008
Copy link
Member Author

mohamed82008 commented Jan 18, 2020

@mohamed82008
Copy link
Member Author

The only test failures here are because of DistributionsAD. I will work on them.

Project.toml Outdated Show resolved Hide resolved
src/Turing.jl Outdated Show resolved Hide resolved
src/core/ad.jl Outdated Show resolved Hide resolved
Co-Authored-By: David Widmann <[email protected]>
Copy link
Member

@willtebbutt willtebbutt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor compat things.

Project.toml Show resolved Hide resolved
Project.toml Show resolved Hide resolved
Project.toml Outdated Show resolved Hide resolved
Project.toml Outdated Show resolved Hide resolved
mohamed82008 and others added 2 commits March 16, 2020 00:22
Co-Authored-By: David Widmann <[email protected]>
Co-Authored-By: David Widmann <[email protected]>
src/core/ad.jl Outdated Show resolved Hide resolved
src/core/ad.jl Outdated Show resolved Hide resolved
mohamed82008 and others added 2 commits March 16, 2020 00:25
Co-Authored-By: David Widmann <[email protected]>
Co-Authored-By: David Widmann <[email protected]>
src/core/ad.jl Outdated Show resolved Hide resolved
src/core/ad.jl Show resolved Hide resolved
src/variational/VariationalInference.jl Show resolved Hide resolved
Copy link
Member

@cpfiffer cpfiffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lookgs great! 👍

@yebai
Copy link
Member

yebai commented Mar 15, 2020

thanks @mohamed82008. Looks good to me, ready to merge from my side!

@yebai yebai merged commit ba7556d into master Mar 15, 2020
@delete-merged-branch delete-merged-branch bot deleted the mt/zygote_ad branch March 15, 2020 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants