Skip to content

Commit ab9cbaf

Browse files
committed
Merge branch 'main' into ah-grammar
2 parents 51e047e + 8a756f6 commit ab9cbaf

File tree

19 files changed

+910
-532
lines changed

19 files changed

+910
-532
lines changed

.github/workflows/create_release.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ jobs:
2323

2424
- name: Set up Quarto
2525
uses: quarto-dev/quarto-actions/setup@v2
26-
with:
27-
# Needs Quarto 1.6 (which is currently a pre-release version) to fix #533
28-
version: pre-release
2926

3027
- name: Restore cached _freeze folder
3128
id: cache-restore

Manifest.toml

Lines changed: 335 additions & 372 deletions
Large diffs are not rendered by default.

Project.toml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,18 @@ ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
33
AbstractGPs = "99985d1d-32ba-4be9-9821-2ec096f28918"
44
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
55
AbstractPPL = "7a57a42e-76ec-4ea3-a279-07e840d6d9cf"
6-
AdvancedHMC = "0bf59076-c3b1-5ca4-86bd-e02cd72cde3d"
76
AdvancedMH = "5b7e9947-ddc0-4b3f-9b55-0d8042f74170"
87
AdvancedVI = "b5ca4192-6429-45e5-a2d9-87aec30a685c"
98
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"
109
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
11-
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
10+
Chairmarks = "0ca39b1e-fe0b-4e98-acfc-b1656634c4de"
1211
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
13-
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
14-
DelayDiffEq = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb"
1512
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
1613
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
1714
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
18-
DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c"
1915
DynamicHMC = "bbc10e6e-7c05-544b-b16e-64fede858acb"
2016
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"
2117
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
22-
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
2318
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
2419
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
2520
GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a"
@@ -29,31 +24,31 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2924
LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
3025
LogDensityProblemsAD = "996a588d-648d-4e1f-a8f0-a84b347e47b1"
3126
LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
27+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
3228
Lux = "b2108857-7c20-44ae-9111-449ecde12c47"
3329
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
3430
MLDataUtils = "cc2ba9b6-d476-5e6d-8eaf-a92d5412d41d"
3531
MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54"
3632
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
3733
Measures = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
38-
Memoization = "6fafb56a-5788-4b4e-91ca-c0cea6611c73"
3934
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
4035
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
4136
Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2"
42-
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
4337
OptimizationNLopt = "4e6fcdb7-1186-4e1f-a706-475e75c168bb"
4438
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
4539
PDMats = "90014a1f-27ba-587c-ab20-58faa44d9150"
40+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
4641
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
4742
RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b"
4843
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
4944
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
5045
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1"
46+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
5147
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
5248
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
5349
StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
5450
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
5551
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
56-
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
5752

5853
[compat]
59-
Turing = "0.40"
54+
Turing = "0.41"

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
<p align="center">
2+
<picture>
3+
<source media="(prefers-color-scheme: dark)" srcset="https://turinglang.org/assets/logo/turing-logo-dark.svg">
4+
<img src="https://turinglang.org/assets/logo/turing-logo-light.svg" alt="Turing.jl logo" width="300">
5+
</picture>
6+
</p>
7+
<p align="center"><i>Bayesian inference with probabilistic programming</i></p>
8+
19
# Turing.jl Documentation and Tutorials
210

311
**https://turinglang.org/docs/**

_brand.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
logo:
2+
medium:
3+
light: https://turinglang.org/assets/logo/turing-logo-light.svg
4+
dark: https://turinglang.org/assets/logo/turing-logo-dark.svg

