Skip to content

Commit

Permalink
test image build
Browse files Browse the repository at this point in the history
Signed-off-by: ted chang <[email protected]>
  • Loading branch information
tedhtchang committed Apr 13, 2024
1 parent bc5b6b3 commit 4972feb
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox pre-commit
python -m pip install tox
- name: Check formatting
run: tox -e fmt
- name: Run pylint
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Image
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install tox
- name: Build wheel
run: |
tox -e build
- name: Build image
run: |
docker build -t fms-hf-tuning:dev . -f build/Dockerfile
7 changes: 3 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ jobs:
tox: "py39"
- setup: "3.10"
tox: "py310"
- setup: "3.11"
tox: "py311"
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox build
- name: Run unit tests
run: tox -e py
# TODO: switch to tox
- name: Build wheel
run: python -m build .
run: tox -e py
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Before sending pull requests, make sure your changes pass formatting, linting an
#### Dependencies
If additional new Python module dependencies are required, think about where to put them:

- If they're required for fms-hf-tuning, then append them to the end of the requirements.txt file.
- If they're optional dependencies for additional functionality, then put them in the pyproject.toml file like were done for [flash-attn](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/pyproject.toml#L26) or [aim](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/pyproject.toml#L27).
- If it's an additional dependency for development, then add it to the [dev](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/pyproject.toml#L25) dependencies.
- If they're required for fms-hf-tuning, then append them to the [dependencies](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/pyproject.toml#L27) in the pyproject.toml.
- If they're optional dependencies for additional functionality, then put them in the pyproject.toml file like were done for [flash-attn](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/pyproject.toml#L43) or [aim](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/pyproject.toml#L44).
- If it's an additional dependency for development, then add it to the [dev](https://github.com/foundation-model-stack/fms-hf-tuning/blob/main/pyproject.toml#L42) dependencies.

#### Code Review

Expand Down
30 changes: 19 additions & 11 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM registry.access.redhat.com/ubi9/python-311 as build

USER root
RUN python -m pip install --upgrade pip && \
python -m pip install build
COPY tuning tuning
COPY pyproject.toml .
RUN --mount=source=.git,target=.git,type=bind \
python -m build --wheel --outdir /tmp && \
ls /tmp/*.whl >/tmp/bdist_name


FROM registry.access.redhat.com/ubi9/ubi AS release

ARG CUDA_VERSION=11.8.0
Expand Down Expand Up @@ -94,22 +106,18 @@ RUN dnf install -y python3.11 git && \
ln -s /usr/bin/python3.11 /bin/python && \
python -m ensurepip --upgrade

RUN mkdir /app

WORKDIR /tmp
RUN python -m pip install --upgrade pip

# TODO Move to installing wheel once we have proper releases setup instead of cloning the repo
RUN git clone https://github.com/foundation-model-stack/fms-hf-tuning.git && \
cd fms-hf-tuning && \
python -m pip install ".[dev]" && \
python -m pip install ".[flash-attn]" && \
python -m pip install ".[aim]" && \
python -m pip install -U datasets
COPY --from=build /tmp/*.whl /tmp/bdist_name /tmp/
# ami and flash-attn depends on dev
RUN --mount=type=cache,target=/root/.cache/pip \
python -m pip install "$(head bdist_name)[dev]" && \
python -m pip install "$(head bdist_name)[aim]" && \
python -m pip install "$(head bdist_name)[flash-attn]"

RUN mkdir -p /licenses
COPY LICENSE /licenses/

RUN mkdir /app
# Copy scripts and default configs
COPY build/launch_training.py build/accelerate_launch.py fixtures/accelerate_fsdp_defaults.yaml /app/
COPY build/utils.py /app/build/
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires = [

[project]
name = "fms-hf-tuning"
dynamic = ["version", "dependencies"]
dynamic = ["version"]
description = "FMS HF Tuning"
authors = [
{name = "Sukriti Sharma", email = "[email protected]"},
Expand Down Expand Up @@ -50,6 +50,7 @@ namespaces = false
[tool.setuptools_scm]
version_file = "tuning/_version.py"


[project.urls]
Homepage = "https://github.com/foundation-model-stack/fms-hf-tuning"
Repository = "https://github.com/foundation-model-stack/fms-hf-tuning"
Expand Down
18 changes: 0 additions & 18 deletions setup.py

This file was deleted.

9 changes: 6 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ commands =

[testenv:fmt]
description = format with pre-commit
deps =
pre-commit
commands = ./scripts/fmt.sh
allowlist_externals = ./scripts/fmt.sh

[testenv:lint]
description = lint with pylint
deps = pylint>=2.16.2,<=3.1.0
pytest
.[dev]
deps =
pylint>=2.16.2,<=3.1.0
pytest
.[dev]
commands = pylint tuning scripts/*.py build/*.py tests
allowlist_externals = pylint

Expand Down

0 comments on commit 4972feb

Please sign in to comment.