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

Adding a cargo book #252

Merged
merged 4 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/book-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy Rust book
on:
# TODO put this back only when merging after this PR lands.
pull_request:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pull-requests: write # To create a PR from that branch
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install latest mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Deploy GitHub Pages
run: |
# This assumes your book is in the root of your repository.
# Just add a `cd` here if you need to change to another directory.
cd candle-book
mdbook build
git worktree add gh-pages
git config user.name "Deploy from CI"
git config user.email ""
cd gh-pages
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/gh-pages
rm -rf *
mv ../book/* .
git add .
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force --set-upstream origin gh-pages
29 changes: 29 additions & 0 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI
on:
pull_request:

jobs:
test:
name: Test candle-book
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pull-requests: write # To create a PR from that branch
steps:
- uses: actions/checkout@master
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install stable
rustup default stable
- name: Install latest mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir bin
curl -sSL $url | tar -xz --directory=bin
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Run tests
run: cd candle-book && mdbook test


1 change: 1 addition & 0 deletions candle-book/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
6 changes: 6 additions & 0 deletions candle-book/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[book]
authors = ["Nicolas Patry"]
language = "en"
multilingual = false
src = "src"
title = "Candle Documentation"
1 change: 1 addition & 0 deletions candle-book/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Introduction
26 changes: 26 additions & 0 deletions candle-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Summary

[Introduction](README.md)

# User Guide

- [Installation](guide/installation.md)
- [Hello World - MNIST](guide/hello_world.md)
- [PyTorch cheatsheet](guide/hello_world.md)

# Reference Guide

- [Running a model](inference/README.md)
- [Serialization](inference/serialization.md)
- [Using the hub](inference/hub.md)
- [Advanced Cuda usage](inference/cuda/README.md)
- [Writing a custom kernel](inference/cuda/writing.md)
- [Porting a custom kernel](inference/cuda/porting.md)
- [Error management](error_manage.md)
- [Creating apps](apps/README.md)
- [Creating a WASM app](apps/wasm.md)
- [Creating a REST api webserver](apps/rest.md)
- [Creating a desktop Tauri app](apps/dekstop.md)
- [Training](training/README.md)
- [MNIST](training/mnist.md)
- [Fine-tuning](training/finetuning.md)
1 change: 1 addition & 0 deletions candle-book/src/apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Creating apps
1 change: 1 addition & 0 deletions candle-book/src/apps/dekstop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Creating a desktop Tauri app
1 change: 1 addition & 0 deletions candle-book/src/apps/rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Creating a REST api webserver
1 change: 1 addition & 0 deletions candle-book/src/apps/wasm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Creating a WASM app
1 change: 1 addition & 0 deletions candle-book/src/chapter_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Chapter 1
1 change: 1 addition & 0 deletions candle-book/src/error_manage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Error management
1 change: 1 addition & 0 deletions candle-book/src/guide/hello_world.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# PyTorch cheatsheet
1 change: 1 addition & 0 deletions candle-book/src/guide/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Installation
1 change: 1 addition & 0 deletions candle-book/src/inference/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Running a model
1 change: 1 addition & 0 deletions candle-book/src/inference/cuda/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Advanced Cuda usage
1 change: 1 addition & 0 deletions candle-book/src/inference/cuda/porting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Porting a custom kernel
1 change: 1 addition & 0 deletions candle-book/src/inference/cuda/writing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Writing a custom kernel
1 change: 1 addition & 0 deletions candle-book/src/inference/hub.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Using the hub
1 change: 1 addition & 0 deletions candle-book/src/inference/serialization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Serialization
1 change: 1 addition & 0 deletions candle-book/src/training/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Training
1 change: 1 addition & 0 deletions candle-book/src/training/finetuning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Fine-tuning
1 change: 1 addition & 0 deletions candle-book/src/training/mnist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# MNIST
Loading