mirror of
https://github.com/Laurent2916/Diffusers.jl.git
synced 2024-09-18 18:45:28 +00:00
🎨 (BetaSchedules) change float formats in signatures
This commit is contained in:
parent
2cf9c49202
commit
4da2a7bd9d
|
@ -4,7 +4,7 @@ Cosine beta schedule.
|
||||||
## Input
|
## Input
|
||||||
* `T::Int`: number of timesteps
|
* `T::Int`: number of timesteps
|
||||||
* `βₘₐₓ::Real=0.999f0`: maximum value of β
|
* `βₘₐₓ::Real=0.999f0`: maximum value of β
|
||||||
* `ϵ::Real=1e-3f0`: small value used to avoid division by zero
|
* `ϵ::Real=1.0f-3`: small value used to avoid division by zero
|
||||||
|
|
||||||
## Output
|
## Output
|
||||||
* `β::Vector{Real}`: βₜ values at each timestep t
|
* `β::Vector{Real}`: βₜ values at each timestep t
|
||||||
|
@ -13,7 +13,7 @@ Cosine beta schedule.
|
||||||
* [[2102.09672] Improved Denoising Diffusion Probabilistic Models](https://arxiv.org/abs/2102.09672)
|
* [[2102.09672] Improved Denoising Diffusion Probabilistic Models](https://arxiv.org/abs/2102.09672)
|
||||||
* [github:openai/improved-diffusion](https://github.com/openai/improved-diffusion/blob/783b6740edb79fdb7d063250db2c51cc9545dcd1/improved_diffusion/gaussian_diffusion.py#L36)
|
* [github:openai/improved-diffusion](https://github.com/openai/improved-diffusion/blob/783b6740edb79fdb7d063250db2c51cc9545dcd1/improved_diffusion/gaussian_diffusion.py#L36)
|
||||||
"""
|
"""
|
||||||
function cosine_beta_schedule(T::Integer, βₘₐₓ::Real=0.999f0, ϵ::Real=0.001f0)
|
function cosine_beta_schedule(T::Integer, βₘₐₓ::Real=0.999f0, ϵ::Real=1.0f-3)
|
||||||
α̅(t) = cos((t / T + ϵ) / (1 + ϵ) * π / 2)^2
|
α̅(t) = cos((t / T + ϵ) / (1 + ϵ) * π / 2)^2
|
||||||
|
|
||||||
β = Vector{Real}(undef, T)
|
β = Vector{Real}(undef, T)
|
||||||
|
|
|
@ -3,8 +3,8 @@ Linear beta schedule.
|
||||||
|
|
||||||
## Input
|
## Input
|
||||||
* `T::Integer`: number of timesteps
|
* `T::Integer`: number of timesteps
|
||||||
* `β₁::Real=0.0001f0`: initial (t=1) value of β
|
* `β₁::Real=1.0f-4`: initial (t=1) value of β
|
||||||
* `β₋₁::Real=0.02f0`: final (t=T) value of β
|
* `β₋₁::Real=2.0f-2`: final (t=T) value of β
|
||||||
|
|
||||||
## Output
|
## Output
|
||||||
* `β::Vector{Real}`: βₜ values at each timestep t
|
* `β::Vector{Real}`: βₜ values at each timestep t
|
||||||
|
@ -12,6 +12,6 @@ Linear beta schedule.
|
||||||
## References
|
## References
|
||||||
* [[2006.11239] Denoising Diffusion Probabilistic Models](https://arxiv.org/abs/2006.11239)
|
* [[2006.11239] Denoising Diffusion Probabilistic Models](https://arxiv.org/abs/2006.11239)
|
||||||
"""
|
"""
|
||||||
function linear_beta_schedule(T::Integer, β₁::Real=0.0001f0, β₋₁::Real=0.02f0)
|
function linear_beta_schedule(T::Integer, β₁::Real=1.0f-4, β₋₁::Real=2.0f-2)
|
||||||
return range(start=β₁, stop=β₋₁, length=T)
|
return range(start=β₁, stop=β₋₁, length=T)
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,8 +3,8 @@ Scaled linear beta schedule.
|
||||||
|
|
||||||
## Input
|
## Input
|
||||||
* `T::Int`: number of timesteps
|
* `T::Int`: number of timesteps
|
||||||
* `β₁::Real=0.0001f0`: initial value of β
|
* `β₁::Real=1.0f-4`: initial value of β
|
||||||
* `β₋₁::Real=0.02f0`: final value of β
|
* `β₋₁::Real=2.0f-2`: final value of β
|
||||||
|
|
||||||
## Output
|
## Output
|
||||||
* `β::Vector{Real}`: βₜ values at each timestep t
|
* `β::Vector{Real}`: βₜ values at each timestep t
|
||||||
|
@ -12,6 +12,6 @@ Scaled linear beta schedule.
|
||||||
## References
|
## References
|
||||||
* [[2006.11239] Denoising Diffusion Probabilistic Models](https://arxiv.org/abs/2006.11239)
|
* [[2006.11239] Denoising Diffusion Probabilistic Models](https://arxiv.org/abs/2006.11239)
|
||||||
"""
|
"""
|
||||||
function scaled_linear_beta_schedule(T::Integer, β₁::Real=0.0001f0, β₋₁::Real=0.02f0)
|
function scaled_linear_beta_schedule(T::Integer, β₁::Real=1.0f-4, β₋₁::Real=2.0f-2)
|
||||||
return range(start=β₁^0.5, stop=β₋₁^0.5, length=T) .^ 2
|
return range(start=√β₁, stop=√β₋₁, length=T) .^ 2
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,8 +5,8 @@ Sigmoid beta schedule.
|
||||||
|
|
||||||
## Input
|
## Input
|
||||||
* `T::Int`: number of timesteps
|
* `T::Int`: number of timesteps
|
||||||
* `β₁::Real=0.0001f0`: initial value of β
|
* `β₁::Real=1.0f-4`: initial value of β
|
||||||
* `β₋₁::Real=0.02f0`: final value of β
|
* `β₋₁::Real=2.0f-2`: final value of β
|
||||||
|
|
||||||
## Output
|
## Output
|
||||||
* `β::Vector{Real}`: βₜ values at each timestep t
|
* `β::Vector{Real}`: βₜ values at each timestep t
|
||||||
|
@ -15,7 +15,7 @@ Sigmoid beta schedule.
|
||||||
* [[2203.02923] GeoDiff: a Geometric Diffusion Model for Molecular Conformation Generation](https://arxiv.org/abs/2203.02923)
|
* [[2203.02923] GeoDiff: a Geometric Diffusion Model for Molecular Conformation Generation](https://arxiv.org/abs/2203.02923)
|
||||||
* [github.com:MinkaiXu/GeoDiff](https://github.com/MinkaiXu/GeoDiff/blob/ea0ca48045a2f7abfccd7f0df449e45eb6eae638/models/epsnet/diffusion.py#L57)
|
* [github.com:MinkaiXu/GeoDiff](https://github.com/MinkaiXu/GeoDiff/blob/ea0ca48045a2f7abfccd7f0df449e45eb6eae638/models/epsnet/diffusion.py#L57)
|
||||||
"""
|
"""
|
||||||
function sigmoid_beta_schedule(T::Integer, β₁::Real=0.0001f0, β₋₁::Real=0.02f0)
|
function sigmoid_beta_schedule(T::Integer, β₁::Real=1.0f-4, β₋₁::Real=2.0f-2)
|
||||||
x = range(start=-6, stop=6, length=T)
|
x = range(start=-6, stop=6, length=T)
|
||||||
return sigmoid(x) .* (β₋₁ - β₁) .+ β₁
|
return sigmoid(x) .* (β₋₁ - β₁) .+ β₁
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue