# Exporting TuringGLM code

**URL:** <https://discourse.julialang.org/t/exporting-turingglm-code/110738>\
**Category:** Probabilistic Programming\
**Tags:** turing\
**Created:** [February 25, 2024, 2:14pm UTC](https://discourse.julialang.org/t/exporting-turingglm-code/110738 "2024-02-25T14:14:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_P](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Sam\_P](https://discourse.julialang.org/u/Sam_P)\
**Post date:** [February 25, 2024, 2:14pm UTC](https://discourse.julialang.org/t/exporting-turingglm-code/110738/1 "2024-02-25T14:14:19Z")

</div>

Hi all - R and cmdstan user here trying his hands on Julia and Turing.

Came across `TuringGLM` and I like its smooth interface akin to what `brms` is to RStan.

I do want to learn the raw Turing code though, and was wondering if there is a way to export the code generated under the hood by TuringGLM? I can then use that as a base and tinker with it for a more complicated structure for example.

i.e. Is there an equivalent function to the `make_stancode` function in `brms`?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![p-gw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/p-gw/32/210518_2.png) [@p-gw](https://discourse.julialang.org/u/p-gw)\
**Post date:** [February 26, 2024, 1:56pm UTC](https://discourse.julialang.org/t/exporting-turingglm-code/110738/2 "2024-02-26T13:56:24Z")

</div>

As far as I understand it TuringGLM does not generate code in the way `brms` does.  
It’s actually more comparable to `rstanarm` in that it specifies some models that can be manipulated by prior choices etc.

Anyways the model code for those models is still available in [TuringGLM.jl/src/turing\_model.jl at main · TuringLang/TuringGLM.jl · GitHub](https://github.com/TuringLang/TuringGLM.jl/blob/main/src/turing_model.jl)  
where all the `_model` functions contain the respective Turing models.

---

<div class="post-metadata">

**Author:** ![jalster](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@jalster](https://discourse.julialang.org/u/jalster)\
**Post date:** [August 15, 2026, 7:43am UTC](https://discourse.julialang.org/t/exporting-turingglm-code/110738/3 "2026-08-15T07:43:48Z")

</div>

I recently proposed [TuringRegressions.jl](https://discourse.julialang.org/t/proposal-for-turingregressions-jl-bayesian-regression-model-alternative-to-turingglm-jl/138815), which includes brms-style export, changes to and re-import of model code, if it’s of interest?
