-
Notifications
You must be signed in to change notification settings - Fork 52
[WIP][AQUA] GPU Shape Recommendation #1221
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
Open
elizjo
wants to merge
9
commits into
main
Choose a base branch
from
ODSC-74228/GPU-Shape-Recommendation
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.
+3,200
−51
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
18a92c4
inital code for GPU Shape Recommendator
elizjo bd026e7
modifications to handler
elizjo 4461af7
init implementation for gpu recommendations
elizjo 26e08a2
fixed docstrings and unused imports
elizjo 7ce57c8
added unit tests
elizjo a17b035
added rich diff table
elizjo e94b6f1
fixed unit tests
elizjo fbfdb91
Merge branch 'main' into ODSC-74228/GPU-Shape-Recommendation
mrDzurb ba605ee
addressed comments, fixed rich diff table
elizjo 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,47 @@ | ||
from tornado.web import HTTPError | ||
|
||
from ads.aqua.common.decorator import handle_exceptions | ||
from ads.aqua.extension.base_handler import AquaAPIhandler | ||
from ads.aqua.extension.errors import Errors | ||
from ads.aqua.shaperecommend.recommend import AquaRecommendApp | ||
from ads.config import COMPARTMENT_OCID | ||
|
||
|
||
class AquaRecommendHandler(AquaAPIhandler): | ||
""" | ||
Handler for Aqua GPU Recommendation REST APIs. | ||
|
||
Methods | ||
------- | ||
post(self, *args, **kwargs) | ||
Obtains the eligible compute shapes that would fit the specifed model, context length, model weights, and quantization level. | ||
|
||
Raises | ||
------ | ||
HTTPError: For various failure scenarios such as invalid input format, missing data, etc. | ||
""" | ||
|
||
@handle_exceptions | ||
def post(self, *args, **kwargs): # noqa: ARG002 | ||
""" | ||
Obtains the eligible compute shapes that would fit the specifed model, context length, model weights, and quantization level. | ||
|
||
Returns | ||
------- | ||
ShapeRecommendationReport | ||
Report containing shape recommendations and troubleshooting advice, if any. | ||
""" | ||
try: | ||
input_data = self.get_json_body() | ||
except Exception as ex: | ||
raise HTTPError(400, Errors.INVALID_INPUT_DATA_FORMAT) from ex | ||
|
||
if not input_data: | ||
raise HTTPError(400, Errors.NO_INPUT_DATA) | ||
|
||
self.finish(AquaRecommendApp().which_gpu(**input_data)) | ||
|
||
|
||
__handlers__ = [ | ||
("recommendation/?([^/]*)", AquaRecommendHandler), | ||
] |
This file contains hidden or 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 |
---|---|---|
@@ -1,94 +1,152 @@ | ||
{ | ||
"shapes": { | ||
"BM.GPU.A10.4": { | ||
"gpu_count": 4, | ||
"gpu_memory_in_gbs": 96, | ||
"gpu_type": "A10" | ||
"BM.GPU.H200.8": { | ||
"gpu_count": 8, | ||
"gpu_memory_in_gbs": 1128, | ||
"gpu_type": "H200", | ||
"quantization": ["awq", "gptq", "marlin", "fp8", "int8", "bitblas", "aqlm", "bitsandbytes", "deepspeedfp", "gguf"], | ||
"ranking": { | ||
"cost": 100, | ||
"performance": 110 | ||
} | ||
}, | ||
"BM.GPU.A100-V2.8": { | ||
"BM.GPU.H100.8": { | ||
"gpu_count": 8, | ||
"gpu_memory_in_gbs": 640, | ||
"gpu_type": "A100" | ||
"gpu_type": "H100", | ||
"quantization": ["awq", "gptq", "marlin", "fp8", "int8", "bitblas", "aqlm", "bitsandbytes", "deepspeedfp", "gguf"], | ||
"ranking": { | ||
"cost": 100, | ||
"performance": 100 | ||
} | ||
}, | ||
"BM.GPU.B4.8": { | ||
"BM.GPU.MI300X.8": { | ||
"gpu_count": 8, | ||
"gpu_memory_in_gbs": 320, | ||
"gpu_type": "A100" | ||
"gpu_memory_in_gbs": 1536, | ||
"gpu_type": "MI300X", | ||
"quantization": ["fp8", "gguf"], | ||
"ranking": { | ||
"cost": 90, | ||
"performance": 90 | ||
} | ||
}, | ||
"BM.GPU.H100.8": { | ||
"BM.GPU.A100-V2.8": { | ||
"gpu_count": 8, | ||
"gpu_memory_in_gbs": 640, | ||
"gpu_type": "H100" | ||
"gpu_type": "A100", | ||
"quantization": ["awq", "gptq", "marlin", "int8", "bitblas", "aqlm", "bitsandbytes", "deepspeedfp", "gguf"], | ||
"ranking": { | ||
"cost": 80, | ||
"performance": 70 | ||
} | ||
}, | ||
"BM.GPU.H200.8": { | ||
"BM.GPU.B4.8": { | ||
"gpu_count": 8, | ||
"gpu_memory_in_gbs": 1128, | ||
"gpu_type": "H200" | ||
"gpu_memory_in_gbs": 320, | ||
"gpu_type": "A100", | ||
"quantization": ["awq", "gptq", "marlin", "int8", "bitblas", "aqlm", "bitsandbytes", "deepspeedfp", "gguf"], | ||
"ranking": { | ||
"cost": 70, | ||
"performance": 60 | ||
} | ||
}, | ||
"BM.GPU.L40S-NC.4": { | ||
"gpu_count": 4, | ||
"gpu_memory_in_gbs": 192, | ||
"gpu_type": "L40S" | ||
"gpu_type": "L40S", | ||
"quantization": ["awq", "gptq", "marlin", "fp8", "int8", "bitblas", "aqlm", "bitsandbytes", "deepspeedfp", "gguf"], | ||
"ranking": { | ||
"cost": 60, | ||
"performance": 80 | ||
} | ||
}, | ||
"BM.GPU.L40S.4": { | ||
"gpu_count": 4, | ||
"gpu_memory_in_gbs": 192, | ||
"gpu_type": "L40S" | ||
}, | ||
"BM.GPU.MI300X.8": { | ||
"gpu_count": 8, | ||
"gpu_memory_in_gbs": 1536, | ||
"gpu_type": "MI300X" | ||
}, | ||
"BM.GPU2.2": { | ||
"gpu_count": 2, | ||
"gpu_memory_in_gbs": 32, | ||
"gpu_type": "P100" | ||
}, | ||
"BM.GPU3.8": { | ||
"gpu_count": 8, | ||
"gpu_memory_in_gbs": 128, | ||
"gpu_type": "V100" | ||
}, | ||
"BM.GPU4.8": { | ||
"gpu_count": 8, | ||
"gpu_memory_in_gbs": 320, | ||
"gpu_type": "A100" | ||
"gpu_type": "L40S", | ||
"quantization": ["awq", "gptq", "marlin", "fp8", "int8", "bitblas", "aqlm", "bitsandbytes", "deepspeedfp", "gguf"], | ||
"ranking": { | ||
"cost": 60, | ||
"performance": 80 | ||
} | ||
}, | ||
"VM.GPU.A10.1": { | ||
"gpu_count": 1, | ||
"gpu_memory_in_gbs": 24, | ||
"gpu_type": "A10" | ||
"gpu_type": "A10", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add FP8 for the A10 shapes as well. |
||
"quantization": ["awq", "gptq", "marlin", "int8", "bitblas", "aqlm", "bitsandbytes", "deepspeedfp", "gguf"], | ||
"ranking" : { | ||
"cost": 20, | ||
"performance": 30 | ||
} | ||
}, | ||
"VM.GPU.A10.2": { | ||
"gpu_count": 2, | ||
"gpu_memory_in_gbs": 48, | ||
"gpu_type": "A10" | ||
"gpu_type": "A10", | ||
"quantization": ["awq", "gptq", "marlin", "int8", "bitblas", "aqlm", "bitsandbytes", "deepspeedfp", "gguf"], | ||
"ranking" : { | ||
"cost": 40, | ||
"performance": 40 | ||
} | ||
}, | ||
"VM.GPU.A10.4": { | ||
"BM.GPU.A10.4": { | ||
"gpu_count": 4, | ||
"gpu_memory_in_gbs": 96, | ||
"gpu_type": "A10" | ||
"gpu_type": "A10", | ||
"quantization": ["awq", "gptq", "marlin", "int8", "bitblas", "aqlm", "bitsandbytes", "deepspeedfp", "gguf"], | ||
"ranking" : { | ||
"cost": 50, | ||
"performance": 50 | ||
} | ||
}, | ||
"BM.GPU2.2": { | ||
"gpu_count": 2, | ||
"gpu_memory_in_gbs": 32, | ||
"gpu_type": "P100", | ||
"quantization": ["fp16"], | ||
"ranking": { | ||
"cost": 30, | ||
"performance": 20 | ||
} | ||
}, | ||
"VM.GPU2.1": { | ||
"gpu_count": 1, | ||
"gpu_memory_in_gbs": 16, | ||
"gpu_type": "P100" | ||
"gpu_type": "P100", | ||
"quantization": ["fp16"], | ||
"ranking": { | ||
"cost": 10, | ||
"performance": 10 | ||
} | ||
}, | ||
"VM.GPU3.1": { | ||
"gpu_count": 1, | ||
"gpu_memory_in_gbs": 16, | ||
"gpu_type": "V100" | ||
"gpu_type": "V100", | ||
"quantization" : ["gptq", "bitblas", "aqlm", "bitsandbytes", "deepspeedfp", "gguf"], | ||
"ranking" : { | ||
"cost": 35, | ||
"performance": 10 | ||
} | ||
}, | ||
"VM.GPU3.2": { | ||
"gpu_count": 2, | ||
"gpu_memory_in_gbs": 32, | ||
"gpu_type": "V100" | ||
"gpu_type": "V100", | ||
"ranking" : { | ||
"cost": 45, | ||
"performance": 20 | ||
} | ||
}, | ||
"VM.GPU3.4": { | ||
"gpu_count": 4, | ||
"gpu_memory_in_gbs": 64, | ||
"gpu_type": "V100" | ||
"gpu_type": "V100", | ||
"ranking" : { | ||
"cost": 55, | ||
"performance": 45 | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or 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,6 @@ | ||
#!/usr/bin/env python | ||
# Copyright (c) 2025 Oracle and/or its affiliates. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ | ||
from ads.aqua.shaperecommend.recommend import AquaRecommendApp | ||
|
||
__all__ = ["AquaRecommendApp"] |
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.
Maybe we can name it as
__shape_handler
?