Skip to content

Commit

Permalink
Implement versioning for docs website
Browse files Browse the repository at this point in the history
  • Loading branch information
Varun Dutta committed Aug 2, 2024
1 parent 77c635c commit ce8e338
Show file tree
Hide file tree
Showing 15 changed files with 919 additions and 104 deletions.
88 changes: 56 additions & 32 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Docs

on:
pull_request:
paths:
- "docs/mkdocs.yml"
# Publish docs weekly
schedule:
- cron: '0 9 * * 1'
- cron: '0 9 * * 1'
workflow_dispatch:
inputs:
version-number:
type: string
description: What is the new version number (ex. v0.28.0) for the website? If updating dev, leave this blank.
default: master
required: false

jobs:
documentation:
Expand All @@ -19,50 +20,73 @@ jobs:
with:
distribution: 'corretto'
java-version: 17

- name: Set up Python3
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install CN fonts
run: sudo apt-get update && sudo apt-get install fonts-arphic-uming
- name: install Python Dependencies
run: pip3 install nbconvert mkdocs==1.4.3 mkdocs-exclude mknotebooks mkdocs-material jupyter Pygments Markdown

- name: Install Python Dependencies
run: pip3 install nbconvert mkdocs==1.4.3 mkdocs-exclude mknotebooks mkdocs-material jupyter Pygments Markdown mike

- name: Cache IJava Kernel
id: ijava-cache
uses: actions/cache@v4
with:
path: ~/.local/share/jupyter/kernels/java
key: ${{ runner.os }}-ijava-kernel

- name: Install IJava kernel
if: steps.ijava-cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/frankfliu/IJava.git
cd IJava/
./gradlew installKernel
- name: checkout repo
- name: Checkout DJL Repo
uses: actions/checkout@v4
- name: add mybinder link
run: |
python3 tools/scripts/add_online_runner.py
- name: clone demos
run: |
cd docs
git clone https://github.com/deepjavalibrary/djl-demo.git demos
- name: clone serving
run: |
cd docs
git clone https://github.com/deepjavalibrary/djl-serving.git serving
with:
ref: ${{ github.event.version-number }}

- name: Checkout DJL-Serving
uses: actions/checkout@v4
with:
repository: 'deepjavalibrary/djl-serving'
ref: ${{ github.event.inputs.version-number }}
path: docs/serving

- name: Checkout DJL-Demo
uses: actions/checkout@v4
with:
repository: 'deepjavalibrary/djl-demo'
ref: ${{ github.event.inputs.version-number }}
path: docs/demos

- name: run Notebooks
run: |
cd docs/demos/jupyter
bash test_notebook.sh
- name: build docs
run: |
cd docs
export DJL_DISABLE_PROGRESS_BAR=true
mkdocs build --site-dir ../../site
- name: Configure AWS Credentials
if: github.event_name != 'pull_request'
working-directory: docs/demos/jupyter
env:
DJL_DISABLE_PROGRESS_BAR: true
run: bash test_notebook.sh

- name: Build docs website
run: tools/scripts/build-website.sh "${{ github.event.inputs.version-number || 'master' }}"

