Skip to content

Commit

Permalink
Merge pull request #9 from Modalities/ci/setup
Browse files Browse the repository at this point in the history
CI/setup
  • Loading branch information
le1nux authored Jan 22, 2024
2 parents e113029 + 637364d commit ea2e2f9
Show file tree
Hide file tree
Showing 30 changed files with 784 additions and 30 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build_and_deploy_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Build Sphinx Documentation"

on:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install myst-parser
pip install .
pip install sphinx-rtd-theme sphinx-autodoc-typehints sphinx-click sphinx-automodapi texext
- name: "Parse into HTML"
run: |
sphinx-apidoc -o docs/source/api src/modalities
sphinx-build -M html docs/source/ docs/build/
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html
force_orphan: true



30 changes: 30 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Linting

on:
push:
branches:
- main
workflow_dispatch:
pull_request:
types: [review_requested, ready_for_review, auto_merge_enabled]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
pre-commit install
- name: Analysing the code with pre-commit
run: |
pre-commit run --all-files
30 changes: 30 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Tests

on:
push:
branches:
- main
workflow_dispatch:
pull_request:
types: [review_requested, ready_for_review, auto_merge_enabled]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[tests]
- name: Run tests
run: |
pytest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,5 @@ tags

checkpoints
data
docs/source/generated
docs/source/api
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "2"

build:
os: "ubuntu-22.04"
tools:
python: "3.10"

python:
install:
- requirements: docs/requirements.txt

sphinx:
configuration: docs/source/conf.py
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Modalities


# Getting started
For training and evaluation a model, feel free to checkout [this](https://github.com/Modalities/modalities/blob/main/examples/getting_started/getting_started_example.md) getting started tutorial, in which we train a small, 60M-parameter GPT model on a tiny subset of the Redpajama V2 dataset.
Also, see our WIki and API reference documentation: https://modalities.github.io/modalities/

# Installation

Expand All @@ -20,6 +22,7 @@ pip install -e .
If you want to contribute, have look at `CONTRIBUTING.md`.



# Usage
For running the training endpoint on multiple GPUs run `CUDA_VISIBLE_DEVICES=2,3 torchrun --nnodes 1 --nproc_per_node 2 --rdzv-endpoint=0.0.0.0:29502 src/modalities/__main__.py run --config_file_path config_files/config.yaml`.

Expand Down
4 changes: 2 additions & 2 deletions config_files/config_lorem_ipsum.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ modalities_setup:

wandb:
project_name: modalities
mode: ONLINE
mode: OFFLINE

data:
sample_key: "input_ids"
Expand Down Expand Up @@ -121,7 +121,7 @@ running_env:
config:
process_group_backend: ${training.process_group_backend}
local_rank: ${oc.env:LOCAL_RANK}
mixed_precision_settings: BF_16
mixed_precision_settings: FP_16
sharding_strategy: FULL_SHARD
auto_wrap_policy: TRANSFORMER_AUTO_WRAP_POLICY

Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx==7.1.2
sphinx-rtd-theme==1.3.0rc1
3 changes: 3 additions & 0 deletions docs/source/benchmarking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Benchmarking
=============================
**EDIT "docs/source/benchmarking.rst" IN ORDER TO MAKE CHANGES HERE**
Loading

0 comments on commit ea2e2f9

Please sign in to comment.