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
feat: enabling AutoML Forecasting training response to include BigQuery location of exported evaluated examples #657
Changes from 11 commits
66b565d
b899511
c225ac7
29e32bf
4dfb8b9
bf869b6
fca235b
e519e64
73bd6b1
ef03a20
c236824
9af9db9
31d0622
a8c10bb
dd30216
1e11c5c
b1c3e79
5583190
66d3b62
3d78777
fed80c6
cbf044d
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 |
---|---|---|
|
@@ -562,7 +562,7 @@ def _run_job( | |
annotation_schema_uri: Optional[str] = None, | ||
model: Optional[gca_model.Model] = None, | ||
gcs_destination_uri_prefix: Optional[str] = None, | ||
bigquery_destination: Optional[str] = None, | ||
bigquery_destination: Optional[str] = None | ||
) -> Optional[models.Model]: | ||
"""Runs the training job. | ||
|
||
|
@@ -778,7 +778,7 @@ def state(self) -> Optional[gca_pipeline_state.PipelineState]: | |
|
||
self._sync_gca_resource() | ||
return self._gca_resource.state | ||
|
||
def get_model(self, sync=True) -> models.Model: | ||
"""Vertex AI Model produced by this training, if one was produced. | ||
|
||
|
@@ -4119,17 +4119,22 @@ def _run( | |
labels=model_labels or self._labels, | ||
) | ||
|
||
return self._run_job( | ||
new_model = self._run_job( | ||
training_task_definition=training_task_definition, | ||
training_task_inputs=training_task_inputs_dict, | ||
dataset=dataset, | ||
training_fraction_split=None, | ||
validation_fraction_split=None, | ||
test_fraction_split=None, | ||
predefined_split_column_name=predefined_split_column_name, | ||
model=model, | ||
model=model | ||
) | ||
|
||
if export_evaluated_data_items: | ||
_LOGGER.info("Exported examples available at:\n%s" % self.evaluated_data_items_bigquery_uri) | ||
|
||
return new_model | ||
|
||
@property | ||
def _model_upload_fail_string(self) -> str: | ||
"""Helper property for model upload failure.""" | ||
|
@@ -4138,6 +4143,23 @@ def _model_upload_fail_string(self) -> str: | |
"Model." | ||
) | ||
|
||
@property | ||
def evaluated_data_items_bigquery_uri(self) -> Optional[str]: | ||
"""BigQuery location of exported evaluated examples from the Training Job""" | ||
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. Raises section. 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. No longer needed. |
||
|
||
self._assert_gca_resource_is_available() | ||
|
||
try: | ||
meta = getattr((self._gca_resource), "training_task_metadata") | ||
except ValueError: | ||
raise ValueError("BigQuery uri for evaluated data items does not exist. Must export evaluated data items during training.") | ||
|
||
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. This can be removed as the try/except below already covers the logic. 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. Removed try/except block. |
||
try: | ||
metadata = self._gca_resource.training_task_metadata | ||
return metadata["evaluatedDataItemsBigqueryUri"] | ||
except (AttributeError, KeyError): | ||
raise ValueError("BigQuery URI for evaluated data items does not exist. Must export evaluated data items during training.") | ||
|
||
def _add_additional_experiments(self, additional_experiments: List[str]): | ||
"""Add experiment flags to the training job. | ||
Args: | ||
|
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.
What are the scenarios where this method:
str
None
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.
Updated the method doc string.