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

fix benchmark feature read-only apis #4675

Conversation

makungaj1
Copy link
Collaborator

@makungaj1 makungaj1 commented May 10, 2024

Issue #, if available:

Description of changes:

jumpstart_model = JumpStartModel(model_id="meta-textgeneration-llama-3-8b")
jumpstart_model.list_deployment_configs()

[{'DeploymentConfigName': 'lmi-accelerated',
  'DeploymentArgs': {'ImageUri': '763104351884.dkr.ecr.us-west-2.amazonaws.com/djl-inference:0.27.0-deepspeed0.12.6-cu121',
   'ModelData': {'S3DataSource': {'S3Uri': 's3://jumpstart-private-cache-prod-us-west-2/meta-textgeneration/meta-textgeneration-llama-3-8b/artifacts/inference-prepack/v1.0.0/',
     'S3DataType': 'S3Prefix',
     'CompressionType': 'None'}},
   'Environment': {'SAGEMAKER_PROGRAM': 'inference.py',
    'ENDPOINT_SERVER_TIMEOUT': '3600',
    'MODEL_CACHE_ROOT': '/opt/ml/model',
    'SAGEMAKER_ENV': '1',
    'HF_MODEL_ID': '/opt/ml/model',
    'SERVING_LOAD_MODELS': 'test::MPI=/opt/ml/model',
    'OPTION_MODEL_ID': '/opt/ml/model',
    'OPTION_SPECULATIVE_DRAFT_MODEL': 'sagemaker',
    'OPTION_TENSOR_PARALLEL_DEGREE': 'max',
    'OPTION_MAX_ROLLING_BATCH_SIZE': '64',
    'OPTION_ROLLING_BATCH': 'lmi-dist',
    'OPTION_GPU_MEMORY_UTILIZATION': '0.8',
    'SAGEMAKER_MODEL_SERVER_WORKERS': '1'},
   'InstanceType': 'ml.g5.2xlarge',
   'ComputeResourceRequirements': {'MinMemoryRequiredInMb': 98304,
    'NumberOfAcceleratorDevicesRequired': 4},
   'ModelDataDownloadTimeout': 1200,
   'ContainerStartupHealthCheckTimeout': 1200},
  'AccelerationConfigs': None,
  'BenchmarkMetrics': {'ml.g5.2xlarge': [{'name': 'Latency',
     'value': '12',
     'unit': 'ms/token',
     'concurrency': '1'},
    {'name': 'Throughput',
     'value': '213',
     'unit': 'tokens/sec',
     'concurrency': '1'},
    {'name': 'Latency', 'value': '12', 'unit': 'ms/token', 'concurrency': '2'},
    {'name': 'Throughput',
     'value': '213',
     'unit': 'tokens/sec',
     'concurrency': '2'},
    {'name': 'Instance Rate',
     'value': '1.515',
     'unit': 'USD/Hrs',
     'concurrency': None}]}},
 {'DeploymentConfigName': 'lmi',
  'DeploymentArgs': {'ImageUri': '763104351884.dkr.ecr.us-west-2.amazonaws.com/djl-inference:0.27.0-deepspeed0.12.6-cu121',
   'ModelData': {'S3DataSource': {'S3Uri': 's3://jumpstart-private-cache-prod-us-west-2/meta-textgeneration/meta-textgeneration-llama-3-8b/artifacts/inference-prepack/v1.0.0/',
     'S3DataType': 'S3Prefix',
     'CompressionType': 'None'}},
   'Environment': {'SAGEMAKER_PROGRAM': 'inference.py',
    'ENDPOINT_SERVER_TIMEOUT': '3600',
    'MODEL_CACHE_ROOT': '/opt/ml/model',
    'SAGEMAKER_ENV': '1',
    'HF_MODEL_ID': '/opt/ml/model',
    'SERVING_LOAD_MODELS': 'test::MPI=/opt/ml/model',
    'OPTION_MODEL_ID': '/opt/ml/model',
    'OPTION_SPECULATIVE_DRAFT_MODEL': 'sagemaker',
    'OPTION_TENSOR_PARALLEL_DEGREE': 'max',
    'OPTION_MAX_ROLLING_BATCH_SIZE': '64',
    'OPTION_ROLLING_BATCH': 'lmi-dist',
    'OPTION_GPU_MEMORY_UTILIZATION': '0.8',
    'SAGEMAKER_MODEL_SERVER_WORKERS': '1'},
   'InstanceType': 'ml.g5.2xlarge',
   'ComputeResourceRequirements': {'MinMemoryRequiredInMb': 98304,
    'NumberOfAcceleratorDevicesRequired': 4},
   'ModelDataDownloadTimeout': 1200,
   'ContainerStartupHealthCheckTimeout': 1200},
  'AccelerationConfigs': None,
  'BenchmarkMetrics': {'ml.g5.2xlarge': [{'name': 'Latency',
     'value': '36',
     'unit': 'ms/token',
     'concurrency': '1'},
    {'name': 'Throughput',
     'value': '390',
     'unit': 'tokens/sec',
     'concurrency': '1'},
    {'name': 'Latency', 'value': '36', 'unit': 'ms/token', 'concurrency': '2'},
    {'name': 'Throughput',
     'value': '390',
     'unit': 'tokens/sec',
     'concurrency': '2'},
    {'name': 'Instance Rate',
     'value': '1.515',
     'unit': 'USD/Hrs',
     'concurrency': None}]}},
 {'DeploymentConfigName': 'lmi-trtllm',
  'DeploymentArgs': {'ImageUri': '763104351884.dkr.ecr.us-west-2.amazonaws.com/djl-inference:0.27.0-deepspeed0.12.6-cu121',
   'ModelData': {'S3DataSource': {'S3Uri': 's3://jumpstart-private-cache-prod-us-west-2/meta-textgeneration/meta-textgeneration-llama-3-8b/artifacts/inference-prepack/v1.0.0/',
     'S3DataType': 'S3Prefix',
     'CompressionType': 'None'}},
   'Environment': {'SAGEMAKER_PROGRAM': 'inference.py',
    'ENDPOINT_SERVER_TIMEOUT': '3600',
    'MODEL_CACHE_ROOT': '/opt/ml/model',
    'SAGEMAKER_ENV': '1',
    'HF_MODEL_ID': '/opt/ml/model',
    'SERVING_LOAD_MODELS': 'test::MPI=/opt/ml/model',
    'OPTION_MODEL_ID': '/opt/ml/model',
    'OPTION_SPECULATIVE_DRAFT_MODEL': 'sagemaker',
    'OPTION_TENSOR_PARALLEL_DEGREE': 'max',
    'OPTION_MAX_ROLLING_BATCH_SIZE': '64',
    'OPTION_ROLLING_BATCH': 'lmi-dist',
    'OPTION_GPU_MEMORY_UTILIZATION': '0.8',
    'SAGEMAKER_MODEL_SERVER_WORKERS': '1'},
   'InstanceType': 'ml.g5.2xlarge',
   'ComputeResourceRequirements': {'MinMemoryRequiredInMb': 98304,
    'NumberOfAcceleratorDevicesRequired': 4},
   'ModelDataDownloadTimeout': 1200,
   'ContainerStartupHealthCheckTimeout': 1200},
  'AccelerationConfigs': None,
  'BenchmarkMetrics': None},
 {'DeploymentConfigName': 'tgi',
  'DeploymentArgs': {'ImageUri': '763104351884.dkr.ecr.us-west-2.amazonaws.com/djl-inference:0.27.0-deepspeed0.12.6-cu121',
   'ModelData': {'S3DataSource': {'S3Uri': 's3://jumpstart-private-cache-prod-us-west-2/meta-textgeneration/meta-textgeneration-llama-3-8b/artifacts/inference-prepack/v1.0.0/',
     'S3DataType': 'S3Prefix',
     'CompressionType': 'None'}},
   'Environment': {'SAGEMAKER_PROGRAM': 'inference.py',
    'ENDPOINT_SERVER_TIMEOUT': '3600',
    'MODEL_CACHE_ROOT': '/opt/ml/model',
    'SAGEMAKER_ENV': '1',
    'HF_MODEL_ID': '/opt/ml/model',
    'SERVING_LOAD_MODELS': 'test::MPI=/opt/ml/model',
    'OPTION_MODEL_ID': '/opt/ml/model',
    'OPTION_SPECULATIVE_DRAFT_MODEL': 'sagemaker',
    'OPTION_TENSOR_PARALLEL_DEGREE': 'max',
    'OPTION_MAX_ROLLING_BATCH_SIZE': '64',
    'OPTION_ROLLING_BATCH': 'lmi-dist',
    'OPTION_GPU_MEMORY_UTILIZATION': '0.8',
    'SAGEMAKER_MODEL_SERVER_WORKERS': '1'},
   'InstanceType': 'ml.g5.2xlarge',
   'ComputeResourceRequirements': {'MinMemoryRequiredInMb': 98304,
    'NumberOfAcceleratorDevicesRequired': 4},
   'ModelDataDownloadTimeout': 1200,
   'ContainerStartupHealthCheckTimeout': 1200},
  'AccelerationConfigs': None,
  'BenchmarkMetrics': None}]
