-
Notifications
You must be signed in to change notification settings - Fork 30
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
[Finetune] Add finetune Gaudi workflow #240
Open
Deegue
wants to merge
11
commits into
intel:main
Choose a base branch
from
Deegue:add_finetune_gaudi2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
aaa8a50
add finetune gaudi2 workflow
Deegue 50268df
add to workflow
Deegue df1cbc7
nit
Deegue f12fe5f
remove deltatuner
Deegue 18b94cd
Merge branch 'main' into add_finetune_gaudi2
Deegue 3ec0a3f
fix transformers
Deegue c63697a
remove deepspeed config file
Deegue 2bdc2d0
Merge branch 'main' into add_finetune_gaudi2
Deegue df3fe63
Merge branch 'main' into add_finetune_gaudi2
Deegue 741488a
Merge branch 'intel:main' into add_finetune_gaudi2
Deegue 7d37ea0
Merge branch 'main' into add_finetune_gaudi2
Deegue 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 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,102 @@ | ||
name: Finetune | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ci_type: | ||
type: string | ||
default: 'pr' | ||
runner_container_image: | ||
type: string | ||
default: '127.0.0.1:5000/llmray-build' | ||
runner_config_path: | ||
type: string | ||
default: '/home/ci/llm-ray-actions-runner' | ||
code_checkout_path: | ||
type: string | ||
default: '/home/ci/actions-runner/_work/llm-on-ray/llm-on-ray' | ||
model_cache_path: | ||
type: string | ||
default: '/scratch-2/huggingface/cache' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-ft-gaudi2 | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
finetune: | ||
name: finetune | ||
strategy: | ||
matrix: | ||
model: [ EleutherAI/gpt-j-6b, meta-llama/Llama-2-7b-chat-hf, gpt2, bigscience/bloom-560m, facebook/opt-125m, mosaicml/mpt-7b, meta-llama/Llama-2-7b-hf, mistralai/Mistral-7B-v0.1, google/gemma-2b] | ||
isPR: | ||
- ${{inputs.ci_type == 'pr'}} | ||
|
||
exclude: | ||
- { isPR: true } | ||
include: | ||
- { model: "EleutherAI/gpt-j-6b"} | ||
- { model: "meta-llama/Llama-2-7b-chat-hf"} | ||
- { model: "mistralai/Mistral-7B-v0.1"} | ||
- { model: "google/gemma-2b"} | ||
|
||
runs-on: gaudi2 | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
container: | ||
image: ${{ inputs.runner_container_image }} | ||
env: | ||
http_proxy: | ||
https_proxy: | ||
SHELL: bash -eo pipefail | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- ${{ inputs.runner_config_path }}:/root/actions-runner-config | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Load environment variables | ||
run: cat /root/actions-runner-config/.env >> $GITHUB_ENV | ||
|
||
- name: Build Docker Image | ||
run: | | ||
DF_SUFFIX=".habana" | ||
TARGET="finetune" | ||
source dev/scripts/ci-functions.sh | ||
build_and_prune_gaudi ${TARGET} ${DF_SUFFIX} | ||
|
||
- name: Start Docker Container | ||
run: | | ||
TARGET="finetune" | ||
code_checkout_path=${{ inputs.code_checkout_path }} | ||
model_cache_path=${{ inputs.model_cache_path }} | ||
source dev/scripts/ci-functions.sh | ||
start_docker_gaudi ${TARGET} ${code_checkout_path} ${model_cache_path} ${{env.HF_ACCESS_TOKEN}} | ||
|
||
- name: Run Finetune Test | ||
run: | | ||
TARGET="finetune" | ||
source dev/scripts/ci-functions.sh | ||
finetune_test_gaudi ${{ matrix.model }} | ||
|
||
- name: Run PEFT-LoRA Test | ||
run: | | ||
source dev/scripts/ci-functions.sh | ||
peft_lora_test_gaudi ${{ matrix.model }} | ||
|
||
- name: Stop Ray | ||
run: | | ||
TARGET="finetune" | ||
source dev/scripts/ci-functions.sh | ||
stop_ray ${TARGET} | ||
|
||
- name: Stop Container | ||
if: success() || failure() | ||
run: | | ||
TARGET="finetune" | ||
source dev/scripts/ci-functions.sh | ||
stop_container ${TARGET} |
This file contains 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 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 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 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,37 @@ | ||
General: | ||
base_model: EleutherAI/gpt-j-6b | ||
gpt_base_model: true | ||
output_dir: /tmp/llm-ray/output | ||
save_strategy: no | ||
config: | ||
trust_remote_code: false | ||
use_auth_token: null | ||
lora_config: | ||
task_type: CAUSAL_LM | ||
r: 8 | ||
lora_alpha: 32 | ||
lora_dropout: 0.1 | ||
enable_gradient_checkpointing: false | ||
Dataset: | ||
train_file: examples/data/sample_finetune_data_small.jsonl | ||
group: true | ||
max_length: 512 | ||
block_size: 512 | ||
shuffle: false | ||
validation_file: null | ||
validation_split_percentage: 5 | ||
Training: | ||
optimizer: adamw_torch | ||
batch_size: 2 | ||
epochs: 3 | ||
learning_rate: 1.0e-05 | ||
lr_scheduler: linear | ||
weight_decay: 0.0 | ||
mixed_precision: bf16 | ||
device: hpu | ||
num_training_workers: 2 | ||
resources_per_worker: | ||
CPU: 32 | ||
accelerate_mode: DDP | ||
gradient_accumulation_steps: 1 | ||
logging_steps: 10 |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need to duplicate code, could you merge this with build_and_prune