-
Notifications
You must be signed in to change notification settings - Fork 65
feat: Support gpt-oss class of models with flash attention 3 support #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
889b8f3
Enable tuning of GPT OSS models
dushyantbehl cf10d60
change dockerfile structure to mimic current cicd
dushyantbehl 575c232
do not change base dockerfile till all testing is done
dushyantbehl 314ac97
make dev dockerfile leaner
dushyantbehl acf3c11
add dev readme
dushyantbehl 7f1271a
ensure flash attention version is not changed
dushyantbehl 42ae4b6
Fix linter complaining about quantization config.
dushyantbehl 4e786f7
condense dockerfile and fix the dependencies
dushyantbehl 4b19f7f
make model loading messages more explicit
dushyantbehl a92ad68
fix format
dushyantbehl ab1a21f
change dockerfile to build from source
dushyantbehl 130dcc8
enable mamba in nvcr image
dushyantbehl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,98 @@ | ||
| # Copyright The FMS HF Tuning Authors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| ## Global Args ################################################################# | ||
| ## If the nvcr container is updated, ensure to check the torch and python | ||
| ## installation version inside the dockerfile before pushing changes. | ||
| ARG NVCR_IMAGE_VERSION=25.02-py3 | ||
|
|
||
| # This is based on what is inside the NVCR image already | ||
| ARG PYTHON_VERSION=3.12 | ||
|
|
||
| ## Base Layer ################################################################## | ||
| FROM nvcr.io/nvidia/pytorch:${NVCR_IMAGE_VERSION} AS dev | ||
|
|
||
| ARG USER=root | ||
| ARG USER_UID=0 | ||
| ARG WORKDIR=/app | ||
| ARG SOURCE_DIR=/app/fms-hf-tuning | ||
| ARG SOURCE_BRANCH=main | ||
|
|
||
| ARG ENABLE_FMS_ACCELERATION=true | ||
| ARG ENABLE_AIM=true | ||
| ARG ENABLE_ALORA=true | ||
| ARG ENABLE_MLFLOW=true | ||
| ARG ENABLE_SCANNER=true | ||
| ARG ENABLE_CLEARML=true | ||
| ARG ENABLE_TRITON_KERNELS=true | ||
| ARG ENABLE_MAMBA_SUPPORT=false | ||
|
|
||
| # Ensures to always build mamba_ssm from source | ||
| ENV PIP_NO_BINARY=mamba-ssm,mamba_ssm | ||
|
|
||
| RUN python -m pip install --upgrade pip | ||
|
|
||
| # upgrade torch as the base layer contains only torch 2.7 | ||
| RUN pip install --upgrade --force-reinstall torch torchaudio torchvision --index-url https://download.pytorch.org/whl/cu128 | ||
|
|
||
| # Install main package + flash attention | ||
| RUN git clone --branch ${SOURCE_BRANCH} --depth 1 https://github.com/foundation-model-stack/fms-hf-tuning.git ${SOURCE_DIR} | ||
| RUN cd ${SOURCE_DIR} | ||
| RUN pip install --no-cache-dir ${SOURCE_DIR} && \ | ||
| pip install --no-cache-dir ${SOURCE_DIR}[flash-attn] | ||
|
|
||
| # Optional extras | ||
| RUN if [[ "${ENABLE_FMS_ACCELERATION}" == "true" ]]; then \ | ||
| pip install --no-cache-dir ${SOURCE_DIR}[fms-accel] && \ | ||
| python -m fms_acceleration.cli install fms_acceleration_peft && \ | ||
| python -m fms_acceleration.cli install fms_acceleration_foak && \ | ||
| python -m fms_acceleration.cli install fms_acceleration_aadp && \ | ||
| python -m fms_acceleration.cli install fms_acceleration_moe; \ | ||
| fi | ||
|
|
||
| RUN if [[ "${ENABLE_ALORA}" == "true" ]]; then \ | ||
| pip install --no-cache-dir ${SOURCE_DIR}[activated-lora]; \ | ||
| fi | ||
| RUN if [[ "${ENABLE_AIM}" == "true" ]]; then \ | ||
| pip install --no-cache-dir ${SOURCE_DIR}[aim]; \ | ||
| fi | ||
| RUN if [[ "${ENABLE_MLFLOW}" == "true" ]]; then \ | ||
| pip install --no-cache-dir ${SOURCE_DIR}[mlflow]; \ | ||
| fi | ||
| RUN if [[ "${ENABLE_SCANNER}" == "true" ]]; then \ | ||
| pip install --no-cache-dir ${SOURCE_DIR}[scanner-dev]; \ | ||
| fi | ||
| RUN if [[ "${ENABLE_CLEARML}" == "true" ]]; then \ | ||
| pip install --no-cache-dir ${SOURCE_DIR}[clearml]; \ | ||
| fi | ||
| RUN if [[ "${ENABLE_MAMBA_SUPPORT}" == "true" ]]; then \ | ||
| pip install --no-cache-dir ${SOURCE_DIR}[mamba]; \ | ||
| fi | ||
| RUN if [[ "${ENABLE_TRITON_KERNELS}" == "true" ]]; then \ | ||
| pip install --no-cache-dir "git+https://github.com/triton-lang/triton.git@main#subdirectory=python/triton_kernels"; \ | ||
| fi | ||
|
|
||
| RUN chmod -R g+rwX $WORKDIR /tmp | ||
| RUN mkdir -p /.cache && chmod -R 777 /.cache | ||
|
|
||
| # Set Triton environment variables for qLoRA | ||
| ENV TRITON_HOME="/tmp/triton_home" | ||
| ENV TRITON_DUMP_DIR="/tmp/triton_dump_dir" | ||
| ENV TRITON_CACHE_DIR="/tmp/triton_cache_dir" | ||
| ENV TRITON_OVERRIDE_DIR="/tmp/triton_override_dir" | ||
|
|
||
| WORKDIR $WORKDIR | ||
|
|
||
| # this is just a dev image so this is okay. | ||
| CMD ["sleep inifinity"] | ||
dushyantbehl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.