From 71935aa34de87c20c2f43a61457deee3c6b813f9 Mon Sep 17 00:00:00 2001 From: James Busche Date: Thu, 29 Feb 2024 13:13:43 -0800 Subject: [PATCH 01/12] Adding toml packaging Signed-off-by: James Busche --- pyproject.toml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..203be95c6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,47 @@ +[build-system] +requires = [ + "setuptools>=61", + "setuptools-scm>=8.0"] + +[project] +name = "fms-hf-tuning" +version = "0.0.1" +description = "FMS HF Tuning" +authors = [ + "Sukriti Sharma ", + "Anh Uong ", +] +license = {text = "Apache-2.0"} +readme = "README.md" +requires-python = "~=3.9" +keywords = ['fms-hf-tuning', 'python', 'tuning'] +classifiers=[ + "License :: OSI Approved :: Apache Software License" +] +dependencies = [ + "numpy", + "accelerate>=0.20.3", + "packaging", + "transformers>=4.34.1", + "torch", + "aim==3.17.5", + "sentencepiece", + "tokenizers>=0.13.3", + "tqdm", + "trl", + "ninja", + "peft>=0.8.0", + "datasets>=2.15.0", + "fire", +] + +[project.optional-dependencies] +flashattention = [ + "wheel", + "flash-attn", +] + +[project.urls] +Homepage = "https://github.com/foundation-model-stack/fms-hf-tuning" +Repository = "https://github.com/foundation-model-stack/fms-hf-tuning" +Issues = "https://github.com/foundation-model-stack/fms-hf-tuning/issues" From 25e5085a08986d65d8832c2e9add4318a2929cc4 Mon Sep 17 00:00:00 2001 From: James Busche Date: Thu, 29 Feb 2024 13:31:11 -0800 Subject: [PATCH 02/12] Fix author lines Signed-off-by: James Busche --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 203be95c6..9ad337057 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,8 +8,8 @@ name = "fms-hf-tuning" version = "0.0.1" description = "FMS HF Tuning" authors = [ - "Sukriti Sharma ", - "Anh Uong ", + {name = "Sukriti Sharma", email = "sukriti.sharma4@ibm.com"}, + {name = "Anh Uong", email = "anh.uong@ibm.com"}, ] license = {text = "Apache-2.0"} readme = "README.md" From c77b1c01d008ccd2f17d807c5dcf7f0786ba57ee Mon Sep 17 00:00:00 2001 From: James Busche Date: Fri, 1 Mar 2024 17:53:35 -0800 Subject: [PATCH 03/12] remove requirements file Signed-off-by: James Busche --- README.md | 4 +--- flashattn_requirements.txt | 2 -- pyproject.toml | 28 ++++++++++++++-------------- requirements.txt | 15 --------------- 4 files changed, 15 insertions(+), 34 deletions(-) delete mode 100644 flashattn_requirements.txt delete mode 100644 requirements.txt diff --git a/README.md b/README.md index ac7693fbe..e04afc1b7 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,10 @@ This repo provides basic tuning scripts with support for specific models. The re ## Installation ``` -pip install -r requirements.txt -pip install -U datasets pip install -e . ``` -> Note: If you wish to use [FlashAttention](https://github.com/Dao-AILab/flash-attention), then you need to install these requirements: `pip install -r flashattn_requirements`. [FlashAttention](https://github.com/Dao-AILab/flash-attention) requires the [CUDA Toolit](https://developer.nvidia.com/cuda-toolkit) to be pre-installed. +> Note: If you wish to use [FlashAttention](https://github.com/Dao-AILab/flash-attention), then you need to install these requirements: `pip install -e ."[flashattention]"`. [FlashAttention](https://github.com/Dao-AILab/flash-attention) requires the [CUDA Toolit](https://developer.nvidia.com/cuda-toolkit) to be pre-installed. ## Data format The data format expectation is a single column text. The trainer is configured to expect a response template as a string. For example, if one wants to prepare the `alpaca` format data to feed into this trainer, it is quite easy and can be done with the following code. diff --git a/flashattn_requirements.txt b/flashattn_requirements.txt deleted file mode 100644 index a38086016..000000000 --- a/flashattn_requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -wheel -flash-attn diff --git a/pyproject.toml b/pyproject.toml index 9ad337057..ad4e40c22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,25 +19,25 @@ classifiers=[ "License :: OSI Approved :: Apache Software License" ] dependencies = [ - "numpy", - "accelerate>=0.20.3", - "packaging", - "transformers>=4.34.1", - "torch", + "numpy==1.26.4", + "accelerate==0.27.2", + "packaging==23.2", + "transformers==4.37.2", + "torch==2.2.1", "aim==3.17.5", - "sentencepiece", - "tokenizers>=0.13.3", - "tqdm", - "trl", - "ninja", - "peft>=0.8.0", - "datasets>=2.15.0", - "fire", + "sentencepiece==0.2.0", + "tokenizers==0.15.2", + "tqdm==4.66.2", + "trl==0.7.11", + "ninja==1.11.1.1", + "peft==0.9.0", + "datasets==2.18.0", + "fire==0.5.0", ] [project.optional-dependencies] flashattention = [ - "wheel", + "wheel==0.42.0", "flash-attn", ] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 0c7204395..000000000 --- a/requirements.txt +++ /dev/null @@ -1,15 +0,0 @@ -numpy -accelerate>=0.20.3 -packaging -transformers>=4.34.1 -torch -aim==3.18.1 -sentencepiece -tokenizers>=0.13.3 -tqdm -trl -ninja -peft>=0.8.0 -datasets>=2.15.0 -fire - From 9012739e9bd132152c2a2767eb5c0d05f439db82 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Mar 2024 07:31:43 -0700 Subject: [PATCH 04/12] Bump aim from 3.17.5 to 3.18.1 (#42) Bumps [aim](https://github.com/aimhubio/aim) from 3.17.5 to 3.18.1. - [Release notes](https://github.com/aimhubio/aim/releases) - [Changelog](https://github.com/aimhubio/aim/blob/main/CHANGELOG.md) - [Commits](https://github.com/aimhubio/aim/compare/v3.17.5...v3.18.1) --- updated-dependencies: - dependency-name: aim dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sukriti Sharma --- requirements.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..a5ab5eafd --- /dev/null +++ b/requirements.txt @@ -0,0 +1,15 @@ +numpy +accelerate>=0.20.3 +packaging +transformers==4.37.2 +torch +aim==3.18.1 +sentencepiece +tokenizers>=0.13.3 +tqdm +trl +ninja +peft>=0.8.0 +datasets>=2.15.0 +fire +wheel From 73d71d02e1abd67e7e7a69b5419b2ff5875367b0 Mon Sep 17 00:00:00 2001 From: James Busche Date: Thu, 7 Mar 2024 07:03:55 -0800 Subject: [PATCH 05/12] Add Contributing file (#58) * Add Contributing file Signed-off-by: James Busche * add issue templates Signed-off-by: James Busche * Adding Alex to CODEOWNERS Signed-off-by: James Busche * Add ADR and squash info Signed-off-by: James Busche * Update CONTRIBUTING.md Signed-off-by: Sukriti Sharma * NIT: Update CONTRIBUTING.md Signed-off-by: Sukriti Sharma --------- Signed-off-by: James Busche Signed-off-by: Sukriti Sharma Co-authored-by: Sukriti Sharma From e24f0de8c860e20f448dd3f362e72d717538a6b0 Mon Sep 17 00:00:00 2001 From: James Busche Date: Thu, 7 Mar 2024 07:03:55 -0800 Subject: [PATCH 06/12] Add Contributing file (#58) * Add Contributing file Signed-off-by: James Busche * add issue templates Signed-off-by: James Busche * Adding Alex to CODEOWNERS Signed-off-by: James Busche * Add ADR and squash info Signed-off-by: James Busche * Update CONTRIBUTING.md Signed-off-by: Sukriti Sharma * NIT: Update CONTRIBUTING.md Signed-off-by: Sukriti Sharma --------- Signed-off-by: James Busche Signed-off-by: Sukriti Sharma Co-authored-by: Sukriti Sharma From 8d5befeb4ebe60dad222b6f3d53dec7411b08f0e Mon Sep 17 00:00:00 2001 From: James Busche Date: Thu, 7 Mar 2024 20:16:31 -0800 Subject: [PATCH 07/12] switch to toml install method Signed-off-by: James Busche --- CONTRIBUTING.md | 1 - README.md | 7 ++++++- build/Dockerfile | 14 +++++--------- pyproject.toml | 27 +++++++-------------------- requirements.txt | 5 +---- 5 files changed, 19 insertions(+), 35 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4df74d20f..e22ee76fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,7 +78,6 @@ The following tools are required: Installation: ``` -pip install -r requirements.txt pip install -U datasets pip install -e . ``` diff --git a/README.md b/README.md index e04afc1b7..53a7b884d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,12 @@ This repo provides basic tuning scripts with support for specific models. The re pip install -e . ``` -> Note: If you wish to use [FlashAttention](https://github.com/Dao-AILab/flash-attention), then you need to install these requirements: `pip install -e ."[flashattention]"`. [FlashAttention](https://github.com/Dao-AILab/flash-attention) requires the [CUDA Toolit](https://developer.nvidia.com/cuda-toolkit) to be pre-installed. +> Note: After installing, if you wish to use [FlashAttention](https://github.com/Dao-AILab/flash-attention), then you need to install these requirements: +''' +pip install -e ."[dev]" +pip install -e ."[flash-attn] +``` +[FlashAttention](https://github.com/Dao-AILab/flash-attention) requires the [CUDA Toolit](https://developer.nvidia.com/cuda-toolkit) to be pre-installed. ## Data format The data format expectation is a single column text. The trainer is configured to expect a response template as a string. For example, if one wants to prepare the `alpaca` format data to feed into this trainer, it is quite easy and can be done with the following code. diff --git a/build/Dockerfile b/build/Dockerfile index fbad2ff4f..20179ff91 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -96,18 +96,14 @@ RUN dnf install -y python3.11 git && \ RUN mkdir /app WORKDIR /tmp -RUN python -m pip install packaging && \ - python -m pip install --upgrade pip && \ - python -m pip install torch && \ - python -m pip install wheel +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 -r requirements.txt && \ - python -m pip install -r flashattn_requirements.txt && \ - python -m pip install -U datasets && \ - python -m pip install /tmp/fms-hf-tuning + python -m pip install .[dev] && \ + python -m pip install .[flash-attn] && \ + python -m pip install -U datasets RUN mkdir -p /licenses COPY LICENSE /licenses/ @@ -129,4 +125,4 @@ RUN useradd -u $USER_UID tuning -m -g 0 --system && \ WORKDIR /app USER ${USER} -CMD [ "tail", "-f", "/dev/null" ] \ No newline at end of file +CMD [ "tail", "-f", "/dev/null" ] diff --git a/pyproject.toml b/pyproject.toml index ad4e40c22..4babec5d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,28 +18,15 @@ keywords = ['fms-hf-tuning', 'python', 'tuning'] classifiers=[ "License :: OSI Approved :: Apache Software License" ] -dependencies = [ - "numpy==1.26.4", - "accelerate==0.27.2", - "packaging==23.2", - "transformers==4.37.2", - "torch==2.2.1", - "aim==3.17.5", - "sentencepiece==0.2.0", - "tokenizers==0.15.2", - "tqdm==4.66.2", - "trl==0.7.11", - "ninja==1.11.1.1", - "peft==0.9.0", - "datasets==2.18.0", - "fire==0.5.0", -] + +dynamic = ["dependencies"] [project.optional-dependencies] -flashattention = [ - "wheel==0.42.0", - "flash-attn", -] +dev = ["wheel", "packaging", "ninja"] +flash-attn = ["flash-attn"] + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} [project.urls] Homepage = "https://github.com/foundation-model-stack/fms-hf-tuning" diff --git a/requirements.txt b/requirements.txt index a5ab5eafd..c1658bee2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,12 @@ numpy accelerate>=0.20.3 -packaging transformers==4.37.2 torch -aim==3.18.1 +aim==3.17.5 sentencepiece tokenizers>=0.13.3 tqdm trl -ninja peft>=0.8.0 datasets>=2.15.0 fire -wheel From 1b26c6eef82668bfb9cb7b8bb6a29fedbb4a3c3f Mon Sep 17 00:00:00 2001 From: James Busche Date: Fri, 8 Mar 2024 16:44:03 -0800 Subject: [PATCH 08/12] common install steps for mac and linux Signed-off-by: James Busche --- CONTRIBUTING.md | 2 +- README.md | 4 ++-- build/Dockerfile | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e22ee76fc..5853c4c70 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,7 +79,7 @@ The following tools are required: Installation: ``` pip install -U datasets -pip install -e . +pip install -e "." ```
Linting diff --git a/README.md b/README.md index 53a7b884d..ca62fa1e3 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ pip install -e . > Note: After installing, if you wish to use [FlashAttention](https://github.com/Dao-AILab/flash-attention), then you need to install these requirements: ''' -pip install -e ."[dev]" -pip install -e ."[flash-attn] +pip install -e ".[dev]" +pip install -e ".[flash-attn]" ``` [FlashAttention](https://github.com/Dao-AILab/flash-attention) requires the [CUDA Toolit](https://developer.nvidia.com/cuda-toolkit) to be pre-installed. diff --git a/build/Dockerfile b/build/Dockerfile index 20179ff91..191152555 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -101,8 +101,8 @@ 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 ".[dev]" && \ + python -m pip install ".[flash-attn]" && \ python -m pip install -U datasets RUN mkdir -p /licenses From e86018f6a4684f1f6876babd2820b9bcf84380eb Mon Sep 17 00:00:00 2001 From: James Busche Date: Fri, 8 Mar 2024 18:08:23 -0800 Subject: [PATCH 09/12] simple install in docs Signed-off-by: James Busche --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5853c4c70..e22ee76fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,7 +79,7 @@ The following tools are required: Installation: ``` pip install -U datasets -pip install -e "." +pip install -e . ```
Linting From e045af69d800fa3c7d5428814c72672f18f1e03d Mon Sep 17 00:00:00 2001 From: James Busche Date: Mon, 11 Mar 2024 14:06:08 -0700 Subject: [PATCH 10/12] remove transformers hardcoded value Signed-off-by: James Busche --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c1658bee2..bf83b003a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ numpy accelerate>=0.20.3 -transformers==4.37.2 +transformers torch aim==3.17.5 sentencepiece From 0ded00ca4056b867d2860a9805c4345a097b448a Mon Sep 17 00:00:00 2001 From: James Busche Date: Mon, 25 Mar 2024 15:39:11 -0700 Subject: [PATCH 11/12] Fix author lines Signed-off-by: James Busche --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index bf83b003a..2e3895770 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ numpy accelerate>=0.20.3 transformers torch -aim==3.17.5 +aim==3.18.1 sentencepiece tokenizers>=0.13.3 tqdm From a25ef3f659feabe066709f4b0441b33fc2aa9834 Mon Sep 17 00:00:00 2001 From: James Busche Date: Tue, 26 Mar 2024 11:33:50 -0700 Subject: [PATCH 12/12] change name to fms-hf-tuning Signed-off-by: James Busche --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 97167fe76..0d42e68fe 100644 --- a/setup.py +++ b/setup.py @@ -15,4 +15,4 @@ # Third Party from setuptools import find_packages, setup -setup(name="tuning", version="0.0.1", packages=find_packages()) +setup(name="fms-hf-tuning", version="0.0.1", packages=find_packages())