_includes/footer.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<footer class="custom-footer">
2+
<div class="footer-container">
3+
<div class="footer-grid">
4+
<div class="footer-links-wrapper">
5+
<div class="footer-column footer-explore">
6+
<h5>Explore</h5>
7+
<a href="https://turinglang.org/docs/getting-started/">Get Started</a>
8+
<a href="https://turinglang.org/docs/tutorials/">Tutorials</a>
9+
<a href="https://turinglang.org/docs/faq/">FAQ</a>
10+
<a href="https://turinglang.org/library/">Libraries</a>
11+
<a href="https://turinglang.org/news/">News</a>
12+
<a href="https://turinglang.org/team/">Team</a>
13+
</div>
14+
15+
<div class="footer-column footer-connect">
16+
<h5>Connect</h5>
17+
<a href="https://github.com/TuringLang" target="_blank" rel="noopener"><i class="bi bi-github"></i> GitHub</a>
18+
<a href="https://x.com/TuringLang" target="_blank" rel="noopener"><i class="bi bi-twitter-x"></i> Twitter</a>
19+
<a href="https://julialang.slack.com/archives/CCYDC34A0" target="_blank" rel="noopener"><i class="bi bi-slack"></i> Slack</a>
20+
<a href="https://discourse.julialang.org/c/domain/probprog/48" target="_blank" rel="noopener"><i class="bi bi-chat-dots"></i> Discourse</a>
21+
</div>
22+
</div>
23+
24+
<div class="footer-column footer-brands">
25+
<h5>Supported by leading researchers</h5>
26+
<p>Turing.jl is developed by researchers and engineers at the following research institutions.</p>
27+
<div class="logo-grid">
28+
<a href="https://mlg.eng.cam.ac.uk/" class="partner-logo" target="_blank" rel="noopener">
29+
<img src="/assets/images/brands/university-cambridge-logo-black-example-640x132.png" alt="University of Cambridge Logo" class="brands-light-mode-logo">
30+
<img src="/assets/images/brands/university-cambridge-logo-white-example-640x133.png" alt="University of Cambridge Logo Dark" class="brands-dark-mode-logo">
31+
</a>
32+
<a href="https://www.turing.ac.uk/" class="partner-logo" target="_blank" rel="noopener">
33+
<img src="/assets/images/brands/Turing_Logo_1000x400px_Black.webp" alt="The Alan Turing Institute Logo" class="brands-light-mode-logo">
34+
<img src="/assets/images/brands/Turing_Logo_1000x400px_White.webp" alt="The Alan Turing Institute Logo Dark" class="brands-dark-mode-logo">
35+
</a>
36+
</div>
37+
</div>
38+
39+
</div>
40+
<div class="footer-bottom">
41+
<p>Turing.jl was created by <a href="https://mlg.eng.cam.ac.uk/hong/" target="_blank" rel="noopener">Hong Ge</a>, and maintained by the core <a href="https://turinglang.org/team/" target="_blank" rel="noopener">team</a> of developers and <a href="https://github.com/TuringLang/Turing.jl/graphs/contributors" target="_blank" rel="noopener">contributors</a>.<br>© 2025 The Turing Project Contributors. <a href="https://github.com/TuringLang/Turing.jl/blob/master/LICENCE" target="_blank" rel="noopener">MIT License</a>.</p>
42+
<a href="https://github.com/TuringLang/docs/" target="_blank" rel="noopener" class="footer-source-link"><i class="bi bi-github"></i> Website Source</a>
43+
</div>
44+
</div>
45+
</footer>

_quarto.yml

Lines changed: 9 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ website:
2626
location: navbar
2727
type: overlay
2828
navbar:
29-
logo: "/assets/images/turing-logo.svg"
29+
title: false
3030
logo-href: https://turinglang.org/
3131
left:
3232
- text: Get Started
@@ -43,7 +43,7 @@ website:
4343
href: https://turinglang.org/team/
4444
right:
4545
# Current version
46-
- text: "v0.40"
46+
- text: "v0.41"
4747
menu:
4848
- text: Changelog
4949
href: https://turinglang.org/docs/changelog.html
@@ -117,6 +117,11 @@ website:
117117
- developers/compiler/minituring-contexts/index.qmd
118118
- developers/compiler/design-overview/index.qmd
119119

120+
- section: "DynamicPPL Models"
121+
collapse-level: 1
122+
contents:
123+
- developers/models/varinfo-overview/index.qmd
124+
120125
- section: "DynamicPPL Contexts"
121126
collapse-level: 1
122127
contents:
@@ -167,52 +172,7 @@ format:
167172
}
168173
</style>
169174
include-after-body:
170-
- text: |
171-
<footer class="custom-footer">
172-
<div class="footer-container">
173-
<div class="footer-grid">
174-
<div class="footer-links-wrapper">
175-
<div class="footer-column footer-explore">
176-
<h5>Explore</h5>
177-
<a href="https://turinglang.org/docs/getting-started/">Get Started</a>
178-
<a href="https://turinglang.org/docs/tutorials/">Tutorials</a>
179-
<a href="https://turinglang.org/docs/faq/">FAQ</a>
180-
<a href="https://turinglang.org/library/">Libraries</a>
181-
<a href="https://turinglang.org/news/">News</a>
182-
<a href="https://turinglang.org/team/">Team</a>
183-
</div>
184-
185-
<div class="footer-column footer-connect">
186-
<h5>Connect</h5>
187-
<a href="https://github.com/TuringLang" target="_blank" rel="noopener"><i class="bi bi-github"></i> GitHub</a>
188-
<a href="https://x.com/TuringLang" target="_blank" rel="noopener"><i class="bi bi-twitter-x"></i> Twitter</a>
189-
<a href="https://julialang.slack.com/archives/CCYDC34A0" target="_blank" rel="noopener"><i class="bi bi-slack"></i> Slack</a>
190-
<a href="https://discourse.julialang.org/c/domain/probprog/48" target="_blank" rel="noopener"><i class="bi bi-chat-dots"></i> Discourse</a>
191-
</div>
192-
</div>
193-
194-
<div class="footer-column footer-brands">
195-
<h5>Supported by leading researchers</h5>
196-
<p>Turing.jl is developed by researchers and engineers at the following research institutions.</p>
197-
<div class="logo-grid">
198-
<a href="https://mlg.eng.cam.ac.uk/" class="partner-logo" target="_blank" rel="noopener">
199-
<img src="/assets/images/brands/university-cambridge-logo-black-example-640x132.png" alt="University of Cambridge Logo" class="brands-light-mode-logo">
200-
<img src="/assets/images/brands/university-cambridge-logo-white-example-640x133.png" alt="University of Cambridge Logo Dark" class="brands-dark-mode-logo">
201-
</a>
202-
<a href="https://www.turing.ac.uk/" class="partner-logo" target="_blank" rel="noopener">
203-
<img src="/assets/images/brands/Turing_Logo_1000x400px_Black.webp" alt="The Alan Turing Institute Logo" class="brands-light-mode-logo">
204-
<img src="/assets/images/brands/Turing_Logo_1000x400px_White.webp" alt="The Alan Turing Institute Logo Dark" class="brands-dark-mode-logo">
205-
</a>
206-
</div>
207-
</div>
208-
209-
</div>
210-
<div class="footer-bottom">
211-
<p>Turing.jl was created by <a href="https://mlg.eng.cam.ac.uk/hong/" target="_blank" rel="noopener">Hong Ge</a>, and maintained by the core <a href="https://turinglang.org/team/" target="_blank" rel="noopener">team</a> of developers and <a href="https://github.com/TuringLang/Turing.jl/graphs/contributors" target="_blank" rel="noopener">contributors</a>.<br>© 2025 The Turing Project Contributors. <a href="https://github.com/TuringLang/Turing.jl/blob/master/LICENCE" target="_blank" rel="noopener">MIT Licence</a>.</p>
212-
<a href="https://github.com/TuringLang/docs/" target="_blank" rel="noopener" class="footer-source-link"><i class="bi bi-github"></i> Website Source</a>
213-
</div>
214-
</div>
215-
</footer>
175+
file: _includes/footer.html
216176

