-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kye
committed
Jul 24, 2023
1 parent
885e169
commit 0b38b93
Showing
13 changed files
with
696 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: "\U0001F41B Bug report" | ||
about: Submit a bug report to improve our library! | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
<!-- Please check for related issues (both open and closed) before filing this issue. --> | ||
|
||
## Environment | ||
<!-- Please copy paste the output of running `composer_collect_env` below--> | ||
<!-- | ||
If you can't install composer for some reason, you can also use the PyTorch collect env script | ||
wget https://raw.githubusercontent.com/pytorch/pytorch/main/torch/utils/collect_env.py | ||
# For security purposes, please check the contents of collect_env.py before running it. | ||
python collect_env.py | ||
--> | ||
|
||
## To reproduce | ||
|
||
Steps to reproduce the behavior: | ||
|
||
1. | ||
2. | ||
3. | ||
|
||
## Expected behavior | ||
|
||
<!-- A clear and concise description of what you would expect to happen. --> | ||
|
||
## Additional context | ||
|
||
<!-- Please provide any additional context. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
name: "\U0001F680 Feature request" | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: enhancement | ||
assignees: '' | ||
|
||
--- | ||
|
||
<!-- Please check for related feature requests (both open and closed) before filing this request. --> | ||
|
||
## 🚀 Feature Request | ||
<!-- A clear and concise description of the feature proposal --> | ||
|
||
## Motivation | ||
|
||
<!-- Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too --> | ||
|
||
## [Optional] Implementation | ||
|
||
<!-- Optionally, sketch out an implementation or interface needed. --> | ||
|
||
## Additional context | ||
|
||
<!-- Add any other context or screenshots about the feature request here. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
name: "\U00002753 Model-related question" | ||
about: Ask a question about using our released models | ||
title: '' | ||
labels: question | ||
assignees: '' | ||
|
||
--- | ||
|
||
<!-- Please check for related question (both open and closed) before filing this question. --> | ||
|
||
## ❓ Question | ||
<!-- A clear and concise description of the question --> | ||
|
||
## Additional context | ||
|
||
<!-- Add any other context or screenshots about the feature request here. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
# Copyright 2022 MosaicML LLM Foundry authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
"""Run pytest using MCP.""" | ||
|
||
import argparse | ||
import time | ||
|
||
from mcli.sdk import (RunConfig, RunStatus, create_run, follow_run_logs, | ||
stop_run, wait_for_run_status) | ||
|
||
if __name__ == '__main__': | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--name', | ||
type=str, | ||
default='mcp-pytest', | ||
help='Base name of run') | ||
parser.add_argument('--cluster', | ||
type=str, | ||
default='r1z4', | ||
help='Cluster to use') | ||
parser.add_argument('--gpu_type', | ||
type=str, | ||
default='a100_40gb', | ||
help='Type of GPU to use') | ||
parser.add_argument('--gpu_num', | ||
type=int, | ||
default=2, | ||
help='Number of the GPU to use') | ||
parser.add_argument('--image', | ||
type=str, | ||
default='mosaicml/pytorch:latest', | ||
help='Docker image to use') | ||
parser.add_argument('--git_branch', | ||
type=str, | ||
help='Git branch to check out') | ||
parser.add_argument( | ||
'--git_commit', | ||
type=str, | ||
help='Git commit to check out. Overrides git_branch if specified') | ||
parser.add_argument( | ||
'--pr_number', | ||
type=int, | ||
help= | ||
'PR number to check out. Overrides git_branch/git_commit if specified') | ||
parser.add_argument('--pytest_markers', | ||
type=str, | ||
help='Markers to pass to pytest') | ||
parser.add_argument('--pytest_command', | ||
type=str, | ||
help='Command to run pytest') | ||
parser.add_argument('--timeout', | ||
type=int, | ||
default=1800, | ||
help='Timeout for run (in seconds)') | ||
args = parser.parse_args() | ||
|
||
name = args.name | ||
git_integration = { | ||
'integration_type': 'git_repo', | ||
'git_repo': 'mosaicml/llm-foundry', | ||
'ssh_clone': 'False', | ||
} | ||
if args.git_branch is not None and args.git_commit is None: | ||
name += f'-branch-{args.git_branch}' | ||
git_integration['git_branch'] = args.git_branch | ||
if args.git_commit is not None: | ||
name += f'-commit-{args.git_commit}' | ||
git_integration['git_commit'] = args.git_commit | ||
|
||
command = 'cd llm-foundry' | ||
|
||
# Checkout a specific PR if specified | ||
if args.pr_number is not None: | ||
name += f'-pr-{args.pr_number}' | ||
command += f''' | ||
git fetch origin pull/{args.pr_number}/head:pr_branch | ||
git checkout pr_branch | ||
''' | ||
|
||
# Shorten name if too long | ||
if len(name) > 56: | ||
name = name[:56] | ||
|
||
command += f''' | ||
pip install --upgrade --user .[all] | ||
export COMMON_ARGS="-v --durations=20 -m '{args.pytest_markers}'" | ||
make test PYTEST='{args.pytest_command}' EXTRA_ARGS="$COMMON_ARGS --codeblocks" | ||
make test-dist PYTEST='{args.pytest_command}' EXTRA_ARGS="$COMMON_ARGS" WORLD_SIZE=2 | ||
python -m coverage combine | ||
python -m coverage report | ||
''' | ||
|
||
config = RunConfig( | ||
name=name, | ||
cluster=args.cluster, | ||
gpu_type=args.gpu_type, | ||
gpu_num=args.gpu_num, | ||
image=args.image, | ||
integrations=[git_integration], | ||
command=command, | ||
) | ||
|
||
# Create run | ||
run = create_run(config) | ||
print(f'[GHA] Run created: {run.name}') | ||
|
||
# Wait until run starts before fetching logs | ||
run = wait_for_run_status(run, status='running') | ||
start_time = time.time() | ||
print('[GHA] Run started. Following logs...') | ||
|
||
# Print logs | ||
for line in follow_run_logs(run): | ||
print(line, end='') | ||
# Check if args.timeout seconds have elapsed | ||
if time.time() - start_time > args.timeout: | ||
print( | ||
f'[GHA] Run timed out and did not complete in {args.timeout/60} minutes.' | ||
) | ||
run = stop_run(run) | ||
print('[GHA] Run stopped.') | ||
break | ||
|
||
print('[GHA] Run completed. Waiting for run to finish...') | ||
run = wait_for_run_status(run, status='completed') | ||
|
||
# Fail if command exited with non-zero exit code or timed out | ||
assert run.status == RunStatus.COMPLETED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Code Quality Checks | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
pull_request: | ||
branches: | ||
- main | ||
- release/** | ||
workflow_call: | ||
workflow_dispatch: | ||
# Cancel old runs when a new commit is pushed to the same branch if not on main or dev | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
defaults: | ||
run: | ||
working-directory: . | ||
jobs: | ||
code-quality: | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 10 | ||
strategy: | ||
matrix: | ||
python_version: | ||
- '3.8' | ||
- '3.9' | ||
- '3.10' | ||
pip_deps: | ||
- '[dev]' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
- name: Setup | ||
run: | | ||
set -ex | ||
python -m pip install --upgrade 'pip<23' wheel | ||
python -m pip install --upgrade .${{ matrix.pip_deps }} | ||
- name: Run checks | ||
run: | | ||
pre-commit run --all-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: 'CodeQL' | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [main] | ||
schedule: | ||
- cron: '0 9 * * 1' # Every Monday at 09:00 (9:00 AM) | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: ['python'] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] | ||
# Learn more about CodeQL language support at https://git.io/codeql-language-support | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
# and modify them (or add more) to build your code if your project | ||
# uses a compiled language | ||
|
||
# - run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: PyTest Coverage | ||
on: | ||
workflow_call: | ||
inputs: | ||
download-path: | ||
required: true | ||
type: string | ||
jobs: | ||
coverage: | ||
timeout-minutes: 5 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
run: | | ||
set -ex | ||
python -m pip install --upgrade 'pip<23' wheel | ||
pip install coverage[toml]==6.5.0 | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: ${{ inputs.download-path }} | ||
- name: Generate coverage report | ||
run: | | ||
set -ex | ||
# Flatten the coverage files | ||
ls ${{ inputs.download-path }} | while read x; do mv ${{ inputs.download-path }}/$x/.coverage .coverage.$x; done | ||
python -m coverage combine | ||
python -m coverage report |
Oops, something went wrong.