jumpstart_model.deployment_config

{'DeploymentConfigName': 'lmi-accelerated',
 'DeploymentArgs': {'ImageUri': '763104351884.dkr.ecr.us-west-2.amazonaws.com/djl-inference:0.27.0-deepspeed0.12.6-cu121',
  'ModelData': {'S3DataSource': {'S3Uri': 's3://jumpstart-private-cache-prod-us-west-2/meta-textgeneration/meta-textgeneration-llama-3-8b/artifacts/inference-prepack/v1.0.0/',
    'S3DataType': 'S3Prefix',
    'CompressionType': 'None'}},
  'Environment': {'SAGEMAKER_PROGRAM': 'inference.py',
   'ENDPOINT_SERVER_TIMEOUT': '3600',
   'MODEL_CACHE_ROOT': '/opt/ml/model',
   'SAGEMAKER_ENV': '1',
   'HF_MODEL_ID': '/opt/ml/model',
   'SERVING_LOAD_MODELS': 'test::MPI=/opt/ml/model',
   'OPTION_MODEL_ID': '/opt/ml/model',
   'OPTION_SPECULATIVE_DRAFT_MODEL': 'sagemaker',
   'OPTION_TENSOR_PARALLEL_DEGREE': 'max',
   'OPTION_MAX_ROLLING_BATCH_SIZE': '64',
   'OPTION_ROLLING_BATCH': 'lmi-dist',
   'OPTION_GPU_MEMORY_UTILIZATION': '0.8',
   'SAGEMAKER_MODEL_SERVER_WORKERS': '1'},
  'InstanceType': 'ml.g5.2xlarge',
  'ComputeResourceRequirements': {'MinMemoryRequiredInMb': 98304,
   'NumberOfAcceleratorDevicesRequired': 4},
  'ModelDataDownloadTimeout': 1200,
  'ContainerStartupHealthCheckTimeout': 1200},
 'AccelerationConfigs': None,
 'BenchmarkMetrics': {'ml.g5.2xlarge': [{'name': 'Latency',
    'value': '12',
    'unit': 'ms/token',
    'concurrency': '1'},
   {'name': 'Throughput',
    'value': '213',
    'unit': 'tokens/sec',
    'concurrency': '1'},
   {'name': 'Latency', 'value': '12', 'unit': 'ms/token', 'concurrency': '2'},
   {'name': 'Throughput',
    'value': '213',
    'unit': 'tokens/sec',
    'concurrency': '2'},
   {'name': 'Instance Rate',
    'value': '1.515',
    'unit': 'USD/Hrs',
    'concurrency': None}]}}