217177
execute:
218178
echo: true
@@ -267,3 +227,4 @@ dev-transforms-distributions: developers/transforms/distributions
267227
dev-transforms-bijectors: developers/transforms/bijectors
268228
dev-transforms-dynamicppl: developers/transforms/dynamicppl
269229
dev-contexts-submodel-condition: developers/contexts/submodel-condition
230+
dev-models-varinfo-overview: developers/models/varinfo-overview

developers/compiler/design-overview/index.qmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The following are the main jobs of the `@model` macro:
3636

3737
## The model
3838

39+
<!-- Very outdated
3940
A `model::Model` is a callable struct that one can sample from by calling
4041
4142
```{julia}
@@ -273,4 +274,4 @@ Note that in order to make `md::Metadata` type stable, all the `md.vns` must hav
273274
274275
However, in `Turing` models one cannot have this restriction, so we must use a type unstable `Metadata` if we want to use one `Metadata` instance for the whole model. This is what `UntypedVarInfo` does. A type unstable `Metadata` will still work but will have inferior performance.
275276
276-
To strike a balance between flexibility and performance when constructing the `spl::Sampler` instance, the model is first run by sampling the parameters in `P` from their priors using an `UntypedVarInfo`, i.e. a type unstable `Metadata` is used for all the variables. Then once all the symbols and distribution types have been identified, a `vi::TypedVarInfo` is constructed where `vi.metadata` is a `NamedTuple` mapping each symbol in `P` to a specialized instance of `Metadata`. So as long as each symbol in `P` is sampled from only one type of distributions, `vi::TypedVarInfo` will have fully concretely typed fields which brings out the peak performance of Julia.
277+
To strike a balance between flexibility and performance when constructing the `spl::Sampler` instance, the model is first run by sampling the parameters in `P` from their priors using an `UntypedVarInfo`, i.e. a type unstable `Metadata` is used for all the variables. Then once all the symbols and distribution types have been identified, a `vi::TypedVarInfo` is constructed where `vi.metadata` is a `NamedTuple` mapping each symbol in `P` to a specialized instance of `Metadata`. So as long as each symbol in `P` is sampled from only one type of distributions, `vi::TypedVarInfo` will have fully concretely typed fields which brings out the peak performance of Julia.

developers/contexts/submodel-condition/index.qmd

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,14 @@ We begin by mentioning some high-level desiderata for their joint behaviour.
102102
Take these models, for example:
103103

104104
```{julia}
105-
# We define a helper function to unwrap a layer of SamplingContext, to
106-
# avoid cluttering the print statements.
107-
unwrap_sampling_context(ctx::DynamicPPL.SamplingContext) = ctx.context
108-
unwrap_sampling_context(ctx::DynamicPPL.AbstractContext) = ctx
109-
110105
@model function inner()
111-
println("inner context: $(unwrap_sampling_context(__model__.context))")
106+
println("inner context: $(__model__.context)")
112107
x ~ Normal()
113108
return y ~ Normal()
114109
end
115110
116111
@model function outer()
117-
println("outer context: $(unwrap_sampling_context(__model__.context))")
112+
println("outer context: $(__model__.context)")
118113
return a ~ to_submodel(inner())
119114
end
120115
@@ -124,7 +119,7 @@ with_outer_cond = outer() | (@varname(a.x) => 1.0)
124119
# 'Inner conditioning'
125120
inner_cond = inner() | (@varname(x) => 1.0)
126121
@model function outer2()
127-
println("outer context: $(unwrap_sampling_context(__model__.context))")
122+
println("outer context: $(__model__.context)")
128123
return a ~ to_submodel(inner_cond)
129124
end
130125
with_inner_cond = outer2()

0 commit comments

Comments
 (0)