Skip to content

Commit

Permalink
initial code update;
Browse files Browse the repository at this point in the history
Signed-off-by: junsongc <[email protected]>
  • Loading branch information
lawrence-cj committed Nov 21, 2024
1 parent b233426 commit 80976a9
Show file tree
Hide file tree
Showing 109 changed files with 46,540 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/bot-autolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Auto Lint (triggered by "auto lint" label)
on:
pull_request:
types:
- opened
- edited
- closed
- reopened
- synchronize
- labeled
- unlabeled
# run only one unit test for a branch / tag.
concurrency:
group: ci-lint-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-by-label:
if: contains(github.event.pull_request.labels.*.name, 'lint wanted')
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Test pre-commit hooks
continue-on-error: true
uses: pre-commit/[email protected] # sync with https://github.com/Efficient-Large-Model/VILA-Internal/blob/main/.github/workflows/pre-commit.yaml
with:
extra_args: --all-files
- name: Check if there are any changes
id: verify_diff
run: |
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit files
if: steps.verify_diff.outputs.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "[CI-Lint] Fix code style issues with pre-commit ${{ github.sha }}" -a
git push
- name: Remove label(s) after lint
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: lint wanted
54 changes: 54 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: ci
on:
pull_request:
push:
branches: [main, feat/Sana-public, feat/Sana-public-for-NVLab]
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# if: ${{ github.repository == 'Efficient-Large-Model/Sana' }}
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.10.10
- name: Test pre-commit hooks
uses: pre-commit/[email protected]
tests-bash:
# needs: pre-commit
runs-on: self-hosted
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.10.10
- name: Set up the environment
run: |
bash environment_setup.sh
- name: Run tests with Slurm
run: |
sana-run --pty -m ci -J tests-bash bash tests/bash/entry.sh
# tests-python:
# needs: pre-commit
# runs-on: self-hosted
# steps:
# - name: Check out Git repository
# uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: 3.10.10
# - name: Set up the environment
# run: |
# ./environment_setup.sh
# - name: Run tests with Slurm
# run: |
# sana-run --pty -m ci -J tests-python pytest tests/python
62 changes: 62 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
name: (Common) Remove trailing whitespaces
- id: mixed-line-ending
name: (Common) Fix mixed line ending
args: [--fix=lf]
- id: end-of-file-fixer
name: (Common) Remove extra EOF newlines
- id: check-merge-conflict
name: (Common) Check for merge conflicts
- id: requirements-txt-fixer
name: (Common) Sort "requirements.txt"
- id: fix-encoding-pragma
name: (Python) Remove encoding pragmas
args: [--remove]
# - id: debug-statements
# name: (Python) Check for debugger imports
- id: check-json
name: (JSON) Check syntax
- id: check-yaml
name: (YAML) Check syntax
- id: check-toml
name: (TOML) Check syntax
# - repo: https://github.com/shellcheck-py/shellcheck-py
# rev: v0.10.0.1
# hooks:
# - id: shellcheck
- repo: https://github.com/google/yamlfmt
rev: v0.13.0
hooks:
- id: yamlfmt
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
name: (Markdown) Format docs with mdformat
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
hooks:
- id: pyupgrade
name: (Python) Update syntax for newer versions
args: [--py37-plus]
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
name: (Python) Format code with black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: (Python) Sort imports with isort
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.4
hooks:
- id: clang-format
name: (C/C++/CUDA) Format code with clang-format
args: [-style=google, -i]
types_or: [c, c++, cuda]
2 changes: 2 additions & 0 deletions CIs/add_license_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#/bin/bash
addlicense -s -c 'NVIDIA CORPORATION & AFFILIATES' -ignore "**/*__init__.py" **/*.py
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM nvcr.io/nvidia/pytorch:24.06-py3

WORKDIR /app

RUN curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o ~/miniconda.sh \
&& sh ~/miniconda.sh -b -p /opt/conda \
&& rm ~/miniconda.sh

ENV PATH /opt/conda/bin:$PATH
COPY pyproject.toml pyproject.toml
COPY diffusion diffusion
COPY configs configs
COPY sana sana
COPY app app

COPY environment_setup.sh environment_setup.sh
RUN ./environment_setup.sh sana

# COPY server.py server.py
CMD ["conda", "run", "-n", "sana", "--no-capture-output", "python", "-u", "-W", "ignore", "app/sana_app.py", "--config=configs/sana_config/1024ms/Sana_1600M_img1024.yaml", "--model_path=hf://Sana_1600M_1024px/checkpoints/Sana_1600M_1024px.pth",]
Loading

0 comments on commit 80976a9

Please sign in to comment.