Skip to content

Commit

Permalink
Mypy and CPU workflows (Lightning-AI#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
carmocca authored Mar 27, 2023
1 parent 17d7f7e commit e14a4e8
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 32 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/cpu-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CPU tests

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

defaults:
run:
shell: bash

jobs:
cpu-tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {os: "macOS-11", python-version: "3.10", pytorch-version: "2.0"}
- {os: "ubuntu-20.04", python-version: "3.10", pytorch-version: "2.0"}
- {os: "windows-2022", python-version: "3.10", pytorch-version: "2.0"}
timeout-minutes: 5

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install pytest -r requirements.txt
pip list
- name: Run tests
run: |
pytest -v --durations=10
39 changes: 39 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Mypy check

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

defaults:
run:
shell: bash

jobs:
mypy-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10.6'

- name: Mypy cache
uses: actions/cache@v3
with:
path: .mypy_cache
key: mypy-${{ hashFiles('requirements.txt') }}

- name: Install dependencies
run: |
pip install mypy -r requirements.txt
pip list
- name: Check typing
run: mypy --install-types
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
__pycache__
.idea
.DS_Store
.mypy_cache
*.egg-info

# data
Expand Down
63 changes: 31 additions & 32 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,37 +43,36 @@ exclude = [
ignore-init-module-imports = true


#[tool.mypy]
#files = [
# "quantization",
# "scripts",
# "*.py",
#]
#install_types = "True"
#non_interactive = "True"
#disallow_untyped_defs = "True"
#ignore_missing_imports = "True"
#show_error_codes = "True"
#warn_redundant_casts = "True"
#warn_unused_configs = "True"
#warn_unused_ignores = "True"
#allow_redefinition = "True"
## style choices
#warn_no_return = "False"
[tool.mypy]
files = [
"quantization",
"scripts",
"*.py",
]
install_types = "True"
non_interactive = "True"
disallow_untyped_defs = "True"
ignore_missing_imports = "True"
show_error_codes = "True"
warn_redundant_casts = "True"
warn_unused_configs = "True"
warn_unused_ignores = "True"
allow_redefinition = "True"
# style choices
warn_no_return = "False"


#[tool.pytest.ini_options]
#norecursedirs = [
# ".git",
# ".github",
#]
#addopts = [
# "--strict-markers",
# "--doctest-modules",
# "--color=yes",
# "--disable-pytest-warnings",
#]
#filterwarnings = [
# "error::FutureWarning",
#]
#junit_duration_report = "call"
[tool.pytest.ini_options]
norecursedirs = [
".git",
".github",
]
addopts = [
"--strict-markers",
"--doctest-modules",
"--color=yes",
"--disable-pytest-warnings",
]
filterwarnings = [
"error::FutureWarning",
]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ sentencepiece
tqdm # convert_checkpoint.py
numpy # train.py dataset memmap
jsonargparse # generate.py, convert_checkpoint.py CLI
bitsandbytes # quantization/bnb.py
Empty file added scripts/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions tests/test_basic_functionality.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_basic_functionality():
assert 1 + 2 == 3

0 comments on commit e14a4e8

Please sign in to comment.