- name: Configure Deployment AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: Copy files to S3 with the AWS CLI
if: github.event_name != 'pull_request'
env:
DJL_VERSION: ${{ github.event.inputs.pt_version || 'master' }}
run: |
aws s3 sync ../site s3://djl-ai/documentation/nightly --delete
aws s3 sync $DJL_VERSION s3://djl-ai/documentation/nightly/$DJL_VERSION --delete
aws s3 cp versions.json s3://djl-ai/documentation/nightly/versions.json
aws cloudfront create-invalidation --distribution-id E733IIDCG0G5U --paths "/*"
2 changes: 2 additions & 0 deletions .github/workflows/native_jni_s3_pytorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
export CUDA_VERSION=${CUDA_VERSION:-cu124}
./gradlew :engines:pytorch:pytorch-native:compileJNI -Pcuda=$CUDA_VERSION -Ppt_version=$PYTORCH_VERSION
./gradlew :engines:pytorch:pytorch-native:cleanJNI
./gradlew :engines:pytorch:pytorch-native:compileJNI -Pprecxx11 -Pcuda=$CUDA_VERSION -Ppt_version=$PYTORCH_VERSION
./gradlew :engines:pytorch:pytorch-native:cleanJNI
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/nightly_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ jobs:
# ./gradlew :integration:test "-Dai.djl.default_engine=OnnxRuntime"
# ./gradlew :integration:clean
test-cuda-121:
test-cuda-124:
if: github.repository == 'deepjavalibrary/djl'
runs-on: [ self-hosted, gpu ]
container:
image: nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
image: nvidia/cuda:12.4.1-devel-ubuntu22.04
options: --gpus all --runtime=nvidia
timeout-minutes: 30
needs: create-runners
Expand Down Expand Up @@ -151,12 +151,14 @@ jobs:
./gradlew :integration:clean :integration:test -Dai.djl.default_engine=TensorFlow
./gradlew :engines:pytorch:pytorch-model-zoo:test
./gradlew :engines:tensorflow:tensorflow-model-zoo:test
# manually install cudnn9, PyTorch doesn't work with cudnn9, but OnnxRuntime requires cudnn9
apt-get update && apt-get install -y --no-install-recommends libcudnn9-cuda-12
./gradlew :engines:onnxruntime:onnxruntime-engine:test
publish:
if: github.repository == 'deepjavalibrary/djl'
runs-on: ubuntu-latest
needs: [ build, test-pytorch, test-tensorflow, test-aarch64, test-cuda-121 ]
needs: [ build, test-pytorch, test-tensorflow, test-aarch64, test-cuda-124 ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
Expand All @@ -176,8 +178,8 @@ jobs:
run: |
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=1.13.1 -Psnapshot
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=2.1.2 -Psnapshot
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=2.2.2 -Psnapshot
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=2.3.1 -Psnapshot
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=2.4.0 -Psnapshot
./gradlew clean engines:ml:xgboost:publish -Pgpu -Psnapshot
./gradlew clean publish -Psnapshot
cd bom
Expand All @@ -192,8 +194,8 @@ jobs:
run: |
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=1.13.1 -P${{ github.event.inputs.mode }}
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=2.1.2 -P${{ github.event.inputs.mode }}
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=2.2.2 -P${{ github.event.inputs.mode }}
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=2.3.1 -P${{ github.event.inputs.mode }}
./gradlew clean engines:pytorch:pytorch-jni:publish -Ppt_version=2.4.0 -P${{ github.event.inputs.mode }}
./gradlew clean engines:ml:xgboost:publish -Pgpu -P${{ github.event.inputs.mode }}
./gradlew clean publish -P${{ github.event.inputs.mode }}
cd bom
Expand Down Expand Up @@ -239,7 +241,7 @@ jobs:
stop-runners:
if: ${{ github.repository == 'deepjavalibrary/djl' && always() }}
runs-on: [ self-hosted, scheduler ]
needs: [ create-runners, test-aarch64, test-cuda-121 ]
needs: [ create-runners, test-aarch64, test-cuda-124 ]
steps:
- name: Stop all instances
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public SimpleTokenizer(String delimiter) {
this.delimiter = delimiter;
}

/** Creates an instance of {@code SimpleTokenizer} with the default delimiter. */
/** Creates an instance of {@code SimpleTokenizer} with the default delimiter (" "). */
public SimpleTokenizer() {}

/** {@inheritDoc} */
@Override
public List<String> tokenize(String sentence) {
return Arrays.asList(sentence.split(" "));
return Arrays.asList(sentence.split(delimiter));
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/** A {@link Translator} that can handle generic cross encoder {@link Input} and {@link Output}. */
public class CrossEncoderServingTranslator implements NoBatchifyTranslator<Input, Output> {

private static final Type LIST_TYPE = new TypeToken<List<String>>() {}.getType();
private static final Type LIST_TYPE = new TypeToken<List<StringPair>>() {}.getType();

private Translator<StringPair, float[]> translator;

Expand Down
31 changes: 18 additions & 13 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ theme:
features:
- navigation.tabs
palette:
- scheme: default
primary: light-blue
accent: light-blue
toggle:
icon: material/weather-sunny
name: Switch to dark mode
- scheme: slate
primary: black
accent: deep-orange
toggle:
icon: material/weather-night
name: Switch to light mode
- scheme: default
primary: light-blue
accent: light-blue
toggle:
icon: material/weather-sunny
name: Switch to dark mode
- scheme: slate
primary: black
accent: deep-orange
toggle:
icon: material/weather-night
name: Switch to light mode
edit_uri: ''

extra:
version:
provider: mike
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/deepjavalibrary/djl
Expand All @@ -43,12 +45,14 @@ extra:
provider: google
property: G-JE0V807433
docs_dir: '../'
site_dir: '../../site'
plugins:
- search
- mknotebooks
- mike
- exclude:
regex:
- '.*\.(symbol|params|pt|jar|gz|zip|txt|json|sh|bat|cmd|puml|g4|java|py|cc|h|pro|properties|xml|gradlew|gradle|Dockerfile|RepositoryFactory|EngineProvider|ZooProvider)$|(docker|integration|testing|tools|docs/demos/apache-spark/notebook)/.*$'
- '.*\.(symbol|params|pt|jar|gz|zip|txt|json|sh|bat|cmd|puml|g4|java|py|cc|h|pro|properties|xml|html|scala|sbt|kt|npy|npz|onnx|rs|rst|safetensors|tar|toml|trt|vue|scss|yml|yaml|Dockerfile|cmake|RepositoryFactory|EngineProvider|ZooProvider)$|LICENSE|NOTICE|.*gradle.*|.*/mvnw|.*/Dockerfile.*|.*(hdpi|\.git|\.mvn|docker|buildSrc|gradle|integration|testing|jacoco|tools|javadoc|META-INF|/webapp|apache-spark/notebook|visualization-vue|malicious-url-detector/docs|frontend|interactive-console)/.*'


nav:
Expand Down Expand Up @@ -175,6 +179,7 @@ nav:
- 'docs/serving/serving/docs/lmi/user_guides/lmi_input_output_schema.md'
- 'docs/serving/serving/docs/lmi/user_guides/chat_input_output_schema.md'
- 'docs/serving/serving/docs/lmi/user_guides/output_formatter_schema.md'
- 'docs/serving/serving/docs/lmi/user_guides/input_formatter_schema.md'
- Deployment Guides:
- 'docs/serving/serving/docs/lmi/deployment_guide/README.md'
- 'docs/serving/serving/docs/lmi/deployment_guide/model-artifacts.md'
Expand Down
2 changes: 2 additions & 0 deletions engines/pytorch/pytorch-jni/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ tasks {
) + when {
ptVersion.startsWith("2.4.") -> listOf(
"linux-x86_64/cu124/libdjl_torch.so",
"linux-x86_64/cu124-precxx11/libdjl_torch.so",
"win-x86_64/cu124/djl_torch.dll"
)

ptVersion.matches(Regex("2.[1-3].\\d")) -> listOf(
"linux-x86_64/cu121/libdjl_torch.so",
"linux-x86_64/cu121-precxx11/libdjl_torch.so",
"win-x86_64/cu121/djl_torch.dll",
)

Expand Down
1 change: 1 addition & 0 deletions extensions/tokenizers/rust/src/layers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod linear;
#[allow(dead_code, unused)]
mod rms_norm;

#[allow(unused_imports)]
pub use cublaslt::get_cublas_lt_wrapper;
pub use layer_norm::LayerNorm;
pub use linear::{HiddenAct, Linear};
Expand Down
Loading

0 comments on commit ce8e338

Please sign in to comment.