chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# Each line is a file pattern followed by one or more owners.
|
||||
|
||||
# These owners will be the default owners for everything in the repo. Unless a later match takes precedence,
|
||||
# @global-owner1 and @global-owner2 will be requested for review when someone opens a pull request.
|
||||
* @lianakoleva @k223kim @andyland @t-vi
|
||||
|
||||
# Core source
|
||||
/litgpt/ @lianakoleva @k223kim @andyland
|
||||
|
||||
# CI/CD and configs
|
||||
/.github/ @lianakoleva @k223kim
|
||||
*.yml @lianakoleva @k223kim
|
||||
|
||||
# Docs
|
||||
/README.md @williamfalcon @lianakoleva
|
||||
|
||||
# Retired committers
|
||||
# @lantiga (Luca Antiga)
|
||||
# @rasbt (Sebastian Raschka)
|
||||
# @awaelchli (Adrian Wälchli)
|
||||
# @borda (Jirka Borovec)
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
name: Ask a Question
|
||||
about: Ask and answer questions related to LitGPT
|
||||
title: ''
|
||||
labels: question
|
||||
|
||||
---
|
||||
|
||||
Please describe your question here.
|
||||
@@ -0,0 +1,56 @@
|
||||
name: Bug Report
|
||||
description: Report errors related to LitGPT
|
||||
title: "Description"
|
||||
labels: bug
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for taking the time to report an issue. Please fill out the details below to help us resolve it.
|
||||
|
||||
- type: textarea
|
||||
id: bug_description
|
||||
attributes:
|
||||
label: Bug description
|
||||
description: A description of the issue.
|
||||
placeholder: |
|
||||
Please provide a description of what the bug or issue is.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Reproduced in studio
|
||||
description: >
|
||||
Create a new Lightning Studio with code that reproduces the issue and share the link.
|
||||
Also include all the relevant files and data required to reproduce shared issue.
|
||||
In case the code does not crash, please add assert statements to show what is the real and expected output.
|
||||
A simple guide on how to create such a studio can be found [here](https://www.youtube.com/watch?v=YcW-2Zt_bFg&ab_channel=LightningAI).
|
||||
placeholder: https://lightning.ai/...
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: dropdown
|
||||
id: operating_system
|
||||
attributes:
|
||||
label: What operating system are you using?
|
||||
description: If applicable, please select the operating system where you experienced this issue.
|
||||
options:
|
||||
- "Unknown"
|
||||
- "macOS"
|
||||
- "Linux"
|
||||
- "Windows"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: version
|
||||
attributes:
|
||||
label: LitGPT Version
|
||||
description: |
|
||||
Please provide details about your LitGPT version by running the following code in your terminal:
|
||||
```
|
||||
pip show litgpt | grep Version:
|
||||
```
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
name: Suggest a Feature
|
||||
about: Propose a new feature or enhancement
|
||||
title: ''
|
||||
labels: enhancement
|
||||
|
||||
---
|
||||
|
||||
Please describe the feature or enhancement along with the intended usecase.
|
||||
@@ -0,0 +1,41 @@
|
||||
# Basic dependabot.yml file with
|
||||
# minimum configuration for two package managers
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
# Enable version updates for python
|
||||
- package-ecosystem: "pip"
|
||||
# Look for a `requirements` in the `root` directory
|
||||
directory: "/"
|
||||
# Check for updates once a week
|
||||
schedule:
|
||||
interval: "monthly"
|
||||
# Labels on pull requests for version updates only
|
||||
labels:
|
||||
- "dependencies"
|
||||
pull-request-branch-name:
|
||||
# Separate sections of the branch name with a hyphen
|
||||
# for example, `dependabot-npm_and_yarn-next_js-acorn-6.4.1`
|
||||
separator: "-"
|
||||
# Allow up to 5 open pull requests for pip dependencies
|
||||
open-pull-requests-limit: 3
|
||||
|
||||
# Enable version updates for GitHub Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
# Check for updates once a week
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
# Labels on pull requests for version updates only
|
||||
labels:
|
||||
- "CI / actions"
|
||||
pull-request-branch-name:
|
||||
# Separate sections of the branch name with a hyphen
|
||||
# for example, `dependabot-npm_and_yarn-next_js-acorn-6.4.1`
|
||||
separator: "-"
|
||||
# Allow up to 5 open pull requests for GitHub Actions
|
||||
open-pull-requests-limit: 1
|
||||
groups:
|
||||
GHA-updates:
|
||||
patterns:
|
||||
- "*"
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Check hyperlinks
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
activate-environment: true
|
||||
python-version: "3.10"
|
||||
enable-cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
# a newer version of mistune is incompatible with nbconvert
|
||||
# pytest>=9 removed the `path` arg from pytest_collect_file; pytest-check-links still uses it
|
||||
run: uv pip install "mistune<3.1" "pytest<9" pytest-check-links
|
||||
|
||||
- name: Check links
|
||||
run: pytest --check-links README.md tutorials --check-links-ignore "http*"
|
||||
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
@@ -0,0 +1,143 @@
|
||||
name: CPU tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
# Note: using `pull_request` (not `pull_request_target`) for security reasons.
|
||||
# This means PRs from external forks will NOT have access to secrets (e.g. HF_TOKEN)
|
||||
# and some tests may fail or be skipped on fork PRs until we find a better solution.
|
||||
pull_request:
|
||||
branches: [main]
|
||||
types: [opened, reopened, ready_for_review, labeled, synchronize]
|
||||
workflow_dispatch: {}
|
||||
|
||||
# lock down all permissions by default
|
||||
permissions:
|
||||
contents: read # needed to check out code
|
||||
checks: write # needed for test results
|
||||
pull-requests: read # needed for PR metadata
|
||||
actions: read # needed to use actions
|
||||
security-events: none
|
||||
statuses: write # needed to update commit status
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
|
||||
cancel-in-progress: ${{ startsWith(github.event_name, 'pull_request') }}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
env:
|
||||
HF_HOME: .cache-HF # Define HF_HOME for caching
|
||||
TRANSFORMERS_CACHE: .cache-HF/transformers
|
||||
DATASETS_CACHE: .cache-HF/datasets
|
||||
HF_DATASETS_CACHE: .cache-HF/datasets
|
||||
UV_TORCH_BACKEND: cpu
|
||||
|
||||
jobs:
|
||||
testing-imports:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ["ubuntu-22.04", "ubuntu-24.04", "macOS-14", "windows-2022"]
|
||||
python-version: ["3.10"]
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout generic
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
activate-environment: true
|
||||
python-version: ${{ matrix.python-version }}
|
||||
enable-cache: true
|
||||
|
||||
- name: Install minimal dependencies
|
||||
run: |
|
||||
uv sync --no-dev
|
||||
uv pip list
|
||||
|
||||
- name: Testing package imports
|
||||
# make sure all modules are still importable with only the minimal dependencies available
|
||||
run: |
|
||||
modules=$(
|
||||
find litgpt -type f -name "*.py" | \
|
||||
sed 's/\.py$//' | sed 's/\//./g' | \
|
||||
sed 's/.__init__//g' | xargs -I {} echo "import {};"
|
||||
)
|
||||
echo "$modules"
|
||||
python -c "$modules"
|
||||
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
|
||||
pytester:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ["ubuntu-22.04"]
|
||||
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
||||
requires: ["latest"]
|
||||
include:
|
||||
- { os: "ubuntu-22.04", python-version: "3.10", requires: "oldest" }
|
||||
- { os: "windows-2022", python-version: "3.10", requires: "latest" }
|
||||
- { os: "macOS-14", python-version: "3.10", requires: "latest" }
|
||||
timeout-minutes: 35
|
||||
steps:
|
||||
- name: Checkout generic
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
activate-environment: true
|
||||
python-version: ${{ matrix.python-version }}
|
||||
enable-cache: true
|
||||
|
||||
# Add caching for HF models and tokenizers
|
||||
- name: HF cache
|
||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: .cache-HF
|
||||
key: hf-cache_${{ runner.os }}-py${{ matrix.python-version }}
|
||||
restore-keys: |
|
||||
hf-cache_${{ runner.os }}-py${{ matrix.python-version }}
|
||||
hf-cache_${{ runner.os }}-
|
||||
hf-cache_
|
||||
|
||||
- name: Set min. dependencies
|
||||
if: matrix.requires == 'oldest'
|
||||
run: uv run --no-project --with 'lightning-utilities[cli]>=0.15.1' python -m lightning_utilities.cli requirements set-oldest --req_files=pyproject.toml
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
uv sync --all-extras
|
||||
uv pip list
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||
run: pytest -v litgpt/ tests/ --timeout=180 --durations=100
|
||||
|
||||
- name: Show cache
|
||||
run: uvx py-tree -d 1 .cache-HF
|
||||
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
|
||||
testing-guardian:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [pytester, testing-imports]
|
||||
if: github.event_name == 'pull_request'
|
||||
steps:
|
||||
- run: echo "${{ needs.pytester.result }}"
|
||||
- name: failing...
|
||||
if: needs.pytester.result == 'failure'
|
||||
run: exit 1
|
||||
- name: cancelled or skipped...
|
||||
if: contains(fromJSON('["cancelled", "skipped"]'), needs.pytester.result)
|
||||
timeout-minutes: 1
|
||||
run: sleep 90
|
||||
@@ -0,0 +1,38 @@
|
||||
name: Deploy MkDocs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
# Step 1: Checkout the repository
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
# Step 2: Install uv
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||
with:
|
||||
activate-environment: true
|
||||
python-version: "3.10"
|
||||
enable-cache: true
|
||||
|
||||
# Step 3: Install MkDocs and dependencies
|
||||
- run: uv pip install mkdocs mkdocs-material mkdocs-pagetree-plugin
|
||||
|
||||
# Step 4: Deploy to GitHub Pages
|
||||
- run: |
|
||||
mkdir -p gh-pages/docs
|
||||
cp -r tutorials/* gh-pages/docs
|
||||
cd gh-pages
|
||||
mv docs/mkdocs.yml mkdocs.yml
|
||||
echo "{{ pagetree }}" > docs/index.md
|
||||
mkdocs gh-deploy --force
|
||||
|
||||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
@@ -0,0 +1,78 @@
|
||||
# To create a release, create a tag and push it to GitHub:
|
||||
#git tag -a "v0.0.1-beta" -m "beta version testing"
|
||||
#git push --tags
|
||||
# https://dev.to/iamtekson/publish-package-to-pypi-and-release-new-version-using-github-actions-108k
|
||||
name: Publish LitGPT to PyPI
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build source and wheel distributions
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
with:
|
||||
python-version: "3.x"
|
||||
cache: "pip"
|
||||
|
||||
- name: Build source and wheel distributions
|
||||
run: |
|
||||
python -m pip install --upgrade build twine
|
||||
pip install importlib_metadata==7.2.1
|
||||
python -m build
|
||||
twine check --strict dist/*
|
||||
|
||||
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: pypi-packages-${{ github.sha }}
|
||||
path: dist
|
||||
|
||||
upload-release-assets:
|
||||
needs: build
|
||||
if: github.event_name == 'release'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
|
||||
steps:
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: pypi-packages-${{ github.sha }}
|
||||
path: dist
|
||||
|
||||
- run: ls -lh dist/
|
||||
|
||||
- name: Upload to release
|
||||
uses: AButler/upload-release-assets@34491005a5d7ec239a784e460807ce844fde7962 # v4.0.0
|
||||
with:
|
||||
files: "dist/*"
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
publish-pypi:
|
||||
needs: build
|
||||
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: pypi-packages-${{ github.sha }}
|
||||
path: dist
|
||||
|
||||
- run: ls -lh dist/
|
||||
|
||||
- name: Publish distribution to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
|
||||
Reference in New Issue
Block a user