diff --git a/Manifest.toml b/Manifest.toml index a8dd9e3df..b40efdad2 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -128,9 +128,9 @@ weakdeps = ["Libtask"] [[deps.AdvancedVI]] deps = ["ADTypes", "Bijectors", "DiffResults", "Distributions", "DistributionsAD", "DocStringExtensions", "ForwardDiff", "LinearAlgebra", "ProgressMeter", "Random", "Requires", "StatsBase", "StatsFuns", "Tracker"] -git-tree-sha1 = "e45e57cea1879400952fe34b0cbc971950408af8" +git-tree-sha1 = "e913c2794cf9d2db9d36d28f67abd27595101f49" uuid = "b5ca4192-6429-45e5-a2d9-87aec30a685c" -version = "0.2.11" +version = "0.2.12" weakdeps = ["Enzyme", "Flux", "ReverseDiff", "Zygote"] [deps.AdvancedVI.extensions] @@ -301,9 +301,9 @@ version = "0.1.1" [[deps.Bijectors]] deps = ["ArgCheck", "ChainRulesCore", "ChangesOfVariables", "Distributions", "DocStringExtensions", "Functors", "InverseFunctions", "IrrationalConstants", "LinearAlgebra", "LogExpFunctions", "MappedArrays", "Random", "Reexport", "Roots", "SparseArrays", "Statistics"] -git-tree-sha1 = "803e3c6bfd5c2655eb040d252144b7519ce1e70e" +git-tree-sha1 = "8dbfc7cdb433ffbbcaaa7807c53a90c97c431a27" uuid = "76274a88-744f-5084-9051-94815aaf08c4" -version = "0.15.6" +version = "0.15.7" weakdeps = ["ChainRules", "DistributionsAD", "EnzymeCore", "ForwardDiff", "LazyArrays", "Mooncake", "ReverseDiff", "Tracker", "Zygote"] [deps.Bijectors.extensions] @@ -342,9 +342,9 @@ version = "5.17.0" [[deps.BoundaryValueDiffEqAscher]] deps = ["ADTypes", "AlmostBlockDiagonals", "BoundaryValueDiffEqCore", "ConcreteStructs", "DiffEqBase", "DifferentiationInterface", "FastClosures", "ForwardDiff", "LinearAlgebra", "PreallocationTools", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield"] -git-tree-sha1 = "add7560694794f30eec7803b9c4036efb96bf493" +git-tree-sha1 = "2e8239379bdd0f8254407ca2b2cb7b3430da687f" uuid = "7227322d-7511-4e07-9247-ad6ff830280e" -version = "1.6.0" +version = "1.6.1" [[deps.BoundaryValueDiffEqCore]] deps = ["ADTypes", "Adapt", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "ForwardDiff", "LineSearch", "LinearAlgebra", "Logging", "NonlinearSolveFirstOrder", "PreallocationTools", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield", "SparseArrays", "SparseConnectivityTracer", "SparseMatrixColorings"] @@ -366,9 +366,9 @@ version = "1.7.0" [[deps.BoundaryValueDiffEqMIRKN]] deps = ["ADTypes", "ArrayInterface", "BandedMatrices", "BoundaryValueDiffEqCore", "ConcreteStructs", "DiffEqBase", "DifferentiationInterface", "FastAlmostBandedMatrices", "FastClosures", "ForwardDiff", "LinearAlgebra", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield", "SparseArrays"] -git-tree-sha1 = "dfde7afe34137182a4bb8cd98f01d870772be999" +git-tree-sha1 = "1000b18a380773f049ac2f34bc12abd3d99cf21c" uuid = "9255f1d6-53bf-473e-b6bd-23f1ff009da4" -version = "1.6.0" +version = "1.6.1" [[deps.BoundaryValueDiffEqShooting]] deps = ["ADTypes", "ArrayInterface", "BandedMatrices", "BoundaryValueDiffEqCore", "ConcreteStructs", "DiffEqBase", "DifferentiationInterface", "FastAlmostBandedMatrices", "FastClosures", "ForwardDiff", "LinearAlgebra", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield", "SparseArrays"] @@ -378,12 +378,13 @@ version = "1.7.0" [[deps.BracketingNonlinearSolve]] deps = ["CommonSolve", "ConcreteStructs", "NonlinearSolveBase", "PrecompileTools", "Reexport", "SciMLBase"] -git-tree-sha1 = "637ebe439ba587828fd997b7810d8171eed2ea1b" +git-tree-sha1 = "a9014924595b7a2c1dd14aac516e38fa10ada656" uuid = "70df07ce-3d50-431d-a3e7-ca6ddb60ac1e" -version = "1.2.0" -weakdeps = ["ForwardDiff"] +version = "1.3.0" +weakdeps = ["ChainRulesCore", "ForwardDiff"] [deps.BracketingNonlinearSolve.extensions] + BracketingNonlinearSolveChainRulesCoreExt = ["ChainRulesCore", "ForwardDiff"] BracketingNonlinearSolveForwardDiffExt = "ForwardDiff" [[deps.Bzip2_jll]] @@ -411,9 +412,9 @@ version = "0.10.15" [[deps.Cairo_jll]] deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"] -git-tree-sha1 = "2ac646d71d0d24b44f3f8c84da8c9f4d70fb67df" +git-tree-sha1 = "fde3bf89aead2e723284a8ff9cdf5b551ed700e8" uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a" -version = "1.18.4+0" +version = "1.18.5+0" [[deps.Cassette]] git-tree-sha1 = "f8764df8d9d2aec2812f009a1ac39e46c33354b8" @@ -440,9 +441,9 @@ version = "0.10.8" [[deps.ChainRules]] deps = ["Adapt", "ChainRulesCore", "Compat", "Distributed", "GPUArraysCore", "IrrationalConstants", "LinearAlgebra", "Random", "RealDot", "SparseArrays", "SparseInverseSubset", "Statistics", "StructArrays", "SuiteSparse"] -git-tree-sha1 = "a975ae558af61a2a48720a6271661bf2621e0f4e" +git-tree-sha1 = "204e9b212da5cc7df632b58af8d49763383f47fa" uuid = "082447d4-558c-5d27-93f4-14fc19e9eca2" -version = "1.72.3" +version = "1.72.4" [[deps.ChainRulesCore]] deps = ["Compat", "LinearAlgebra"] @@ -706,9 +707,9 @@ version = "0.4.0" [[deps.DiffEqBase]] deps = ["ArrayInterface", "ConcreteStructs", "DataStructures", "DocStringExtensions", "EnumX", "EnzymeCore", "FastBroadcast", "FastClosures", "FastPower", "FunctionWrappers", "FunctionWrappersWrappers", "LinearAlgebra", "Logging", "Markdown", "MuladdMacro", "Parameters", "PrecompileTools", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SciMLStructures", "Setfield", "Static", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "TruncatedStacktraces"] -git-tree-sha1 = "1bcd3a5c585c477e5d0595937ea7b5adcda6c621" +git-tree-sha1 = "a0e5b5669df9465bc3dd32ea4a8ddeefbc0f7b5c" uuid = "2b5f629d-d688-5b77-993f-72d75c75574e" -version = "6.174.0" +version = "6.175.0" [deps.DiffEqBase.extensions] DiffEqBaseCUDAExt = "CUDA" @@ -721,6 +722,7 @@ version = "6.174.0" DiffEqBaseMPIExt = "MPI" DiffEqBaseMeasurementsExt = "Measurements" DiffEqBaseMonteCarloMeasurementsExt = "MonteCarloMeasurements" + DiffEqBaseMooncakeExt = "Mooncake" DiffEqBaseReverseDiffExt = "ReverseDiff" DiffEqBaseSparseArraysExt = "SparseArrays" DiffEqBaseTrackerExt = "Tracker" @@ -737,6 +739,7 @@ version = "6.174.0" MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca" + Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" @@ -902,9 +905,9 @@ version = "3.5.1" [[deps.DynamicPPL]] deps = ["ADTypes", "AbstractMCMC", "AbstractPPL", "Accessors", "BangBang", "Bijectors", "Chairmarks", "Compat", "ConstructionBase", "DifferentiationInterface", "Distributions", "DocStringExtensions", "InteractiveUtils", "LinearAlgebra", "LogDensityProblems", "MacroTools", "OrderedCollections", "Random", "Requires", "Statistics", "Test"] -git-tree-sha1 = "e6b9e984f7a4aa114190c573504d61da41bc7b20" +git-tree-sha1 = "b694a7408cc1083af9f338d83d4a7e11395d6a10" uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8" -version = "0.36.9" +version = "0.36.10" [deps.DynamicPPL.extensions] DynamicPPLChainRulesCoreExt = ["ChainRulesCore"] @@ -935,10 +938,10 @@ uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56" version = "1.0.5" [[deps.Enzyme]] -deps = ["CEnum", "EnzymeCore", "Enzyme_jll", "GPUCompiler", "LLVM", "Libdl", "LinearAlgebra", "ObjectFile", "PrecompileTools", "Preferences", "Printf", "Random", "SparseArrays"] -git-tree-sha1 = "d695c5fd956d98b3f38b9b1c12f22700a9c91549" +deps = ["CEnum", "EnzymeCore", "Enzyme_jll", "GPUCompiler", "InteractiveUtils", "LLVM", "Libdl", "LinearAlgebra", "ObjectFile", "PrecompileTools", "Preferences", "Printf", "Random", "SparseArrays"] +git-tree-sha1 = "be2c627bf432a3a17d6d0e9c461d88bd1a28d3cf" uuid = "7da242da-08ed-463a-9acd-ee780be4f1d9" -version = "0.13.46" +version = "0.13.48" [deps.Enzyme.extensions] EnzymeBFloat16sExt = "BFloat16s" @@ -957,9 +960,9 @@ version = "0.13.46" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [[deps.EnzymeCore]] -git-tree-sha1 = "1eb59f40a772d0fbd4cb75e00b3fa7f5f79c975a" +git-tree-sha1 = "7d7822a643c33bbff4eab9c87ca8459d7c688db0" uuid = "f151be2c-9106-41f4-ab19-57ee4f262869" -version = "0.8.9" +version = "0.8.11" weakdeps = ["Adapt"] [deps.EnzymeCore.extensions] @@ -967,9 +970,9 @@ weakdeps = ["Adapt"] [[deps.Enzyme_jll]] deps = ["Artifacts", "JLLWrappers", "LazyArtifacts", "Libdl", "TOML"] -git-tree-sha1 = "fd483a1d847401a21460090f3f358049b20fbcac" +git-tree-sha1 = "168b7e5924b1fdb14bb246e7263438bb26d040c5" uuid = "7cc45869-7501-5eee-bdea-0790c847d4ef" -version = "0.0.180+0" +version = "0.0.181+0" [[deps.EpollShim_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -1289,9 +1292,9 @@ version = "0.21.0+0" [[deps.Glib_jll]] deps = ["Artifacts", "Gettext_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE2_jll", "Zlib_jll"] -git-tree-sha1 = "b0036b392358c80d2d2124746c2bf3d48d457938" +git-tree-sha1 = "fee60557e4f19d0fe5cd169211fdda80e494f4e8" uuid = "7746bdde-850d-59dc-9ae8-88ece973131d" -version = "2.82.4+0" +version = "2.84.0+0" [[deps.Graphite2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -1336,9 +1339,9 @@ version = "1.10.16" [[deps.HarfBuzz_jll]] deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll"] -git-tree-sha1 = "55c53be97790242c29031e5cd45e8ac296dadda3" +git-tree-sha1 = "f923f9a774fcf3f5cb761bfa43aeadd689714813" uuid = "2e76f6c2-a576-52d4-95c1-20adfe4de566" -version = "8.5.0+0" +version = "8.5.1+0" [[deps.HashArrayMappedTries]] git-tree-sha1 = "2eaa69a7cab70a52b9687c8bf950a5a93ec895ae" @@ -1606,19 +1609,21 @@ version = "1.4.0" [[deps.Latexify]] deps = ["Format", "InteractiveUtils", "LaTeXStrings", "MacroTools", "Markdown", "OrderedCollections", "Requires"] -git-tree-sha1 = "cd10d2cc78d34c0e2a3a36420ab607b611debfbb" +git-tree-sha1 = "4f34eaabe49ecb3fb0d58d6015e32fd31a733199" uuid = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" -version = "0.16.7" +version = "0.16.8" [deps.Latexify.extensions] DataFramesExt = "DataFrames" SparseArraysExt = "SparseArrays" SymEngineExt = "SymEngine" + TectonicExt = "tectonic_jll" [deps.Latexify.weakdeps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" SymEngine = "123dc426-2d89-5057-bbad-38513e3affd8" + tectonic_jll = "d7dd28d6-a5e6-559c-9131-7eb760cdacc5" [[deps.LayoutPointers]] deps = ["ArrayInterface", "LinearAlgebra", "ManualMemory", "SIMDTypes", "Static", "StaticArrayInterface"] @@ -1709,10 +1714,10 @@ uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" version = "1.11.0" [[deps.Libffi_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "27ecae93dd25ee0909666e6835051dd684cc035e" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "c8da7e6a91781c41a863611c7e966098d783c57a" uuid = "e9f186c6-92d2-5b65-8a66-fee21dc1b490" -version = "3.2.2+2" +version = "3.4.7+0" [[deps.Libglvnd_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll", "Xorg_libXext_jll"] @@ -2301,9 +2306,9 @@ version = "0.1.5" [[deps.NamedArrays]] deps = ["Combinatorics", "DataStructures", "DelimitedFiles", "InvertedIndices", "LinearAlgebra", "Random", "Requires", "SparseArrays", "Statistics"] -git-tree-sha1 = "58e317b3b956b8aaddfd33ff4c3e33199cd8efce" +git-tree-sha1 = "b0219babbb69e4f0b292a11ad7f33520bdfcea8f" uuid = "86f7a689-2022-50b4-a561-43c23ac3c673" -version = "0.10.3" +version = "0.10.4" [[deps.NaturalSort]] git-tree-sha1 = "eda490d06b9f7c00752ee81cfa451efe55521e21" @@ -2354,9 +2359,9 @@ version = "4.9.0" [[deps.NonlinearSolveBase]] deps = ["ADTypes", "Adapt", "ArrayInterface", "CommonSolve", "Compat", "ConcreteStructs", "DifferentiationInterface", "EnzymeCore", "FastClosures", "LinearAlgebra", "Markdown", "MaybeInplace", "Preferences", "Printf", "RecursiveArrayTools", "SciMLBase", "SciMLJacobianOperators", "SciMLOperators", "StaticArraysCore", "SymbolicIndexingInterface", "TimerOutputs"] -git-tree-sha1 = "1a6f6b161a644beac3c46a46f9bbb830c24abffb" +git-tree-sha1 = "404d71dd057759f4d590191a643113485c4a482a" uuid = "be0214bd-f91f-a760-ac4e-3421ce2b2da0" -version = "1.8.0" +version = "1.12.0" weakdeps = ["BandedMatrices", "DiffEqBase", "ForwardDiff", "LineSearch", "LinearSolve", "SparseArrays", "SparseMatrixColorings"] [deps.NonlinearSolveBase.extensions] @@ -2376,9 +2381,9 @@ version = "1.5.0" [[deps.NonlinearSolveQuasiNewton]] deps = ["ArrayInterface", "CommonSolve", "ConcreteStructs", "DiffEqBase", "LinearAlgebra", "LinearSolve", "MaybeInplace", "NonlinearSolveBase", "PrecompileTools", "Reexport", "SciMLBase", "SciMLOperators", "StaticArraysCore"] -git-tree-sha1 = "b69a68ef3a7bba7ab1d5ef6321ed6d9a613142b0" +git-tree-sha1 = "e3888bdbab6e0bfadbc3164ef4595e40e7b7e954" uuid = "9a2c21bd-3a47-402d-9113-8faf9a0ee114" -version = "1.5.0" +version = "1.6.0" weakdeps = ["ForwardDiff"] [deps.NonlinearSolveQuasiNewton.extensions] @@ -2422,9 +2427,9 @@ version = "1.3.5+1" [[deps.OneHotArrays]] deps = ["Adapt", "ChainRulesCore", "Compat", "GPUArraysCore", "LinearAlgebra", "NNlib"] -git-tree-sha1 = "3685584454b04cd52169c787ba4d196da8a04d10" +git-tree-sha1 = "bfe8e84c71972f77e775f75e6d8048ad3fdbe8bc" uuid = "0b1bfda6-eb8a-41d2-88d8-f5af5cad476f" -version = "0.2.9" +version = "0.2.10" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] @@ -2486,9 +2491,9 @@ version = "4.3.0" [[deps.OptimizationBase]] deps = ["ADTypes", "ArrayInterface", "DifferentiationInterface", "DocStringExtensions", "FastClosures", "LinearAlgebra", "PDMats", "Reexport", "Requires", "SciMLBase", "SparseArrays", "SparseConnectivityTracer", "SparseMatrixColorings"] -git-tree-sha1 = "070d2c33da5f0b33d57b61f7f601c4ea6185af15" +git-tree-sha1 = "918d9bf579a355222e62ceac955b5382fea7bd61" uuid = "bca83a33-5cc9-4baa-983d-23429ab6bcbb" -version = "2.5.0" +version = "2.7.0" [deps.OptimizationBase.extensions] OptimizationEnzymeExt = "Enzyme" @@ -2537,9 +2542,9 @@ version = "1.8.1" [[deps.OrdinaryDiffEq]] deps = ["ADTypes", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DocStringExtensions", "EnumX", "ExponentialUtilities", "FastBroadcast", "FastClosures", "FillArrays", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "InteractiveUtils", "LineSearches", "LinearAlgebra", "LinearSolve", "Logging", "MacroTools", "MuladdMacro", "NonlinearSolve", "OrdinaryDiffEqAdamsBashforthMoulton", "OrdinaryDiffEqBDF", "OrdinaryDiffEqCore", "OrdinaryDiffEqDefault", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqExplicitRK", "OrdinaryDiffEqExponentialRK", "OrdinaryDiffEqExtrapolation", "OrdinaryDiffEqFIRK", "OrdinaryDiffEqFeagin", "OrdinaryDiffEqFunctionMap", "OrdinaryDiffEqHighOrderRK", "OrdinaryDiffEqIMEXMultistep", "OrdinaryDiffEqLinear", "OrdinaryDiffEqLowOrderRK", "OrdinaryDiffEqLowStorageRK", "OrdinaryDiffEqNonlinearSolve", "OrdinaryDiffEqNordsieck", "OrdinaryDiffEqPDIRK", "OrdinaryDiffEqPRK", "OrdinaryDiffEqQPRK", "OrdinaryDiffEqRKN", "OrdinaryDiffEqRosenbrock", "OrdinaryDiffEqSDIRK", "OrdinaryDiffEqSSPRK", "OrdinaryDiffEqStabilizedIRK", "OrdinaryDiffEqStabilizedRK", "OrdinaryDiffEqSymplecticRK", "OrdinaryDiffEqTsit5", "OrdinaryDiffEqVerner", "Polyester", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SciMLStructures", "SimpleNonlinearSolve", "SimpleUnPack", "SparseArrays", "Static", "StaticArrayInterface", "StaticArrays", "TruncatedStacktraces"] -git-tree-sha1 = "56d5500e9970f0112a4e1ab6474d6fedde61ef64" +git-tree-sha1 = "1c2b2df870944e0dc01454fd87479847c55fa26c" uuid = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" -version = "6.97.0" +version = "6.98.0" [[deps.OrdinaryDiffEqAdamsBashforthMoulton]] deps = ["DiffEqBase", "FastBroadcast", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqLowOrderRK", "Polyester", "RecursiveArrayTools", "Reexport", "Static"] @@ -2549,9 +2554,9 @@ version = "1.2.0" [[deps.OrdinaryDiffEqBDF]] deps = ["ADTypes", "ArrayInterface", "DiffEqBase", "FastBroadcast", "LinearAlgebra", "MacroTools", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqNonlinearSolve", "OrdinaryDiffEqSDIRK", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "StaticArrays", "TruncatedStacktraces"] -git-tree-sha1 = "a72bf554d5fd1f33a8d2aead3562eddd28ba4c76" +git-tree-sha1 = "42755bd13fe56e9d9ce1bc005f8b206a6b56b731" uuid = "6ad6398a-0878-4a85-9266-38940aa047c8" -version = "1.5.0" +version = "1.5.1" [[deps.OrdinaryDiffEqCore]] deps = ["ADTypes", "Accessors", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DocStringExtensions", "EnumX", "FastBroadcast", "FastClosures", "FastPower", "FillArrays", "FunctionWrappersWrappers", "InteractiveUtils", "LinearAlgebra", "Logging", "MacroTools", "MuladdMacro", "Polyester", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SciMLStructures", "SimpleUnPack", "Static", "StaticArrayInterface", "StaticArraysCore", "SymbolicIndexingInterface", "TruncatedStacktraces"] @@ -2571,9 +2576,9 @@ version = "1.4.0" [[deps.OrdinaryDiffEqDifferentiation]] deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "ConstructionBase", "DiffEqBase", "DifferentiationInterface", "FastBroadcast", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "LinearAlgebra", "LinearSolve", "OrdinaryDiffEqCore", "SciMLBase", "SciMLOperators", "SparseArrays", "SparseMatrixColorings", "StaticArrayInterface", "StaticArrays"] -git-tree-sha1 = "315d25dd06614e199973cc13d22e533073bd7458" +git-tree-sha1 = "c78060115fa4ea9d70ac47fa49496acbc630aefa" uuid = "4302a76b-040a-498a-8c04-15b101fed76b" -version = "1.9.0" +version = "1.9.1" [[deps.OrdinaryDiffEqExplicitRK]] deps = ["DiffEqBase", "FastBroadcast", "LinearAlgebra", "MuladdMacro", "OrdinaryDiffEqCore", "RecursiveArrayTools", "Reexport", "TruncatedStacktraces"] @@ -2643,9 +2648,9 @@ version = "1.3.0" [[deps.OrdinaryDiffEqNonlinearSolve]] deps = ["ADTypes", "ArrayInterface", "DiffEqBase", "FastBroadcast", "FastClosures", "ForwardDiff", "LinearAlgebra", "LinearSolve", "MuladdMacro", "NonlinearSolve", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "PreallocationTools", "RecursiveArrayTools", "SciMLBase", "SciMLOperators", "SciMLStructures", "SimpleNonlinearSolve", "StaticArrays"] -git-tree-sha1 = "2f956f14c97ff507e855703ac760d513f7c3e372" +git-tree-sha1 = "ffdb0f5207b0e30f8b1edf99b3b9546d9c48ccaf" uuid = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" -version = "1.9.0" +version = "1.10.0" [[deps.OrdinaryDiffEqNordsieck]] deps = ["DiffEqBase", "FastBroadcast", "LinearAlgebra", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqTsit5", "Polyester", "RecursiveArrayTools", "Reexport", "Static"] @@ -2655,9 +2660,9 @@ version = "1.1.0" [[deps.OrdinaryDiffEqPDIRK]] deps = ["ADTypes", "DiffEqBase", "FastBroadcast", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqNonlinearSolve", "Polyester", "Reexport", "StaticArrays"] -git-tree-sha1 = "f74b27b8b811a83d77a9cad6293e793ab0804cdc" +git-tree-sha1 = "ab9897e4bc8e3cf8e15f1cf61dbdd15d6a2341d7" uuid = "5dd0a6cf-3d4b-4314-aa06-06d4e299bc89" -version = "1.3.0" +version = "1.3.1" [[deps.OrdinaryDiffEqPRK]] deps = ["DiffEqBase", "FastBroadcast", "MuladdMacro", "OrdinaryDiffEqCore", "Polyester", "Reexport"] @@ -2679,9 +2684,9 @@ version = "1.1.0" [[deps.OrdinaryDiffEqRosenbrock]] deps = ["ADTypes", "DiffEqBase", "DifferentiationInterface", "FastBroadcast", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "LinearSolve", "MacroTools", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "Polyester", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "Static"] -git-tree-sha1 = "a9b9aff8e740bfc09a2ea669f7fc02e867f95ab7" +git-tree-sha1 = "063e5ff1447b3869856ed264b6dcbb21e6e8bdb0" uuid = "43230ef6-c299-4910-a778-202eb28ce4ce" -version = "1.10.0" +version = "1.10.1" [[deps.OrdinaryDiffEqSDIRK]] deps = ["ADTypes", "DiffEqBase", "FastBroadcast", "LinearAlgebra", "MacroTools", "MuladdMacro", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqNonlinearSolve", "RecursiveArrayTools", "Reexport", "SciMLBase", "TruncatedStacktraces"] @@ -2744,9 +2749,9 @@ weakdeps = ["Requires", "TOML"] [[deps.Pango_jll]] deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "FriBidi_jll", "Glib_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl"] -git-tree-sha1 = "3b31172c032a1def20c98dae3f2cdc9d10e3b561" +git-tree-sha1 = "275a9a6d85dc86c24d03d1837a0010226a96f540" uuid = "36c8627f-9965-5494-a995-c6b170f724f3" -version = "1.56.1+0" +version = "1.56.3+0" [[deps.Parameters]] deps = ["OrderedCollections", "UnPack"] @@ -2815,9 +2820,9 @@ version = "0.4.4" [[deps.Polyester]] deps = ["ArrayInterface", "BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "ManualMemory", "PolyesterWeave", "Static", "StaticArrayInterface", "StrideArraysCore", "ThreadingUtilities"] -git-tree-sha1 = "2082cc4be5e765bd982ed04ea06c068f4f702410" +git-tree-sha1 = "6f7cd22a802094d239824c57d94c8e2d0f7cfc7d" uuid = "f517fe37-dbe3-4b94-8317-1923a5111588" -version = "0.7.17" +version = "0.7.18" [[deps.PolyesterWeave]] deps = ["BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "Static", "ThreadingUtilities"] @@ -3085,9 +3090,9 @@ version = "2.2.7" [[deps.RuntimeGeneratedFunctions]] deps = ["ExprTools", "SHA", "Serialization"] -git-tree-sha1 = "7cb9d10026d630ce2dd2a1fc6006a3d5041b34c0" +git-tree-sha1 = "86a8a8b783481e1ea6b9c91dd949cb32191f8ab4" uuid = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47" -version = "0.5.14" +version = "0.5.15" [[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" @@ -3105,10 +3110,10 @@ uuid = "26aad666-b158-4e64-9d35-0e672562fa48" version = "0.5.0" [[deps.SciMLBase]] -deps = ["ADTypes", "Accessors", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "Moshi", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface"] -git-tree-sha1 = "2fd047893cb0089b180fcbb7e8434ba15dcc2841" +deps = ["ADTypes", "Accessors", "Adapt", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "Moshi", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface"] +git-tree-sha1 = "ce947672206f6a3a2bee1017c690cfd5fd82d897" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "2.87.0" +version = "2.96.0" [deps.SciMLBase.extensions] SciMLBaseChainRulesCoreExt = "ChainRulesCore" @@ -3133,15 +3138,15 @@ version = "2.87.0" [[deps.SciMLJacobianOperators]] deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "ConstructionBase", "DifferentiationInterface", "FastClosures", "LinearAlgebra", "SciMLBase", "SciMLOperators"] -git-tree-sha1 = "d563758f3ce5153810adebc534d88e24d34eeb95" +git-tree-sha1 = "7da1216346ad79499d08d7e2a3dbf297dc80c829" uuid = "19f34311-ddf3-4b8b-af20-060888a46c0e" -version = "0.1.5" +version = "0.1.6" [[deps.SciMLOperators]] deps = ["Accessors", "ArrayInterface", "DocStringExtensions", "LinearAlgebra", "MacroTools"] -git-tree-sha1 = "1c4b7f6c3e14e6de0af66e66b86d525cae10ecb4" +git-tree-sha1 = "85608e4aaf758547ffc4030c908318b432114ec9" uuid = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" -version = "0.3.13" +version = "1.3.0" weakdeps = ["SparseArrays", "StaticArraysCore"] [deps.SciMLOperators.extensions] @@ -3150,9 +3155,9 @@ weakdeps = ["SparseArrays", "StaticArraysCore"] [[deps.SciMLSensitivity]] deps = ["ADTypes", "Accessors", "Adapt", "ArrayInterface", "ChainRulesCore", "DiffEqBase", "DiffEqCallbacks", "DiffEqNoiseProcess", "Distributions", "Enzyme", "FastBroadcast", "FiniteDiff", "ForwardDiff", "FunctionProperties", "FunctionWrappersWrappers", "Functors", "GPUArraysCore", "LinearAlgebra", "LinearSolve", "Markdown", "OrdinaryDiffEqCore", "PreallocationTools", "QuadGK", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "ReverseDiff", "SciMLBase", "SciMLJacobianOperators", "SciMLStructures", "StaticArrays", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tracker", "Zygote"] -git-tree-sha1 = "58e0e458e6a22b8288230531ec2fc51fd4172597" +git-tree-sha1 = "22402dfac0823491e0d3ae3b916940e6761f6e86" uuid = "1ed8b502-d754-442c-8d5d-10ac956f44a1" -version = "7.83.0" +version = "7.84.0" weakdeps = ["Mooncake"] [deps.SciMLSensitivity.extensions] @@ -3282,26 +3287,6 @@ version = "0.6.18" NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" -[[deps.SparseDiffTools]] -deps = ["ADTypes", "Adapt", "ArrayInterface", "Compat", "DataStructures", "FiniteDiff", "ForwardDiff", "Graphs", "LinearAlgebra", "PackageExtensionCompat", "Random", "Reexport", "SciMLOperators", "Setfield", "SparseArrays", "StaticArrayInterface", "StaticArrays", "UnPack", "VertexSafeGraphs"] -git-tree-sha1 = "d79802152d958607f414f5447cb25e314db979c0" -uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804" -version = "2.23.1" - - [deps.SparseDiffTools.extensions] - SparseDiffToolsEnzymeExt = "Enzyme" - SparseDiffToolsPolyesterExt = "Polyester" - SparseDiffToolsPolyesterForwardDiffExt = "PolyesterForwardDiff" - SparseDiffToolsSymbolicsExt = "Symbolics" - SparseDiffToolsZygoteExt = "Zygote" - - [deps.SparseDiffTools.weakdeps] - Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9" - Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" - PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b" - Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" - Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" - [[deps.SparseInverseSubset]] deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"] git-tree-sha1 = "52962839426b75b3021296f7df242e40ecfc0852" @@ -3395,9 +3380,9 @@ weakdeps = ["SparseArrays"] [[deps.StatsAPI]] deps = ["LinearAlgebra"] -git-tree-sha1 = "1ff449ad350c9c4cbc756624d6f8a8c3ef56d3ed" +git-tree-sha1 = "9d72a13a3f4dd3795a195ac5a44d7d6ff5f552ff" uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" -version = "1.7.0" +version = "1.7.1" [[deps.StatsBase]] deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] @@ -3435,10 +3420,10 @@ uuid = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f" version = "2.5.0" [[deps.StochasticDiffEq]] -deps = ["ADTypes", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DiffEqNoiseProcess", "DocStringExtensions", "FastPower", "FiniteDiff", "ForwardDiff", "JumpProcesses", "LevyArea", "LinearAlgebra", "Logging", "MuladdMacro", "NLsolve", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqNonlinearSolve", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SparseArrays", "SparseDiffTools", "StaticArrays", "UnPack"] -git-tree-sha1 = "b1e151feffd589382530930da1467474fe8c37e4" +deps = ["ADTypes", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DiffEqNoiseProcess", "DocStringExtensions", "FastPower", "FiniteDiff", "ForwardDiff", "JumpProcesses", "LevyArea", "LinearAlgebra", "Logging", "MuladdMacro", "NLsolve", "OrdinaryDiffEqCore", "OrdinaryDiffEqDifferentiation", "OrdinaryDiffEqNonlinearSolve", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SparseArrays", "StaticArrays", "UnPack"] +git-tree-sha1 = "2992af2739fdcf5862b12dcf53a5f6e3e4acd358" uuid = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0" -version = "6.79.0" +version = "6.80.0" [[deps.StrideArraysCore]] deps = ["ArrayInterface", "CloseOpenIntervals", "IfElse", "LayoutPointers", "LinearAlgebra", "ManualMemory", "SIMDTypes", "Static", "StaticArrayInterface", "ThreadingUtilities"] @@ -3675,9 +3660,9 @@ version = "1.6.0" [[deps.Turing]] deps = ["ADTypes", "AbstractMCMC", "Accessors", "AdvancedHMC", "AdvancedMH", "AdvancedPS", "AdvancedVI", "BangBang", "Bijectors", "Compat", "DataStructures", "Distributions", "DistributionsAD", "DocStringExtensions", "DynamicPPL", "EllipticalSliceSampling", "ForwardDiff", "Libtask", "LinearAlgebra", "LogDensityProblems", "MCMCChains", "NamedArrays", "Optimization", "OptimizationOptimJL", "OrderedCollections", "Printf", "Random", "Reexport", "SciMLBase", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"] -git-tree-sha1 = "50278624e9f897592db26d498f7a94c856051169" +git-tree-sha1 = "a22c829eaf08b3c40f7e106e81b21233c726052e" uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0" -version = "0.38.3" +version = "0.38.4" weakdeps = ["DynamicHMC", "Optim"] [deps.Turing.extensions] @@ -3722,9 +3707,9 @@ weakdeps = ["ConstructionBase", "InverseFunctions"] [[deps.UnitfulLatexify]] deps = ["LaTeXStrings", "Latexify", "Unitful"] -git-tree-sha1 = "975c354fcd5f7e1ddcc1f1a23e6e091d99e99bc8" +git-tree-sha1 = "af305cc62419f9bd61b6644d19170a4d258c7967" uuid = "45397f5d-5981-4c77-b2b3-fc36d6e9b728" -version = "1.6.4" +version = "1.7.0" [[deps.UnsafeAtomics]] git-tree-sha1 = "b13c4edda90890e5b04ba24e20a310fbe6f249ff" @@ -3740,12 +3725,6 @@ git-tree-sha1 = "ca0969166a028236229f63514992fc073799bb78" uuid = "41fe7b60-77ed-43a1-b4f0-825fd5a5650d" version = "0.2.0" -[[deps.VertexSafeGraphs]] -deps = ["Graphs"] -git-tree-sha1 = "8351f8d73d7e880bfc042a8b6922684ebeafb35c" -uuid = "19fa3120-7c27-5ec5-8db8-b0b0aa330d6f" -version = "0.2.0" - [[deps.Vulkan_Loader_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Wayland_jll", "Xorg_libX11_jll", "Xorg_libXrandr_jll", "xkbcommon_jll"] git-tree-sha1 = "2f0486047a07670caad3a81a075d2e518acc5c59" @@ -3753,10 +3732,10 @@ uuid = "a44049a8-05dd-5a78-86c9-5fde0876e88c" version = "1.3.243+0" [[deps.Wayland_jll]] -deps = ["Artifacts", "EpollShim_jll", "Expat_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg", "XML2_jll"] -git-tree-sha1 = "85c7811eddec9e7f22615371c3cc81a504c508ee" +deps = ["Artifacts", "EpollShim_jll", "Expat_jll", "JLLWrappers", "Libdl", "Libffi_jll", "XML2_jll"] +git-tree-sha1 = "49be0be57db8f863a902d59c0083d73281ecae8e" uuid = "a2964d1f-97da-50d4-b82a-358c7fce9d89" -version = "1.21.0+2" +version = "1.23.1+0" [[deps.Wayland_protocols_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -3772,9 +3751,9 @@ version = "1.4.2" [[deps.WeightInitializers]] deps = ["ArgCheck", "ConcreteStructs", "GPUArraysCore", "LinearAlgebra", "Random", "SpecialFunctions", "Statistics"] -git-tree-sha1 = "b7f5993dc0a6f9ac74f53de588db96235cdd79a2" +git-tree-sha1 = "57db7a10930d4ccc9e4ee3d9122748f845e645cf" uuid = "d49dbf32-c5c2-4618-8acc-27bb2598ef2d" -version = "1.1.2" +version = "1.1.3" [deps.WeightInitializers.extensions] WeightInitializersAMDGPUExt = ["AMDGPU", "GPUArrays"] diff --git a/_quarto.yml b/_quarto.yml index 81cd0613d..791b30c20 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -66,6 +66,7 @@ website: - usage/sampler-visualisation/index.qmd - usage/dynamichmc/index.qmd - usage/external-samplers/index.qmd + - usage/troubleshooting/index.qmd - section: "Tutorials" contents: @@ -181,17 +182,19 @@ probabilistic-pca: tutorials/11-probabilistic-pca gplvm: tutorials/12-gplvm seasonal-time-series: tutorials/13-seasonal-time-series using-turing-advanced: tutorials/docs-09-using-turing-advanced -using-turing-autodiff: tutorials/docs-10-using-turing-autodiff -using-turing-dynamichmc: tutorials/docs-11-using-turing-dynamichmc using-turing: tutorials/docs-12-using-turing-guide -using-turing-performance-tips: tutorials/docs-13-using-turing-performance-tips -using-turing-sampler-viz: tutorials/docs-15-using-turing-sampler-viz -using-turing-external-samplers: tutorials/docs-16-using-turing-external-samplers -using-turing-mode-estimation: tutorials/docs-17-mode-estimation -usage-probability-interface: tutorials/usage-probability-interface -usage-custom-distribution: tutorials/usage-custom-distribution -usage-tracking-extra-quantities: tutorials/tracking-extra-quantities -usage-modifying-logprob: tutorials/usage-modifying-logprob + +usage-automatic-differentiation: usage/automatic-differentiation +usage-custom-distribution: usage/custom-distribution +usage-dynamichmc: usage/dynamichmc +usage-external-samplers: usage/external-samplers +usage-mode-estimation: usage/mode-estimation +usage-modifying-logprob: usage/modifying-logprob +usage-performance-tips: usage/performance-tips +usage-probability-interface: usage/probability-interface +usage-sampler-visualisation: usage/sampler-visualisation +usage-tracking-extra-quantities: usage/tracking-extra-quantities +usage-troubleshooting: usage/troubleshooting contributing-guide: developers/contributing dev-model-manual: developers/compiler/model-manual diff --git a/usage/performance-tips/index.qmd b/usage/performance-tips/index.qmd index d5a26a029..4bbab345a 100755 --- a/usage/performance-tips/index.qmd +++ b/usage/performance-tips/index.qmd @@ -52,7 +52,7 @@ supports several AD backends, including [ForwardDiff](https://github.com/JuliaDi For many common types of models, the default ForwardDiff backend performs great, and there is no need to worry about changing it. However, if you need more speed, you can try different backends via the standard [ADTypes](https://github.com/SciML/ADTypes.jl) interface by passing an `AbstractADType` to the sampler with the optional `adtype` argument, e.g. -`NUTS(adtype = AutoZygote())`. See [Automatic Differentiation]({{}}) for details. Generally, `adtype = AutoForwardDiff()` is likely to be the fastest and most reliable for models with +`NUTS(adtype = AutoZygote())`. See [Automatic Differentiation]({{}}) for details. Generally, `adtype = AutoForwardDiff()` is likely to be the fastest and most reliable for models with few parameters (say, less than 20 or so), while reverse-mode backends such as `AutoZygote()` or `AutoReverseDiff()` will perform better for models with many parameters or linear algebra operations. If in doubt, it's easy to try a few different backends to see how they compare. diff --git a/usage/troubleshooting/index.qmd b/usage/troubleshooting/index.qmd new file mode 100755 index 000000000..26a8257c9 --- /dev/null +++ b/usage/troubleshooting/index.qmd @@ -0,0 +1,104 @@ +--- +title: Troubleshooting +engine: julia +--- + +```{julia} +#| echo: false +#| output: false +using Pkg; +Pkg.instantiate(); +``` + +This page collects a number of common error messages observed when using Turing, along with suggestions on how to fix them. + +If the suggestions here do not resolve your problem, please do feel free to [open an issue](https://github.com/TuringLang/Turing.jl/issues). + +```{julia} +using Turing +Turing.setprogress!(false) +``` + +## Initial parameters + +> failed to find valid initial parameters in {N} tries. This may indicate an error with the model or AD backend... + +This error is seen when a Hamiltonian Monte Carlo sampler is unable to determine a valid set of initial parameters for the sampling. +Here, 'valid' means that the log probability density of the model, as well as its gradient with respect to each parameter, is finite and not `NaN`. + +### `NaN` gradient + +One of the most common causes of this error is having a `NaN` gradient. +To find out whether this is happening, you can evaluate the gradient manually. +Here is an example with a model that is known to be problematic: + +```{julia} +using Turing +using DynamicPPL.TestUtils.AD: run_ad + +@model function initial_bad() + a ~ Normal() + x ~ truncated(Normal(a), 0, Inf) +end + +model = initial_bad() +adtype = AutoForwardDiff() +result = run_ad(model, adtype; test=false, benchmark=false) +result.grad_actual +``` + +(See [the DynamicPPL docs](https://turinglang.org/DynamicPPL.jl/stable/api/#AD-testing-and-benchmarking-utilities) for more details on the `run_ad` function and its return type.) + +In this case, the `NaN` gradient is caused by the `Inf` argument to `truncated`. +(See, e.g., [this issue on Distributions.jl](https://github.com/JuliaStats/Distributions.jl/issues/1910).) +Here, the upper bound of `Inf` is not needed, so it can be removed: + +```{julia} +@model function initial_good() + a ~ Normal() + x ~ truncated(Normal(a); lower=0) +end + +model = initial_good() +adtype = AutoForwardDiff() +run_ad(model, adtype; test=false, benchmark=false).grad_actual +``` + +More generally, you could try using a different AD backend; if you don't know why a model is returning `NaN` gradients, feel free to open an issue. + +### `-Inf` log density + +Another cause of this error is having models with very extreme parameters. +This example is taken from [this Turing.jl issue](https://github.com/TuringLang/Turing.jl/issues/2476): + +```{julia} +@model function initial_bad2() + x ~ Exponential(100) + y ~ Uniform(0, x) +end +model = initial_bad2() | (y = 50.0,) +``` + +The problem here is that HMC attempts to find initial values for parameters inside the region of `[-2, 2]`, _after_ the parameters have been transformed to unconstrained space. +For a distribution of `Exponential(100)`, the appropriate transformation is `log(x)` (see the [variable transformation docs]({{< meta dev-transforms-distributions >}}) for more info). + +Thus, HMC attempts to find initial values of `log(x)` in the region of `[-2, 2]`, which corresponds to `x` in the region of `[exp(-2), exp(2)]` = `[0.135, 7.39]`. +However, all of these values of `x` will give rise to a zero probability density for `y` because the value of `y = 50.0` is outside the support of `Uniform(0, x)`. +Thus, the log density of the model is `-Inf`, as can be seen with `logjoint`: + +```{julia} +logjoint(model, (x = exp(-2),)) +``` + +```{julia} +logjoint(model, (x = exp(2),)) +``` + +The most direct way of fixing this is to manually provide a set of initial parameters that are valid. +For example, you can obtain a set of initial parameters with `rand(Vector, model)`, and then pass this as the `initial_params` keyword argument to `sample`: + +```{julia} +sample(model, NUTS(), 1000; initial_params=rand(Vector, model)) +``` + +More generally, you may also consider reparameterising the model to avoid such issues.