From c2ddd61a99c6bd0431b498b58c1b440c5876067b Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Tue, 30 Jul 2024 10:18:03 +0200 Subject: [PATCH 1/9] fix F401 warning --- src/alignment/__init__.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/alignment/__init__.py b/src/alignment/__init__.py index 224404c6..2fafb542 100644 --- a/src/alignment/__init__.py +++ b/src/alignment/__init__.py @@ -11,3 +11,21 @@ get_tokenizer, is_adapter_model, ) + + +__all__ = [ + "DataArguments", + "DPOConfig", + "H4ArgumentParser", + "ModelArguments", + "SFTConfig", + "apply_chat_template", + "get_datasets", + "decontaminate_humaneval", + "get_checkpoint", + "get_kbit_device_map", + "get_peft_config", + "get_quantization_config", + "get_tokenizer", + "is_adapter_model", +] From 469342cc0dec10da22b047a94e4bd38f50a9ee74 Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Tue, 30 Jul 2024 10:28:28 +0200 Subject: [PATCH 2/9] add CITATION.cff --- CITATION.cff | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 CITATION.cff diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 00000000..581c4af7 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,27 @@ +cff-version: 1.2.0 +title: alignment-handbook +message: >- + Robust recipes to align language models with human and AI + preferences. +type: software +authors: + - given-names: Lewis + family-names: Tunstall + - given-names: Edward + family-names: Beeching + - given-names: Nathan + family-names: Lambert + - given-names: Nazneen + family-names: Rajani + - given-names: Shengyi + family-names: Huang + - given-names: Kashif + family-names: Rasul + - given-names: Alexander + name-particle: M. + family-names: Rush + - given-names: Thomas + family-names: Wolf +repository-code: 'https://github.com/huggingface/alignment-handbook' +license: Apache-2.0 +version: 0.3.0.dev0 From 9a378c108fd61ca01f77c4cfce8c7134a4722007 Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Tue, 30 Jul 2024 10:29:56 +0200 Subject: [PATCH 3/9] update version in CITATION --- src/alignment/release.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/alignment/release.py b/src/alignment/release.py index 7f3f7679..c9507a78 100644 --- a/src/alignment/release.py +++ b/src/alignment/release.py @@ -20,12 +20,20 @@ REPLACE_PATTERNS = { - "init": (re.compile(r'^__version__\s+=\s+"([^"]+)"\s*$', re.MULTILINE), '__version__ = "VERSION"\n'), - "setup": (re.compile(r'^(\s*)version\s*=\s*"[^"]+",', re.MULTILINE), r'\1version="VERSION",'), + "init": ( + re.compile(r'^__version__\s+=\s+"([^"]+)"\s*$', re.MULTILINE), + '__version__ = "VERSION"\n', + ), + "setup": ( + re.compile(r'^(\s*)version\s*=\s*"[^"]+",', re.MULTILINE), + r'\1version="VERSION",', + ), + "citation": (re.compile(r"^version:\s+[^ ]+", re.MULTILINE), "version: VERSION"), } REPLACE_FILES = { "init": "src/alignment/__init__.py", "setup": "setup.py", + "citation": "CITATION.cff", } README_FILE = "README.md" @@ -60,7 +68,9 @@ def pre_release_work(patch=False): # First let's get the default version: base version if we are in dev, bump minor otherwise. default_version = get_version() if patch and default_version.is_devrelease: - raise ValueError("Can't create a patch version from the dev branch, checkout a released version!") + raise ValueError( + "Can't create a patch version from the dev branch, checkout a released version!" + ) if default_version.is_devrelease: default_version = default_version.base_version elif patch: @@ -95,8 +105,14 @@ def post_release_work(): if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument("--post_release", action="store_true", help="Whether this is pre or post release.") - parser.add_argument("--patch", action="store_true", help="Whether or not this is a patch release.") + parser.add_argument( + "--post_release", + action="store_true", + help="Whether this is pre or post release.", + ) + parser.add_argument( + "--patch", action="store_true", help="Whether or not this is a patch release." + ) args = parser.parse_args() if not args.post_release: pre_release_work(patch=args.patch) From 15e2a345ede5f387f1cc08fb972788ba768b14c3 Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Tue, 30 Jul 2024 10:35:31 +0200 Subject: [PATCH 4/9] update title --- CITATION.cff | 2 +- README.md | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 581c4af7..9a7103b4 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,5 +1,5 @@ cff-version: 1.2.0 -title: alignment-handbook +title: The Alignment Handbook message: >- Robust recipes to align language models with human and AI preferences. diff --git a/README.md b/README.md index 83a2022e..23d07721 100644 --- a/README.md +++ b/README.md @@ -115,15 +115,14 @@ You can now check out the `scripts` and `recipes` directories for instructions o ## Citation -If you find the content of this repo useful in your work, please cite it as follows: +If you find the content of this repo useful in your work, please cite it as follows via '\usepackage{biblatex}`: ```bibtex -@misc{alignment_handbook2023, - author = {Lewis Tunstall and Edward Beeching and Nathan Lambert and Nazneen Rajani and Shengyi Huang and Kashif Rasul and Alexander M. Rush and Thomas Wolf}, - title = {The Alignment Handbook}, - year = {2023}, - publisher = {GitHub}, - journal = {GitHub repository}, - howpublished = {\url{https://github.com/huggingface/alignment-handbook}} +@software{Tunstall_alignment-handbook, + author = {Tunstall, Lewis and Beeching, Edward and Lambert, Nathan and Rajani, Nazneen and Huang, Shengyi and Rasul, Kashif and M. Rush, Alexander and Wolf, Thomas}, + license = {Apache-2.0}, + title = {{The Alignment Handbook}}, + url = {https://github.com/huggingface/alignment-handbook}, + version = {0.3.0.dev0} } ``` From ce3759157e4e9a04942b644053abeb666f199a31 Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Tue, 30 Jul 2024 10:36:53 +0200 Subject: [PATCH 5/9] fix label --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 23d07721..e858b760 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ You can now check out the `scripts` and `recipes` directories for instructions o If you find the content of this repo useful in your work, please cite it as follows via '\usepackage{biblatex}`: ```bibtex -@software{Tunstall_alignment-handbook, +@software{Tunstall_The_Alignment_Handbook, author = {Tunstall, Lewis and Beeching, Edward and Lambert, Nathan and Rajani, Nazneen and Huang, Shengyi and Rasul, Kashif and M. Rush, Alexander and Wolf, Thomas}, license = {Apache-2.0}, title = {{The Alignment Handbook}}, From 1f12a5e10b975322cdc6017dc99f213dbc1ee1e7 Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Tue, 30 Jul 2024 10:38:23 +0200 Subject: [PATCH 6/9] Update src/alignment/__init__.py Co-authored-by: Alvaro Bartolome <36760800+alvarobartt@users.noreply.github.com> --- src/alignment/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/alignment/__init__.py b/src/alignment/__init__.py index 2fafb542..cce29a85 100644 --- a/src/alignment/__init__.py +++ b/src/alignment/__init__.py @@ -12,7 +12,6 @@ is_adapter_model, ) - __all__ = [ "DataArguments", "DPOConfig", From d2a9d37bb2bed94e34b48ae81b35ca57f0f04cbf Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Tue, 30 Jul 2024 10:39:32 +0200 Subject: [PATCH 7/9] make style --- src/alignment/__init__.py | 1 + src/alignment/release.py | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/alignment/__init__.py b/src/alignment/__init__.py index cce29a85..2fafb542 100644 --- a/src/alignment/__init__.py +++ b/src/alignment/__init__.py @@ -12,6 +12,7 @@ is_adapter_model, ) + __all__ = [ "DataArguments", "DPOConfig", diff --git a/src/alignment/release.py b/src/alignment/release.py index c9507a78..d57ebf3d 100644 --- a/src/alignment/release.py +++ b/src/alignment/release.py @@ -68,9 +68,7 @@ def pre_release_work(patch=False): # First let's get the default version: base version if we are in dev, bump minor otherwise. default_version = get_version() if patch and default_version.is_devrelease: - raise ValueError( - "Can't create a patch version from the dev branch, checkout a released version!" - ) + raise ValueError("Can't create a patch version from the dev branch, checkout a released version!") if default_version.is_devrelease: default_version = default_version.base_version elif patch: @@ -110,9 +108,7 @@ def post_release_work(): action="store_true", help="Whether this is pre or post release.", ) - parser.add_argument( - "--patch", action="store_true", help="Whether or not this is a patch release." - ) + parser.add_argument("--patch", action="store_true", help="Whether or not this is a patch release.") args = parser.parse_args() if not args.post_release: pre_release_work(patch=args.patch) From 8d81a36eaaa58375afdca2147eca8623a32804cd Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Tue, 30 Jul 2024 10:45:55 +0200 Subject: [PATCH 8/9] add Alvaro Bartolome --- CITATION.cff | 2 ++ README.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CITATION.cff b/CITATION.cff index 9a7103b4..1e2b2293 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -17,6 +17,8 @@ authors: family-names: Huang - given-names: Kashif family-names: Rasul + - given-names: Alvaro + family-names: Bartolome - given-names: Alexander name-particle: M. family-names: Rush diff --git a/README.md b/README.md index e858b760..cb97a484 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ If you find the content of this repo useful in your work, please cite it as foll ```bibtex @software{Tunstall_The_Alignment_Handbook, - author = {Tunstall, Lewis and Beeching, Edward and Lambert, Nathan and Rajani, Nazneen and Huang, Shengyi and Rasul, Kashif and M. Rush, Alexander and Wolf, Thomas}, + author = {Tunstall, Lewis and Beeching, Edward and Lambert, Nathan and Rajani, Nazneen and Huang, Shengyi and Rasul, Kashif and Bartolome, Alvaro and M. Rush, Alexander and Wolf, Thomas}, license = {Apache-2.0}, title = {{The Alignment Handbook}}, url = {https://github.com/huggingface/alignment-handbook}, From fde2b391d0cca5f353872217d92c85900d50ab69 Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Tue, 30 Jul 2024 10:55:23 +0200 Subject: [PATCH 9/9] update version in readme --- src/alignment/release.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/alignment/release.py b/src/alignment/release.py index d57ebf3d..5a9f6603 100644 --- a/src/alignment/release.py +++ b/src/alignment/release.py @@ -29,13 +29,20 @@ r'\1version="VERSION",', ), "citation": (re.compile(r"^version:\s+[^ ]+", re.MULTILINE), "version: VERSION"), + "readme": ( + re.compile(r"version\s+=\s+\{[^}]+\}", re.MULTILINE), + "version = {VERSION}", + ), } + +README_FILE = "README.md" + REPLACE_FILES = { "init": "src/alignment/__init__.py", "setup": "setup.py", "citation": "CITATION.cff", + "readme": README_FILE, } -README_FILE = "README.md" def update_version_in_file(fname, version, pattern):