Skip to content

Commit edf1bac

Browse files
committed
minor ed
1 parent 42bc4a1 commit edf1bac

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

example/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ normalizing flow to approximate the target distribution using `NormalizingFlows.
1212
Currently, all examples share the same [Julia project](https://pkgdocs.julialang.org/v1/environments/#Using-someone-else's-project). To run the examples, first activate the project environment:
1313

1414
```julia
15-
# pwd() = "NormalizingFlows.jl/"
16-
using Pkg; Pkg.activate("example"); Pkg.instantiate()
15+
# pwd() = "NormalizingFlows.jl/example"
16+
using Pkg; Pkg.activate("."); Pkg.instantiate()
1717
```
18-
This will install all needed packages, at the exact versions when the model was last updated. Then you can run the model code with include("<example-to-run>.jl"), or by running the example script line-by-line.
18+
This will install all needed packages, at the exact versions when the model was last updated. Then you can run the model code with `include("<example-to-run>.jl")`, or by running the example script line-by-line.

example/demo_RealNVP.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Flux
2-
using Functors
32
using Bijectors
43
using Bijectors: partition, combine, PartitionMask
54

example/demo_hamiltonian_flow.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using Random, Distributions, LinearAlgebra
22
using Functors
33
using Optimisers, ADTypes
44
using Mooncake
5-
using Bijectors
5+
using Bijectors
66
using Bijectors: partition, combine, PartitionMask
77
using SimpleUnPack: @unpack
88

@@ -111,7 +111,9 @@ T = Float64 # for Hamiltonian VI, its recommended to use Float64 as the dynamic
111111
# a Funnel target
112112
######################################
113113
dims = 2
114-
target = Funnel(dims, 0.0, 5.0)
114+
target = Funnel(dims, -8.0, 5.0)
115+
# visualize(target)
116+
115117
logp = Base.Fix1(logpdf, target)
116118
function logp_joint(z::AbstractVector{T}) where {T<:Real}
117119
dims = div(length(z), 2)
@@ -132,12 +134,12 @@ q0 = transformed(
132134
MvNormal(zeros(T, 2dims), ones(T, 2dims)), Bijectors.Shift(zeros(T, 2dims)) Bijectors.Scale(ones(T, 2dims))
133135
)
134136

135-
nlfg = 5
137+
nlfg = 3
136138
logϵ0 = log(0.05) # initial step size
137139

138140
# Hamiltonian flow interleaves betweem Leapfrog layer and an affine transformation to the momentum variable
139141
Ls = [
140-
momentum_normalization_layer(dims, T) LeapFrog(dims, logϵ0, nlfg, ∇logp) for _ in 1:8
142+
momentum_normalization_layer(dims, T) LeapFrog(dims, logϵ0, nlfg, ∇logp) for _ in 1:15
141143
]
142144

143145
flow = create_flow(Ls, q0)
@@ -159,7 +161,7 @@ flow_trained, stats, _ = train_flow(
159161
logp_joint,
160162
sample_per_iter;
161163
max_iters=50_000,
162-
optimiser=Optimisers.Adam(1e-3),
164+
optimiser=Optimisers.Adam(3e-4),
163165
ADbackend=adtype,
164166
show_progress=true,
165167
callback=cb,

example/demo_neural_spline_flow.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Flux
2-
using Functors
32
using Bijectors
43
using Bijectors: partition, combine, PartitionMask
54

0 commit comments

Comments
 (0)