Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Documentation Structure #327

Merged
merged 26 commits into from
Nov 19, 2022
Merged

New Documentation Structure #327

merged 26 commits into from
Nov 19, 2022

Conversation

cgbotta
Copy link
Contributor

@cgbotta cgbotta commented Oct 18, 2022

As discussed with @yebai, we are porting all the md files in the "Using Turing" section of the public-facing site to jmd. This entails porting everything from https://github.com/TuringLang/Turing.jl/tree/master/docs/src/using-turing to TuringTutorials/docs. We are going to mimic the structure of the TuringTutorials/tutorials directory.

I began this process by adding a source_folder argument to the weave functions so that they can be used for weaving both tutorials and the new documentation (docs) folder. I also ported the first lesson.

Open questions I have are:

  • I have not opened any PRs for the Turing.jl repo - what changes need to be made on that end to recognize and render the new documentation structure on the site?
  • I will also update the README instructions for weaving once this pattern is finalized

@yebai yebai added the buildkite Run tutorial(s) on buildkite (only affects PRs from forks) label Oct 19, 2022
@yebai
Copy link
Member

yebai commented Oct 19, 2022

@devmotion how do we add a new folder (e.g. TuringTutorials/docs/) to the build workflow?

@@ -0,0 +1,78 @@
---
title: Getting Started
permalink: /:collection/:name/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would these fields of permalink and redirect_from still work with jmd?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this structure from all the files in TuringTutorials/tutorials, but I am assuming this is read by the build process. Perhaps @devmotion could also advise here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not relevant for weaving at all IIRC, it's just copied to the Markdown output (e.g., https://github.com/TuringLang/TuringTutorialsOutput/blob/main/markdown/00-introduction/00_introduction.md). This is just used by the Jekyll setup in turing.ml AFAIK.

src/TuringTutorials.jl Outdated Show resolved Hide resolved
@yebai
Copy link
Member

yebai commented Oct 19, 2022

Thanks @cgbotta it looks good overall. I think some additional work is needed to fix the weave workflow. By default, if we call weave it should process all jmd files inside docs and tutorials.

@devmotion
Copy link
Member

@devmotion how do we add a new folder (e.g. TuringTutorials/docs/) to the build workflow?

To the buildkite CI? One has to change the configuration in https://github.com/TuringLang/TuringTutorials/tree/master/.buildkite, the structure in https://github.com/TuringLang/TuringTutorialsOutput/ (everything has to be moved to subfolders /docs/ and /tutorials/ I assume), and therefore also the integration in https://github.com/TuringLang/turing.ml.

I wonder if it would be simpler, and docs and tutorials more cleanly separated, if one would use a separate repo instead of multiple subfolders. Or if one should just move everything into /docs (or /tutorials, whatever seems more reasonable).

@yebai
Copy link
Member

yebai commented Oct 19, 2022

Or if one should just move everything into /docs (or /tutorials, whatever seems more reasonable)

I also think it is simpler to setup and maintain to have both docs and tutorials under one new folder (e.g. docs). We can distinguish between them by setting up the navigation bar.

@cgbotta
Copy link
Contributor Author

cgbotta commented Oct 19, 2022

Thank you both for the input - I agree with one main docs folder

Is there a preference for me to port all of the md docs to jmd in this PR, or a separate PR for each one?

@yebai
Copy link
Member

yebai commented Oct 19, 2022

Is there a preference for me to port all of the md docs to jmd in this PR, or a separate PR for each one?

Let's setup the workflow first. We can have a few more additional PRs to transfer all other doc md files.

@devmotion
Copy link
Member

I think it would be good to change the structure (ie move tutorials to docs) first before adding any new pages (ie even without the one in this PR), since that also requires downstream changes.

@cgbotta
Copy link
Contributor Author

cgbotta commented Oct 20, 2022

After looking through the build process, there is a fair bit of refactoring involved across many files to change the name of the folder from tutorials to docs. Of course, I am more than happy to do that if we decide it is best. However, I wanted to discuss the changes I made in the latest commit because it seems like a simpler solution.

