Conversation
|
@shravanngoswamii, can you help to push this across the finish line? |
I am on it. |
|
NormalizingFlows.jl documentation for PR #52 is available at: |
|
The GPU training test uses Mooncake Reduced to a using CUDA, Mooncake
using ChainRulesCore: @non_differentiable
draw() = CUDA.rand(Float32, 2, 8)
@non_differentiable draw()
x = CUDA.rand(Float32, 2, 8)
t = CUDA.rand(Float32, 5)
f(t) = sum(t[1:2] .* x) # ok
g(t) = sum(t[1:2] .* draw()) # TypeError
Mooncake.value_and_gradient!!(Mooncake.build_rrule(g, t), g, t)Captured arrays differentiate fine, drawn ones do not: This package hides the GPU draw that way because Zygote otherwise traces into the CUDA allocator, so the two backends want opposite things here. 0.5.48 added an explicit refusal for broadcasts that carry captured state: MooncakeCUDAExt.jl#L2095-L2098. That refusal does not fire here, so this looks like a separate bug. Is Zygote fine for the GPU path, and is it worth opening a Mooncake issue with this case? cc @yebai |
|
I think you need |
This PR aims to get a complete normalizing flow example/test on GPU (see #49).
After #11, we now support batch-wise training/inference for some flows (e.g., RealNVP), which is crucial for getting performance gain on GPU. PR #25 then got the cuda sampling for the reference dist working. The only missing piece is to ensure
logpdfcomputation for both the reference and flow to work, and to ensure AD working.I've identified some issue here:
I think a quick solution is to define a
NF._device_specific_logpdf(...).