Skip to content
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

[SUBMISSION] December 2024 - Module 2: Preference Alignment #133

Open
wants to merge 52 commits into
base: december-2024
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
a0be35b
Merge branch 'huggingface:main' into main
jucanbe Dec 12, 2024
9a1e884
Merge branch 'huggingface:main' into main
jucanbe Dec 15, 2024
12954c2
Added module 3 to translate
ViniFBN Dec 16, 2024
2a8e1c9
Merge branch 'huggingface:main' into translation-pt-br
ViniFBN Dec 17, 2024
997c55f
Sending part of translation of module 3
ViniFBN Dec 18, 2024
f2f4c9f
Merge branch 'translation-pt-br' of https://github.com/ViniFBN/smol-c…
ViniFBN Dec 18, 2024
ba66518
Merge branch 'huggingface:main' into translation-pt-br
ViniFBN Dec 18, 2024
616197c
Merge branch 'translation-pt-br' of https://github.com/ViniFBN/smol-c…
ViniFBN Dec 18, 2024
d624957
Finished translation - Module 3
ViniFBN Dec 18, 2024
811f6fe
first version of Spanish translation
yabramuvdi Dec 18, 2024
df2dc68
Fixing wrong args passed to DPOTrainer
Knight7561 Dec 18, 2024
74abbab
Merge branch 'huggingface:main' into main
jucanbe Dec 19, 2024
52b645d
Module 4 - Translated
ViniFBN Dec 20, 2024
679f5f7
Merge branch 'huggingface:main' into translation-pt-br
ViniFBN Dec 20, 2024
c9a9b6a
Module 4 - Finished
ViniFBN Dec 20, 2024
bf6de63
init
hahuyhoang411 Dec 20, 2024
4cea4cc
typo
hahuyhoang411 Dec 21, 2024
5d7fa13
typo
hahuyhoang411 Dec 21, 2024
a933c4d
init
hahuyhoang411 Dec 21, 2024
459ea74
Merge branch 'huggingface:main' into main
jucanbe Dec 22, 2024
0ea6dcf
init
hahuyhoang411 Dec 22, 2024
e26af1e
Module 2 complete
jucanbe Dec 22, 2024
d428ec4
Add video usage
duydl Dec 22, 2024
b09436d
Improve desc
duydl Dec 22, 2024
f71ede6
Fix typo. Add more explanation
duydl Dec 22, 2024
bb4915d
Add deps
duydl Dec 22, 2024
6352161
Fix typo
duydl Dec 22, 2024
9a29a37
Typo
duydl Dec 22, 2024
f19444f
Merge branch 'main' into fix-module-2
Knight7561 Dec 22, 2024
bc89a27
add chapter 3
khanhthanhdev Dec 24, 2024
076214e
translate chapter 3 notebook to vietnamese
khanhthanhdev Dec 24, 2024
909371f
updating weights / training model
MostHumble Dec 24, 2024
de86d54
Merge branch 'huggingface:main' into main
jucanbe Dec 27, 2024
ea27360
Add gitleaks to check for secrets
strickvl Dec 30, 2024
30a81a0
init
hahuyhoang411 Jan 1, 2025
ca3eaf0
init
hahuyhoang411 Jan 1, 2025
6427fef
Merge branch 'huggingface:main' into translation-pt-br
ViniFBN Jan 5, 2025
6de3706
Merge branch 'huggingface:main' into main
jucanbe Jan 5, 2025
024c1aa
Merge pull request #151 from strickvl/feature/secret-checks-ci
burtenshaw Jan 8, 2025
d6d4465
Merge pull request #134 from duydl/feature/vlm-improved
burtenshaw Jan 8, 2025
dcde502
Merge pull request #142 from khanhthanhdev/main
burtenshaw Jan 8, 2025
dce7afb
Merge pull request #124 from Knight7561/fix-module-2
burtenshaw Jan 8, 2025
ab9cdcf
Merge branch 'december-2024' into pr/133
burtenshaw Jan 8, 2025
c45c240
Merge pull request #143 from MostHumble/patch-1
burtenshaw Jan 8, 2025
1082595
use none string not null
burtenshaw Jan 8, 2025
32d7e30
Merge pull request #166 from huggingface/fix/remove-wandb-logging
burtenshaw Jan 8, 2025
3936e08
Merge pull request #123 from yabramuvdi/es-translation
burtenshaw Jan 8, 2025
5ed4e1d
Merge pull request #119 from ViniFBN/translation-pt-br
burtenshaw Jan 8, 2025
35d2372
Merge branch 'huggingface:main' into main
jucanbe Jan 8, 2025
438341e
Merge remote-tracking branch 'upstream/main' into trans-vi2
hahuyhoang411 Jan 8, 2025
882ba52
Merge pull request #132 from hahuyhoang411/trans-vi2
burtenshaw Jan 9, 2025
bfdf511
Merge branch 'huggingface:main' into main
jucanbe Jan 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: gitleaks
on:
pull_request:
push:
workflow_dispatch:
jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion 1_instruction_tuning/supervised_fine_tuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ For example, if you're developing a customer service application, you might want