jumpstart_model.display_benchmark_metrics()

| Instance Type           |   Concurrent Users | Config Name     |   Latency for each user (TTFT in ms) |   Throughput per user (token/seconds) |   Instance Rate (USD/Hrs) |
|:------------------------|-------------------:|:----------------|-------------------------------------:|--------------------------------------:|--------------------------:|
| ml.g5.2xlarge (Default) |                  1 | lmi-accelerated |                                   12 |                                   213 |                     1.515 |
| ml.g5.2xlarge           |                  2 | lmi-accelerated |                                   12 |                                   213 |                     1.515 |
| ml.g5.2xlarge           |                  1 | lmi             |                                   36 |                                   390 |                     1.515 |
| ml.g5.2xlarge           |                  2 | lmi             |                                   36 |                                   390 |                     1.515 |
| ml.g5.12xlarge          |                  1 | lmi             |                                   14 |                                   651 |                     7.09  |
| ml.g5.12xlarge          |                  2 | lmi             |                                   14 |                                   651 |                     7.09  |
| ml.p4d.24xlarge         |                  1 | lmi             |                                    7 |                                  2274 |                    38.67  |
| ml.p4d.24xlarge         |                  2 | lmi             |                                    7 |                                  2274 |                    38.67  |

Testing done:

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

  • [x ] I have read the CONTRIBUTING doc
  • [x ] I certify that the changes I am introducing will be backward compatible, and I have discussed concerns about this, if any, with the Python SDK team
  • [ x] I used the commit message format described in CONTRIBUTING
  • [x ] I have passed the region in to all S3 and STS clients that I've initialized as part of this change.
  • [x ] I have updated any necessary documentation, including READMEs and API docs (if appropriate)

Tests

  • [ x] I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • [x ] I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes
  • [x ] I have checked that my tests are not configured for a specific region or account (if appropriate)
  • [x ] I have used unique_name_from_base to create resource names in integ tests (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@makungaj1 makungaj1 marked this pull request as ready for review May 10, 2024 21:52
@makungaj1 makungaj1 requested a review from a team as a code owner May 10, 2024 21:52
@makungaj1 makungaj1 requested review from ptkab and removed request for a team May 10, 2024 21:52
str: Normalized metric column name.
"""
if "latency" in name.lower():
name = "Latency for each user (TTFT in ms)"
Copy link

Choose a reason for hiding this comment

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

could we use the metric unit from metadata directly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can, only if it's updated to the desired. Here is what's now

{
                        "name": "latency",
                        "value": "36",
                        "unit": "ms/token",
                        "concurrency": "2"
},

@liujiaorr liujiaorr merged commit 149edb7 into aws:master-benchmark-feature May 22, 2024
11 checks passed
@makungaj1 makungaj1 deleted the master-benchmark-feature-concurrency branch May 23, 2024 03:41
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.

None yet

3 participants