By leaving the folder named tutorials, I could just append "tutorial-" to the existing files, then the documentation files can begin with "docs-".

All that should be needed after this is to update the navigation bar. We could test it by only changing the first item https://turing.ml/v0.21/docs/using-turing/get-started

@devmotion
Copy link
Member

If we keep the /tutorials folder, couldn't we just not rename the existing tutorials? tutorials/tutorials-00-... seems a bit unnecessarily complicated.

@cgbotta
Copy link
Contributor Author

cgbotta commented Oct 20, 2022

Good point - I am all for simplicity here 👍 Perhaps tutorials/docs-00-... is still worthwhile, but I agree that writing tutorials again is not necessary. Or if it really doesn't matter, I will just keep incrementing and start with tutorials/15-getting-started and not worry about distinguishing between old and new anywhere other than the nav bar

@yebai
Copy link
Member

yebai commented Oct 20, 2022

Perhaps tutorials/docs-00-... is still worthwhile

That sounds like a good tradeoff between minimal disruptions and being descriptive for now. Let us be incremental here, we can rename the tutorials to reflect a new naming scheme when things settle down a bit.

@devmotion
Copy link
Member

Buildkite reports an error:

Unable to find project for tutorials/docs-00-getting-started/00_getting-started.jmd

Could you add Project.toml and Manifest.toml (with Julia 1.6) and add the folder to the CompatHelper Github action?

@yebai
Copy link
Member

yebai commented Oct 26, 2022

@cgbotta
Copy link
Contributor Author

cgbotta commented Oct 26, 2022

@cgbotta it seems the build is broken. https://buildkite.com/julialang/turingtutorials/builds/185#018414e3-f154-4902-a5b3-f01bacda6dd8

I was just having a look at that. I see this:

/etc/buildkite-agent/plugins/github-com-staticfloat-coppermind-buildkite-plugin/lib/common.sh:
 line 11: /etc/buildkite-agent/plugins/github-com-staticfloat-coppermind-buildkite-plugin/lib/bash-tools/lib/buildkite.sh: No such file or directory

Not quite sure what that is implying is wrong, but I am digging through some of the build kite pipelines. Could it be an issue with the commit a week ago that added coppermind v1?

@yebai
Copy link
Member

yebai commented Oct 26, 2022

I think that's correct. Updating this PR with changes from the master branch seems to fix it.

@yebai
Copy link
Member

yebai commented Nov 13, 2022

@cgbotta Thanks for the updates. Let's replace the moment-matched Normal approximation to the posterior with a KDE estimation -- see the density function from MCMCChains.

@cgbotta
Copy link
Contributor Author

cgbotta commented Nov 16, 2022

@cgbotta cgbotta closed this Nov 16, 2022
@cgbotta cgbotta reopened this Nov 16, 2022
@cgbotta
Copy link
Contributor Author

cgbotta commented Nov 16, 2022

@cgbotta Thanks for the updates. Let's replace the moment-matched Normal approximation to the posterior with a KDE estimation -- see the density function from MCMCChains.

Thanks Hong - forgive me if this is obvious, but that be show anything different from the posterior densities given when running plot(chn) a bit earlier in the tutorial?

@yebai
Copy link
Member

yebai commented Nov 16, 2022

Thanks Hong - forgive me if this is obvious, but that be show anything different from the posterior densities given when running plot(chn) a bit earlier in the tutorial?

I think plot will show multiple things, including the density plot. So, yes, the plot function is the same. But, notice that the samples from the analytical posterior are exact -- we know how to sample from a Normal-Inverse-Gamma distribution in closed form. So we are using the KDE desity plot to compare the exact samples against MCMC samples. If the MCMC samples converge well, they should match the exact samples. Does that answer your question? If not, we can chat a bit more when we meet.

@yebai yebai merged commit caf900b into TuringLang:master Nov 19, 2022
@yebai
Copy link
Member

yebai commented Nov 19, 2022

Thanks, @cgbotta!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buildkite Run tutorial(s) on buildkite (only affects PRs from forks)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants