Skip to content

Conversation

zuhengxu
Copy link
Member

@zuhengxu zuhengxu commented Jul 13, 2023

as per issue #15

@zuhengxu zuhengxu self-assigned this Jul 13, 2023
@zuhengxu zuhengxu added documentation Improvements or additions to documentation enhancement New feature or request labels Jul 13, 2023
@zuhengxu zuhengxu changed the title more NF examples+ more proper synthetic examples + documentations more NF examples Jul 13, 2023
@zuhengxu
Copy link
Member Author

zuhengxu commented Apr 12, 2025

Could we add a script to test whether all the example models run, e.g. on buildkite GPU?

@yebai Currently all the examples are only tested on CPUs. Do you have examples of such script (for testing runs) that I can refer to? (I did do include(...jl) manually for all the demos though.)

In terms of GPU, shall we first merge this PR and do GPU examples/test (#49) on a separate PR? the purpose this PR is just to demonstrate how to define and customize flow layers (at least for those popular flows). I think that to properly take advantage of GPU, we might want some interface adjustment.

@zuhengxu zuhengxu requested a review from sunxd3 April 12, 2025 01:24
@yebai
Copy link
Member

yebai commented Apr 14, 2025

Currently all the examples are only tested on CPUs. Do you have examples of such a script (for testing runs) that I can refer to? (I did do include(...jl) manually for all the demos though.)

It is probably okay to create a new CI group called NF Examples and include all examples there. If running all examples is time-consuming, we could run only a few iterations and not wait for the convergence. This is mainly to ensure all examples can still run with new releases or PRs.

In terms of GPU, shall we first merge this PR and do GPU examples/test (#49) on a separate PR?

No problem -- it sounds good!

Copy link
Member

@sunxd3 sunxd3 left a comment

Choose a reason for hiding this comment

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

General, this is great effort!

Some minor comments, I didn't run the code to see the results.

In the future, probably all of these should be in a documentation page that automatically run and render results. But this PR is fine as it is.
(Worth it to add an issue as TODO?)

@zuhengxu
Copy link
Member Author

Hi! I'm back to finish up this PR. Aside from adding the CI to ensure all examples run, I also played with the batched elbo objective elbo_batch. For flows that supported batched transformations, simply changing the objective from elbo to elbo_batch achieves significant speedups.

For instance, see the running time difference between the two objective on the RealNVP demo. The un-batched elbo:
Screenshot from 2025-05-26 15-36-05
and the batched elbo:
Screenshot from 2025-05-26 15-36-12

This batched objective is also important to get GPU working efficiently. In the meantime, I attempted getting GPU working and am having a pretty good understanding on where needs changes. Let's get GPU working properly (finally) in another PR.

@zuhengxu zuhengxu requested review from sunxd3 and yebai May 27, 2025 01:17
Copy link
Member

@yebai yebai left a comment

Choose a reason for hiding this comment

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

Thanks @zuhengxu and @sunxd3!

@yebai yebai merged commit d336b8d into TuringLang:main May 27, 2025
5 checks passed
@zuhengxu zuhengxu mentioned this pull request Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants