-
Notifications
You must be signed in to change notification settings - Fork 30.4k
Benchmarking v2 GH workflows #40716
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
base: main
Are you sure you want to change the base?
Benchmarking v2 GH workflows #40716
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
594ce6d
to
93d2a90
Compare
0b88e75
to
1deb38e
Compare
4857630
to
a985884
Compare
a985884
to
fdc4301
Compare
The workflow has been tested, and has a complete run here: |
cc @McPatate |
.github/workflows/benchmark_v2.yml
Outdated
description: 'Model ID to benchmark (e.g., meta-llama/Llama-2-7b-hf)' | ||
required: false | ||
type: string | ||
default: '' |
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.
Should we put a default for the model_id
?
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.
If there's no input provided here, it runs all the registered model, so an empty input is fine here. It's just for filtering purposes in case we need it for development.
.github/workflows/benchmark_v2.yml
Outdated
description: 'HuggingFace Dataset to upload results to (e.g., "org/benchmark-results")' | ||
required: false | ||
type: string | ||
default: '' |
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.
No default here as well?
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.
Currently all the vendors will have their own repos, so we can't really provide a sensible default here. (also wouldn't make sense to make it required in case push is disabled)
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.
@ArthurZucker do you have an input on this?
required: false | ||
type: string | ||
default: '' | ||
benchmark_repo_id: |
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.
Isn't this redundant with upload_to_hub
?
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.
Actually, the other has the wrong description, it's a boolean to toggle the upload on/off. Fixing it.
.github/workflows/benchmark_v2.yml
Outdated
if [ -n "${{ inputs.model_id }}" ]; then | ||
args="$args --model-id '${{ inputs.model_id }}'" | ||
fi |
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.
What would this default to if not specified?
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.
It'll run all the registered benchmarks.
push: | ||
branches: | ||
- run-benchmarking-gh-actions* |
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.
wouldn't using labels be easier?
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.
I just mirrored here what the test pipelines offer on this front.
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.
I think you can remove the branch trigger and use the same label as v1 bench:
on:
push:
branches: [main]
pull_request:
types: [ opened, labeled, reopened, synchronize ]
jobs:
benchmark:
name: Benchmark
if: |
(github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'run-benchmark') )||
(github.event_name == 'push' && github.ref == 'refs/heads/main')
steps:
# ...
cc @ArthurZucker wdyt?
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.
yep
python run_benchmarks.py --upload-to-hf username/benchmark-results | ||
|
||
# Upload with a custom run ID for easy identification | ||
python run_benchmarks.py --upload-to-hf username/benchmark-results --run-id experiment_v1 |
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.
Do we generate and print the run_id
if not provided by the user?
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.
run_id
in that case becomes the benchmark_id generated earlier.
github_run_number = os.getenv("GITHUB_RUN_NUMBER") | ||
github_run_id = os.getenv("GITHUB_RUN_ID") | ||
if github_run_number and github_run_id: | ||
run_id = f"{github_run_number}-{github_run_id}" |
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.
github_run_number = os.getenv("GITHUB_RUN_NUMBER") | |
github_run_id = os.getenv("GITHUB_RUN_ID") | |
if github_run_number and github_run_id: | |
run_id = f"{github_run_number}-{github_run_id}" | |
github_run_number = os.getenv("GITHUB_RUN_NUMBER") | |
github_run_id = os.getenv("GITHUB_RUN_ID") | |
if github_run_number and github_run_id: | |
run_id = f"{github_run_number}-{github_run_id}" | |
else: | |
run_id = uuid.uuid4() |
wdyt?
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.
or str(uuid.uuid4())[:8]
as you used below
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.
The else case is handled here with the benchmark ID:
https://github.com/huggingface/transformers/pull/40716/files#diff-94fe5532c68b73efc8544ea11c0fa4d90a1d3e9266a8f8ccee2389752cea3d7cR475-R482
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.
Happy to merge but usure about configuring stuff in the workflow, it looks pretty cumbersome, not really seeing the up here!
runner: amd-mi325-ci-1gpu | ||
warmup_iterations: ${{ inputs.warmup_iterations || 3 }} | ||
measurement_iterations: ${{ inputs.measurement_iterations || 5 }} | ||
num_tokens_to_generate: ${{ inputs.num_tokens_to_generate || 100 }} | ||
commit_sha: ${{ github.sha }} | ||
upload_to_hub: true | ||
run_id: ${{ github.run_id }} | ||
benchmark_repo_id: optimum-amd/transformers-daily-benchmarks |
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.
not 100% sure why we have to configure stuff via the workflow, when it seems to always use default
# Add iterations
args="$args --warmup-iterations ${{ inputs.warmup_iterations }}"
args="$args --measurement-iterations ${{ inputs.measurement_iterations }}"
args="$args --num-tokens-to-generate ${{ inputs.num_tokens_to_generate }}"
# Add commit ID if available
if [ -n "${{ inputs.commit_sha }}" ]; then
args="$args --commit-id '${{ inputs.commit_sha }}'"
elif [ -n "${{ github.sha }}" ]; then
args="$args --commit-id '${{ github.sha }}'"
fi
# Add HuggingFace upload parameters if specified
if [ -n "${{ inputs.upload_to_hub }}" ]; then
args="$args --upload-to-hub '${{ inputs.upload_to_hub }}'"
fi
if [ -n "${{ inputs.run_id }}" ]; then
args="$args --run-id '${{ inputs.run_id }}'"
fi
seems like a wast but I am probably missing certain usage?
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.
I removed it from the top-level, we don't really need it there. The idea is that this way we can easily implement an "important models " benchmark pipeline that runs on the subset of models, and possibly more often. Now, this might happen, might not later. I'm happy to remove the option if it looks cleaner that way.
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.
yep let's remove for now 🤗
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.
Alright, removed them.
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.
lgtm otherwise, will let @McPatate handle the finish!
- name: Install benchmark dependencies | ||
run: | | ||
python3 -m pip install -r benchmark_v2/requirements.txt |
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.
we would like to have a docker with all of these IMO! only "re install" the latest updates
push: | ||
branches: | ||
- run-benchmarking-gh-actions* |
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.
yep
What does this PR do?
This PR is a follow-up to #40486 that adds the workflows and HF Datasets upload to start collecting data.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.