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

benchmark container on EC2 #2668

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lxning
Copy link
Contributor

@lxning lxning commented Jan 18, 2025

Description

This PR provides the tool for benchmarking container on EC2.

Brief description of what this PR is about

  • If this change is a backward incompatible change, why must this change be made?
  • Interesting edge cases to note here

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • Please add the link of Integration Tests Executor run with related tests.
  • Have you manually built the docker image and verify the change?
  • Have you run related tests? Check how to set up the test environment here; One example would be pytest tests.py -k "TestCorrectnessLmiDist" -m "lmi_dist"
  • Have you added tests that prove your fix is effective or that this feature works?
  • Has code been commented, particularly in hard-to-understand areas?
  • Have you made corresponding changes to the documentation?

Feature/Issue validation/testing

Please describe the Unit or Integration tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.

@lxning lxning requested review from zachgk and a team as code owners January 18, 2025 03:33
@lxning lxning self-assigned this Jan 18, 2025
@lxning lxning requested a review from siddvenk January 21, 2025 18:52
tests/integration/benchmark/llmperf/README.md Show resolved Hide resolved
docker_parameters:
["--runtime", "nvidia", "--gpus", "all", "--shm-size", "20g", "-v", "/home/ubuntu/.cache/huggingface:/tmp/.cache/huggingface", "-p", "8080:8000"]
server_parameters:
["--model", "meta-llama/Llama-3.1-8B-Instruct", "--disable-log-stats", "--disable-log-requests", "--gpu-memory-utilization=0.9", "-tp=2", "--num-scheduler-steps=10", "--max-num-seqs=512", "--swap-space=16", "--max-model-len=8192"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: newline

bash_command = ['bash', '-c', script, 'my_script', model, str(timeout)]
if run_bash_command(bash_command) is None:
logger.error(traceback.format_exc())
raise Exception("Failed at starting server within 2 hours")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use timeout/60 in this message instead of 2 hours?

Comment on lines +151 to +169
#!/bin/bash
MODEL_ID=$1
TIMEOUT=$2
start_time=$(date +%s)
end_time=$((start_time + $TIMEOUT))
while [ $(date +%s) -lt $end_time ]; do
filter="$(curl -s http://0.0.0.0:8080/v1/models |jq -e --arg expected "$MODEL_ID" '. != null and . != {} and has("data") and .data != null and (.data | length > 0) and (.data[].id | contains($expected))')"
if [ -z "$filter" ]; then
echo "Model $MODEL_ID is not available"
sleep 1m
else
echo "Model $MODEL_ID is available"
exit 0
fi
done

echo "Model $MODEL_ID is not available within 2 hours"
exit 1
'''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a blocker, but I think this would easier to maintain in a standalone bash script rather than inline in the python script.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, i see a few more inline bash scripts. I think some of them are pretty similar to other scripts we have, but would need to look into it.

I'm fine with this for now - we can look into organizing some of these scripts post this pr


try:
container_name = container["container"]
docker_command = f"docker run --name {container_name} --rm -e HUGGING_FACE_HUB_TOKEN={hf_token} {docker_parameters} --init {image} {server_parameters}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is HUGGING_FACE_HUB_TOKEN valid for all containers? HF docs show HF_TOKEN https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables#hftoken.

Maybe the containers differ in how they expect this value to be passed, should we include HF_TOKEN as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants