generated from amazon-archives/__template_Apache-2.0
-
Couldn't load subscription status.
- Fork 57
fix: update how default payloads get extracted from model spec #309
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
66e45bf
fix: update how default payloads get extracted from model spec
3ccacef
Add validation and new unit test for model without default payloads
848bb9a
Move jumpstart extractor test case for mistral model into integ tests
de37d22
Move another test case to integ tests
292347a
Add another unit test for 100% coverage
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,42 @@ | ||
| import pytest | ||
|
|
||
| from fmeval.constants import MIME_TYPE_JSON | ||
| from fmeval.exceptions import EvalAlgorithmClientError | ||
| from fmeval.model_runners.extractors import create_extractor, JumpStartExtractor | ||
|
|
||
|
|
||
| class TestCreateExtractor: | ||
| """ | ||
| These tests are under integration tests instead of unit tests because | ||
| credentials are required to call the JumpStart util function | ||
| verify_model_region_and_return_specs. | ||
|
|
||
| See test/unit/model_runners/extractors/test_create_extractor.py | ||
| for corresponding unit tests. | ||
| """ | ||
|
|
||
| def test_create_extractor_jumpstart(self): | ||
| """ | ||
| GIVEN a model whose default payloads are not found at the top level of | ||
| the model spec, but instead nested under the inference_configs attribute. | ||
| WHEN create_extractor is called with this model id. | ||
| THEN a JumpStartExtractor is successfully created for this model. | ||
| """ | ||
| # default payloads found in inference_component_configs | ||
| jumpstart_model_id = "huggingface-llm-mistral-7b" | ||
| assert isinstance( | ||
| create_extractor(model_accept_type=MIME_TYPE_JSON, jumpstart_model_id=jumpstart_model_id), | ||
| JumpStartExtractor, | ||
| ) | ||
|
|
||
| def test_create_extractor_jumpstart_no_default_payloads(self): | ||
| """ | ||
| GIVEN a model whose spec does not contain default payloads data anywhere. | ||
| WHEN a create_extractor is called with this model id. | ||
| THEN the correct exception is raised. | ||
| """ | ||
| with pytest.raises( | ||
| EvalAlgorithmClientError, | ||
| match="JumpStart Model: xgboost-regression-snowflake is not supported at this time", | ||
| ): | ||
| create_extractor(model_accept_type=MIME_TYPE_JSON, jumpstart_model_id="xgboost-regression-snowflake") |
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
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.
Uh oh!
There was an error while loading. Please reload this page.