## The Fine-Tuning Process

The supervised fine-tuning process involves training model weights on a task-specific dataset.
The supervised fine-tuning process involves adjusting a model's weights on a task-specific dataset.

First, you'll need to prepare or select a dataset that represents your target task. This dataset should include diverse examples that cover the range of scenarios your model will encounter. The quality of this data is important - each example should demonstrate the kind of output you want your model to produce. Next comes the actual fine-tuning phase, where you'll use frameworks like Hugging Face's `transformers` and `trl` to train the model on your dataset.

Expand Down
23 changes: 14 additions & 9 deletions 2_preference_alignment/notebooks/dpo_finetuning_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"import os\n",
"from transformers import AutoModelForCausalLM, AutoTokenizer\n",
"from datasets import load_dataset\n",
"from trl import DPOTrainer, DPOConfig\n"
"from trl import DPOTrainer, DPOConfig"
]
},
{
Expand Down Expand Up @@ -122,9 +122,7 @@
"device = (\n",
" \"cuda\"\n",
" if torch.cuda.is_available()\n",
" else \"mps\"\n",
" if torch.backends.mps.is_available()\n",
" else \"cpu\"\n",
" else \"mps\" if torch.backends.mps.is_available() else \"cpu\"\n",
")\n",
"\n",
"# Model to fine-tune\n",
Expand Down Expand Up @@ -269,13 +267,20 @@
" # Use bfloat16 precision for faster training\n",
" bf16=True,\n",
" # Disable wandb/tensorboard logging\n",
" report_to=None,\n",
" report_to=\"none\",\n",
" # Keep all columns in dataset even if not used\n",
" remove_unused_columns=False,\n",
" # Enable MPS (Metal Performance Shaders) for Mac devices\n",
" use_mps_device=device == \"mps\",\n",
" # Model ID for HuggingFace Hub uploads\n",
" hub_model_id=finetune_name,\n",
" # DPO-specific temperature parameter that controls the strength of the preference model\n",
" # Lower values (like 0.1) make the model more conservative in following preferences\n",
" beta=0.1,\n",
" # Maximum length of the input prompt in tokens\n",
" max_prompt_length=1024,\n",
" # Maximum combined length of prompt + response in tokens\n",
" max_length=1536,\n",
")"
]
},
Expand All @@ -296,11 +301,11 @@
" processing_class=tokenizer,\n",
" # DPO-specific temperature parameter that controls the strength of the preference model\n",
" # Lower values (like 0.1) make the model more conservative in following preferences\n",
" #beta=0.1,\n",
" # beta=0.1,\n",
" # Maximum length of the input prompt in tokens\n",
" #max_prompt_length=1024,\n",
" # max_prompt_length=1024,\n",
" # Maximum combined length of prompt + response in tokens\n",
" #max_length=1536,\n",
" # max_length=1536,\n",
")"
]
},
Expand Down Expand Up @@ -357,7 +362,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.11.10"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
" # Gradual learning rate warmup\n",
" warmup_steps=10,\n",
" # Disable external logging\n",
" report_to=None,\n",
" report_to=\"none\",\n",
" # Where to save model/checkpoints\n",
" output_dir=\"./results/\",\n",
" # Enable MPS (Metal Performance Shaders) if available\n",
Expand Down
Loading