-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore: emit warning when no instance specific gated training env var is available, and raise exception when accept_eula flag is not supplied #4485
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
Changes from 2 commits
c554a9f
4656cb8
03b2c9c
e239779
8bc10e8
8fffcc9
bf0bc96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -956,6 +956,10 @@ def use_training_model_artifact(self) -> bool: | |
# otherwise, return true is a training model package is not set | ||
return len(self.training_model_package_artifact_uris or {}) == 0 | ||
|
||
def is_gated_model(self) -> bool: | ||
"""Returns True if the model has a EULA key or the model bucket is gated.""" | ||
return self.gated_bucket or self.hosting_eula_key is not None | ||
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. hum, this is odd, shouldn't the pySDK only us Isn't it MH's unit test job to ensure that if 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. We don't have a unit test for this (tho we should). It was confusing (at least for me) to refer to gated buckets and hosting eula keys separately, so to clear the confusion i created this helper function to clarify these are the markers for gated models (if the bucket is gated or there's a eula key). |
||
|
||
def supports_incremental_training(self) -> bool: | ||
"""Returns True if the model supports incremental training.""" | ||
return self.incremental_training_supported | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -466,21 +466,25 @@ def update_inference_tags_with_jumpstart_training_tags( | |
return inference_tags | ||
|
||
|
||
def get_eula_message(model_specs: JumpStartModelSpecs, region: str) -> str: | ||
"""Returns EULA message to display to customers if one is available, else empty string.""" | ||
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. remove 'to customers' from docstring. |
||
if model_specs.hosting_eula_key is None: | ||
return "" | ||
return ( | ||
f"Model '{model_specs.model_id}' requires accepting end-user license agreement (EULA). " | ||
f"See https://{get_jumpstart_content_bucket(region=region)}.s3.{region}." | ||
f"amazonaws.com{'.cn' if region.startswith('cn-') else ''}" | ||
f"/{model_specs.hosting_eula_key} for terms of use." | ||
) | ||
|
||
|
||
def emit_logs_based_on_model_specs( | ||
model_specs: JumpStartModelSpecs, region: str, s3_client: boto3.client | ||
) -> None: | ||
"""Emits logs based on model specs and region.""" | ||
|
||
if model_specs.hosting_eula_key: | ||
constants.JUMPSTART_LOGGER.info( | ||
"Model '%s' requires accepting end-user license agreement (EULA). " | ||
"See https://%s.s3.%s.amazonaws.com%s/%s for terms of use.", | ||
model_specs.model_id, | ||
get_jumpstart_content_bucket(region=region), | ||
region, | ||
".cn" if region.startswith("cn-") else "", | ||
model_specs.hosting_eula_key, | ||
) | ||
constants.JUMPSTART_LOGGER.info(get_eula_message(model_specs, region)) | ||
|
||
full_version: str = model_specs.version | ||
|
||
|
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.
Question: shouldn't this be the outer
if
statement here? And we would throw an error in all of the cases (theenvironment
does not contain the special key,accept_eula
is missing,accept_eula
is false, etc.)?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'd rather make the conditions as specific as possible. Maybe we'll change how we launch gated models in the future.
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.
+1, this is odd, why bother retrieving the specs if you're not going to use 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.
fwiw, this won't involve another s3 call, it's just reading from memory