Skip to content

Commit

Permalink
Merge branch 'flax-backend-normalclasses' of github.com:JaxGaussianPr…
Browse files Browse the repository at this point in the history
…ocesses/GPJax into flax-backend-normalclasses
  • Loading branch information
thomaspinder committed Aug 16, 2024
2 parents cc62521 + ab86ac5 commit 20953c6
Show file tree
Hide file tree
Showing 27 changed files with 595 additions and 294 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,11 @@ jobs:
virtualenvs-in-project: false
installer-parallel: true

- name: Install LaTex
run: |
sudo apt-get update
sudo apt-get install texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra dvipng cm-super
- name: Build the documentation with MKDocs
run: |
poetry install --all-extras --with docs
conda install pandoc
poetry run mkdocs build
poetry run python docs/scripts/gen_examples.py --execute && poetry run mkdocs build
- name: Deploy Page 🚀
uses: JamesIves/github-pages-deploy-action@v4.4.1
Expand Down
16 changes: 1 addition & 15 deletions .github/workflows/test_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,6 @@ jobs:
auto-update-conda: true
python-version: ${{ matrix.python-version }}

# Install katex for math support
- name: Install NPM
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install KaTeX
run: |
npm install katex
- name: Install LaTex
run: |
sudo apt-get update
sudo apt-get install texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra dvipng cm-super
# Install Poetry and build the documentation
- name: Install and configure Poetry
uses: snok/install-poetry@v1
Expand All @@ -60,4 +46,4 @@ jobs:
run: |
poetry install --all-extras --with docs
conda install pandoc
poetry run python docs/scripts/gen_examples.py && poetry run mkdocs build
poetry run python docs/scripts/gen_examples.py --execute && poetry run mkdocs build
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ helped to shape GPJax into the package it is today.
## Notebook examples

> - [**Conjugate Inference**](https://docs.jaxgaussianprocesses.com/examples/regression/)
> - [**Classification with MCMC**](https://docs.jaxgaussianprocesses.com/examples/classification/)
> - [**Classification**](https://docs.jaxgaussianprocesses.com/examples/classification/)
> - [**Sparse Variational Inference**](https://docs.jaxgaussianprocesses.com/examples/collapsed_vi/)
> - [**Stochastic Variational Inference**](https://docs.jaxgaussianprocesses.com/examples/uncollapsed_vi/)
> - [**BlackJax Integration**](https://docs.jaxgaussianprocesses.com/examples/classification/#mcmc-inference)
> - [**Laplace Approximation**](https://docs.jaxgaussianprocesses.com/examples/classification/#laplace-approximation)
> - [**Inference on Non-Euclidean Spaces**](https://docs.jaxgaussianprocesses.com/examples/constructing_new_kernels/#custom-kernel)
> - [**Inference on Graphs**](https://docs.jaxgaussianprocesses.com/examples/graph_kernels/)
Expand Down
34 changes: 20 additions & 14 deletions docs/scripts/gen_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def process_file(file: Path, out_file: Path | None = None, execute: bool = False
f"| jupyter nbconvert --to markdown --execute --stdin --output {out_file}"
)
else:
command = f"jupytext --to markdown {file} --output {out_file}"
command += f"jupytext --to markdown {file} --output {out_file}"

subprocess.run(command, shell=True, check=False)

Expand Down Expand Up @@ -64,21 +64,26 @@ def main(args):
print(files)

# process files in parallel
with ThreadPoolExecutor(max_workers=args.max_workers) as executor:
futures = []
for file in files:
out_file = out_dir / f"{file.stem}.md"
futures.append(
executor.submit(
process_file, file, out_file=out_file, execute=args.execute
if args.parallel:
with ThreadPoolExecutor(max_workers=args.max_workers) as executor:
futures = []
for file in files:
out_file = out_dir / f"{file.stem}.md"
futures.append(
executor.submit(
process_file, file, out_file=out_file, execute=args.execute
)
)
)

for future in as_completed(futures):
try:
future.result()
except Exception as e:
print(f"Error processing file: {e}")
for future in as_completed(futures):
try:
future.result()
except Exception as e:
print(f"Error processing file: {e}")
else:
for file in files:
out_file = out_dir / f"{file.stem}.md"
process_file(file, out_file=out_file, execute=args.execute)


if __name__ == "__main__":
Expand All @@ -91,6 +96,7 @@ def main(args):
parser.add_argument(
"--outdir", type=Path, default=project_root / "docs" / "_examples"
)
parser.add_argument("--parallel", type=bool, default=False)
args = parser.parse_args()

main(args)
Loading

0 comments on commit 20953c6

Please sign in to comment.