mirror of
https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
synced 2026-09-26 22:51:56 +00:00
Compare commits
33
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13981c74c4 | ||
|
|
596ee7eda2 | ||
|
|
04bf8f9e2a | ||
|
|
0b3bf412c3 | ||
|
|
b5d19719e0 | ||
|
|
59536e9e61 | ||
|
|
7d74bc3caa | ||
|
|
b5b65198a6 | ||
|
|
3a5a14f1d8 | ||
|
|
157f8538ed | ||
|
|
532bf04933 | ||
|
|
99547ccb73 | ||
|
|
2e0cd74533 | ||
|
|
b9a9d76e8b | ||
|
|
fb61e0631c | ||
|
|
16c38c8fbf | ||
|
|
8888e8ad7f | ||
|
|
c787a0e99e | ||
|
|
8ea77a7cb0 | ||
|
|
2bb6d6deb2 | ||
|
|
7b235c935a | ||
|
|
3c88e9284c | ||
|
|
e967b02a22 | ||
|
|
aeb87cbc44 | ||
|
|
1f39a8f892 | ||
|
|
d2a6508379 | ||
|
|
39d1646b3c | ||
|
|
4c5ede0130 | ||
|
|
7c8eeeb1d1 | ||
|
|
99929ca018 | ||
|
|
6aadabd967 | ||
|
|
9b5be742c1 | ||
|
|
63d5b5e3bf |
@@ -245,7 +245,7 @@ def process_and_execute_notebook(
|
||||
result.logs_bucket = operation_metadata.build.logs_bucket
|
||||
|
||||
# Block and wait for the result
|
||||
operation_result = operation.result(timeout=86400)
|
||||
operation_result = operation.result(timeout=timeout_in_seconds)
|
||||
|
||||
result.duration = datetime.datetime.now() - time_start
|
||||
result.is_pass = True
|
||||
|
||||
@@ -10,4 +10,5 @@ google-cloud-aiplatform
|
||||
google-cloud-storage
|
||||
google-cloud-build
|
||||
ratemate
|
||||
GitPython
|
||||
GitPython
|
||||
google-api-core==2.10
|
||||
|
||||
@@ -8,3 +8,4 @@
|
||||
/cpr-examples @samthrasher
|
||||
/Train_tabular_models_with_many_frameworks_and_import_to_Vertex_AI_using_Pipelines @Ark-kun
|
||||
/pipeline_components @Ark-kun
|
||||
/pipeline_components/image_ml_model_training @lakeyk
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ download_from_gcs_op = components.load_component_from_url("https://raw.githubuse
|
||||
select_columns_using_Pandas_on_CSV_data_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/pandas/Select_columns/in_CSV_format/component.yaml")
|
||||
fill_all_missing_values_using_Pandas_on_CSV_data_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/pandas/Fill_all_missing_values/in_CSV_format/component.yaml")
|
||||
binarize_column_using_Pandas_on_CSV_data_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/pandas/Binarize_column/in_CSV_format/component.yaml")
|
||||
train_logistic_regression_model_using_scikit_learn_from_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/ML_frameworks/Scikit_learn/Train_logistic_regression_model/from_CSV/component.yaml")
|
||||
upload_Scikit_learn_pickle_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/1f5cf6e06409b704064b2086c0a705e4e6b4fcde/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_Scikit-learn_pickle_model/component.yaml")
|
||||
train_logistic_regression_model_using_scikit_learn_from_CSV_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/1f5cf6e06409b704064b2086c0a705e4e6b4fcde/community-content/pipeline_components/ML_frameworks/Scikit_learn/Train_logistic_regression_model/from_CSV/component.yaml")
|
||||
upload_Scikit_learn_pickle_model_to_Google_Cloud_Vertex_AI_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Upload_Scikit-learn_pickle_model/component.yaml")
|
||||
deploy_model_to_endpoint_op = components.load_component_from_url("https://raw.githubusercontent.com/GoogleCloudPlatform/vertex-ai-samples/399405402d95f4a011e2d2e967c96f8508ba5688/community-content/pipeline_components/google-cloud/Vertex_AI/Models/Deploy_to_endpoint/component.yaml")
|
||||
|
||||
# %% Pipeline definition
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
name: Load image classification model from tfhub
|
||||
description: |
|
||||
Loads specified model from TFHub, creates layer to receive additional (3 channel) imagery data.
|
||||
Args:
|
||||
class_names (Sequence[str]):
|
||||
Sequence of strings of categories for classification corresponding to input data.
|
||||
loaded_model_path (str):
|
||||
Output path for the loaded model.
|
||||
image_size_path (str):
|
||||
Output path for the model expected image size.
|
||||
model_name (Optional[str]):
|
||||
Name of the pre-trained image classification model to load from TFHub.
|
||||
Eligible model_name:
|
||||
- efficientnetv2-s
|
||||
- efficientnetv2-m
|
||||
- efficientnetv2-l
|
||||
- efficientnetv2-s-21k
|
||||
- efficientnetv2-m-21k
|
||||
- efficientnetv2-l-21k
|
||||
- efficientnetv2-xl-21k
|
||||
- efficientnetv2-b0-21k
|
||||
- efficientnetv2-b1-21k
|
||||
- efficientnetv2-b2-21k
|
||||
- efficientnetv2-b3-21k
|
||||
- efficientnetv2-s-21k-ft1k
|
||||
- efficientnetv2-m-21k-ft1k
|
||||
- efficientnetv2-l-21k-ft1k
|
||||
- efficientnetv2-xl-21k-ft1k
|
||||
- efficientnetv2-b0-21k-ft1k
|
||||
- efficientnetv2-b1-21k-ft1k
|
||||
- efficientnetv2-b2-21k-ft1k
|
||||
- efficientnetv2-b3-21k-ft1k
|
||||
- efficientnetv2-b0
|
||||
- efficientnetv2-b1
|
||||
- efficientnetv2-b2
|
||||
- efficientnetv2-b3
|
||||
- efficientnet_b0
|
||||
- efficientnet_b1
|
||||
- efficientnet_b2
|
||||
- efficientnet_b3
|
||||
- efficientnet_b4
|
||||
- efficientnet_b5
|
||||
- efficientnet_b6
|
||||
- efficientnet_b7
|
||||
- bit_s-r50x1
|
||||
- inception_v3
|
||||
- inception_resnet_v2
|
||||
- resnet_v1_50
|
||||
- resnet_v1_101
|
||||
- resnet_v1_152
|
||||
- resnet_v2_50
|
||||
- resnet_v2_101
|
||||
- resnet_v2_152
|
||||
- nasnet_large
|
||||
- nasnet_mobile
|
||||
- pnasnet_large
|
||||
- mobilenet_v2_100_224
|
||||
- mobilenet_v2_130_224
|
||||
- mobilenet_v2_140_224
|
||||
- mobilenet_v3_small_100_224
|
||||
- mobilenet_v3_small_075_224
|
||||
- mobilenet_v3_large_100_224
|
||||
- mobilenet_v3_large_075_224
|
||||
dropout_rate (Optional[float]):
|
||||
Fraction of input units to drop in the last layer. Value should be between 0.0 and 1.0.
|
||||
trainable (Optional[bool]):
|
||||
If true fine tuning will be performed on entire Hub model. If false only additional
|
||||
layers will be trained.
|
||||
l2_regularization_penalty (Optional[float]):
|
||||
l2 regularization penalty.
|
||||
inputs:
|
||||
- {name: class_names, type: 'typing.List[str]', description: List of class names corresponding
|
||||
to the input image data}
|
||||
- {name: model_name, type: String, description: Name of the TFHub model to load, default: efficientnetv2-xl-21k,
|
||||
optional: true}
|
||||
- {name: dropout_rate, type: Float, description: Dropout rate, default: '0.2', optional: true}
|
||||
- name: trainable
|
||||
type: Boolean
|
||||
description: True if fine tuning should be performed
|
||||
default: "True"
|
||||
optional: true
|
||||
- {name: l2_regularization_penalty, type: Float, description: Regularization penalty,
|
||||
default: '0.0001', optional: true}
|
||||
outputs:
|
||||
- {name: loaded_model_path, type: TensorflowSavedModel, description: Output path for
|
||||
the loaded model}
|
||||
- {name: image_size_path, type: HeightWidth}
|
||||
implementation:
|
||||
container:
|
||||
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.1
|
||||
# command is a list of strings (command-line arguments).
|
||||
# The YAML language has two syntaxes for lists and you can use either of them.
|
||||
# Here we use the "flow syntax" - comma-separated strings inside square brackets.
|
||||
command: [
|
||||
python3,
|
||||
# Path of the program inside the container
|
||||
/pipelines/component/src/loading_component.py,
|
||||
--loaded-model-path,
|
||||
{outputPath: loaded_model_path},
|
||||
--class-names,
|
||||
{inputValue: class_names},
|
||||
--model-name,
|
||||
{inputValue: model_name},
|
||||
--dropout-rate,
|
||||
{inputValue: dropout_rate},
|
||||
--trainable,
|
||||
{inputValue: trainable},
|
||||
--l2-regularization-penalty,
|
||||
{inputValue: l2_regularization_penalty},
|
||||
--image-size-path,
|
||||
{outputPath: image_size_path},
|
||||
]
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
name: Preprocess image data
|
||||
description: |
|
||||
Preprocess the image data and split between train and validation.
|
||||
Args:
|
||||
input_data_path (str):
|
||||
Input path for the TFRecord image data. Data will be formatted as 'label' (encoded image
|
||||
label), and 'image_raw' (the binary string of the image data).
|
||||
height_width_path (str):
|
||||
Path to square height and width to resize images to. File should contain single float value.
|
||||
Value is dependent on training model.
|
||||
preprocessed_training_data_path (str):
|
||||
Output path for the TFRecord training data. Data will be formatted as 'label' (encoded image
|
||||
label), and 'image_raw' (the binary string of the image data).
|
||||
preprocessed_validation_data_path (str):
|
||||
Output path for the TFRecord validation data. Data will be formatted as 'label' (encoded
|
||||
image label), and 'image_raw' (the binary string of the image data).
|
||||
validation_split (Optional[float]):
|
||||
Fraction of data that will make up validation dataset. Value should be between 0.0 and 1.0.
|
||||
seed (Optional[int]):
|
||||
The global random seed to ensure the system gets a unique random sequence
|
||||
that is deterministic (https://www.tensorflow.org/api_docs/python/tf/random/set_seed).
|
||||
inputs:
|
||||
- {name: input_data_path, type: ImageDatasetTFRecord, description: 'Input path for
|
||||
the TFRecord image data,'}
|
||||
- {name: height_width_path, type: HeightWidth, description: 'Path to square height and width to
|
||||
resize images to,'}
|
||||
- {name: validation_split, type: Float, description: 'Fraction of data that will make
|
||||
up validation dataset,', default: '0.2', optional: true}
|
||||
- {name: seed, type: Integer, description: Random seed, default: '0', optional: true}
|
||||
outputs:
|
||||
- {name: preprocessed_training_data_path, type: ImageDatasetTFRecord, description: 'Output
|
||||
path for the training data,'}
|
||||
- {name: preprocessed_validation_data_path, type: ImageDatasetTFRecord, description: 'Output
|
||||
path for the validation data,'}
|
||||
implementation:
|
||||
container:
|
||||
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.1
|
||||
# command is a list of strings (command-line arguments).
|
||||
# The YAML language has two syntaxes for lists and you can use either of them.
|
||||
# Here we use the "flow syntax" - comma-separated strings inside square brackets.
|
||||
command: [
|
||||
python3,
|
||||
# Path of the program inside the container
|
||||
/pipelines/component/src/preprocessing_component.py,
|
||||
--input-data-path,
|
||||
{inputPath: input_data_path},
|
||||
--height-width-path,
|
||||
{inputPath: height_width_path},
|
||||
--validation-split,
|
||||
{inputValue: validation_split},
|
||||
--seed,
|
||||
{inputValue: seed},
|
||||
--preprocessed-training-data-path,
|
||||
{outputPath: preprocessed_training_data_path},
|
||||
--preprocessed-validation-data-path,
|
||||
{outputPath: preprocessed_validation_data_path},
|
||||
]
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
name: Train tensorflow image classification model
|
||||
description: |
|
||||
Creates a trained image classification TensorFlow model.
|
||||
Args:
|
||||
preprocessed_training_data_path (str):
|
||||
Input path to the TFRecord training data. Data will be formatted as 'label' (encoded image
|
||||
label), and 'image_raw' (the binary string of the image data).
|
||||
preprocessed_validation_data_path (str):
|
||||
Input path to the TFRecord validation data. Data will be formatted as 'label' (encoded
|
||||
image label), and 'image_raw' (the binary string of the image data).
|
||||
model_path (str):
|
||||
Input path to the loaded pre-trained model.
|
||||
trained_model_path (str):
|
||||
Output path to save the trained model to.
|
||||
optimizer_name (Optional[str]):
|
||||
Name of the tf.keras optimizer. Available optimizers are listed at
|
||||
https://keras.io/api/optimizers/
|
||||
optimizer_parameters (Optional[Dict[str, str]]):
|
||||
Optimizer parameters.
|
||||
loss_function_name (Optional[str]):
|
||||
Name of the loss function.
|
||||
loss_function_parameters (Optional[Dict[str, str]]):
|
||||
Loss function parameters.
|
||||
number_of_epochs (Optional[int]):
|
||||
Number of training iterations over data.
|
||||
metric_names (Optional[Sequence[str]]):
|
||||
List of tf.keras.metrics to be evaluated by the model during training and testing. Available
|
||||
metrics are listed at https://keras.io/api/metrics/.
|
||||
seed Optional(int):
|
||||
The global random seed to ensure the system gets a unique random sequence
|
||||
that is deterministic (https://www.tensorflow.org/api_docs/python/tf/random/set_seed).
|
||||
inputs:
|
||||
- {name: preprocessed_training_data_path, type: ImageDatasetTFRecord, description: 'Input
|
||||
path for the training data,'}
|
||||
- {name: preprocessed_validation_data_path, type: ImageDatasetTFRecord, description: 'Input
|
||||
path for the validation data,'}
|
||||
- {name: model_path, type: TensorflowSavedModel, description: 'Input path for the
|
||||
model,'}
|
||||
- {name: optimizer_name, type: String, description: 'Name of the optimizer,', default: SGD,
|
||||
optional: true}
|
||||
- {name: optimizer_parameters, type: 'typing.Dict[str, str]', description: 'Optimizer
|
||||
parameters,', default: '{}', optional: true}
|
||||
- {name: loss_function_name, type: String, description: 'Name of the loss function,',
|
||||
default: CategoricalCrossentropy, optional: true}
|
||||
- {name: loss_function_parameters, type: 'typing.Dict[str, str]', description: 'Loss
|
||||
function parameters,', default: '{}', optional: true}
|
||||
- {name: number_of_epochs, type: Integer, description: 'Number of epochs,', default: '10',
|
||||
optional: true}
|
||||
- {name: metric_names, type: 'typing.List[str]', description: 'List of metrics to
|
||||
use,', default: '["accuracy"]', optional: true}
|
||||
- {name: seed, type: Integer, description: 'Random seed,', default: '0', optional: true}
|
||||
- {name: batch_size, type: Integer, description: Batch size, default: '16', optional: true}
|
||||
outputs:
|
||||
- {name: trained_model_path, type: TensorflowSavedModel, description: 'Output path
|
||||
for the saved model,'}
|
||||
implementation:
|
||||
container:
|
||||
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.1
|
||||
# command is a list of strings (command-line arguments).
|
||||
# The YAML language has two syntaxes for lists and you can use either of them.
|
||||
# Here we use the "flow syntax" - comma-separated strings inside square brackets.
|
||||
command: [
|
||||
python3,
|
||||
# Path of the program inside the container
|
||||
/pipelines/component/src/training_component.py,
|
||||
--preprocessed-training-data-path,
|
||||
{inputPath: preprocessed_training_data_path},
|
||||
--preprocessed-validation-data-path,
|
||||
{inputPath: preprocessed_validation_data_path},
|
||||
--model-path,
|
||||
{inputPath: model_path},
|
||||
--trained-model-path,
|
||||
{outputPath: trained_model_path},
|
||||
--optimizer-name,
|
||||
{inputValue: optimizer_name},
|
||||
--loss-function-name,
|
||||
{inputValue: loss_function_name},
|
||||
--number-of-epochs,
|
||||
{inputValue: number_of_epochs},
|
||||
--seed,
|
||||
{inputValue: seed},
|
||||
--batch-size,
|
||||
{inputValue: batch_size},
|
||||
--metric-names,
|
||||
{inputValue: metric_names},
|
||||
--optimizer-parameters,
|
||||
{inputValue: optimizer_parameters},
|
||||
--loss-function-parameters,
|
||||
{inputValue: loss_function_parameters},
|
||||
]
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
name: Transcode imagedataset tfrecord from csv
|
||||
description: |
|
||||
Transcodes CSV Data into TFRecord file of TFExamples.
|
||||
Args:
|
||||
csv_image_data_path (str):
|
||||
Path to the CSV image data. Data must include 'image_filepath' (Path to image file) and
|
||||
'image_label' (output for a prediction) fields.
|
||||
class_names (Sequence[str]):
|
||||
Sequence of strings of categories for classification corresponding to input data.
|
||||
tfrecord_image_data_path (str):
|
||||
Output path for the TFRecord image data. Data will be formatted as 'label' (encoded image
|
||||
label), and 'image_raw' (the binary string of the image data).
|
||||
inputs:
|
||||
- {name: csv_image_data_path, type: ImageDatasetCSV, description: Input path for the
|
||||
CSV image data}
|
||||
- {name: class_names, type: 'typing.List[str]', description: List of class names corresponding
|
||||
to the input image data}
|
||||
outputs:
|
||||
- {name: tfrecord_image_data_path, type: ImageDatasetTFRecord, description: Output
|
||||
path for the TFRecord image data}
|
||||
implementation:
|
||||
container:
|
||||
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.1
|
||||
# command is a list of strings (command-line arguments).
|
||||
# The YAML language has two syntaxes for lists and you can use either of them.
|
||||
# Here we use the "flow syntax" - comma-separated strings inside square brackets.
|
||||
command: [
|
||||
python3,
|
||||
# Path of the program inside the container
|
||||
/pipelines/component/src/transcoding_csv_component.py,
|
||||
--csv-image-data-path,
|
||||
{inputPath: csv_image_data_path},
|
||||
--tfrecord-image-data-path,
|
||||
{outputPath: tfrecord_image_data_path},
|
||||
--class-names,
|
||||
{inputValue: class_names},
|
||||
]
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
name: Transcode imagedataset tfrecord from jsonlines
|
||||
description: |
|
||||
Transcodes JSONL Data into TFRecord file of TFExamples.
|
||||
Args:
|
||||
jsonl_image_data_path (str):
|
||||
Input path for the JSONL image data
|
||||
Path to the JSONL image data. Each line corresponds to a JSON input describing an image.
|
||||
Schema follows AutoML image classification JSONL format
|
||||
https://cloud.google.com/vertex-ai/docs/image-data/classification/prepare-data#json-lines.
|
||||
class_names (Sequence[str]):
|
||||
Sequence of strings of categories for classification corresponding to input data.
|
||||
tfrecord_image_data_path (str):
|
||||
Output path for the TFRecord image data. Data will be formatted as 'label' (encoded image
|
||||
label), and 'image_raw' (the binary string of the image data).
|
||||
inputs:
|
||||
- {name: jsonl_image_data_path, type: ImageDatasetJsonLines, description: Input path
|
||||
for the JSONL image data}
|
||||
- {name: class_names, type: 'typing.List[str]', description: List of class names corresponding
|
||||
to the input image data}
|
||||
outputs:
|
||||
- {name: tfrecord_image_data_path, type: ImageDatasetTFRecord, description: Output
|
||||
path for the TFRecord image data}
|
||||
implementation:
|
||||
container:
|
||||
image: us-docker.pkg.dev/vertex-ai/ready-to-go-image-classification/image-components:v0.1
|
||||
# command is a list of strings (command-line arguments).
|
||||
# The YAML language has two syntaxes for lists and you can use either of them.
|
||||
# Here we use the "flow syntax" - comma-separated strings inside square brackets.
|
||||
command: [
|
||||
python3,
|
||||
# Path of the program inside the container
|
||||
/pipelines/component/src/transcoding_jsonl_component.py,
|
||||
--jsonl-image-data-path,
|
||||
{inputPath: jsonl_image_data_path},
|
||||
--tfrecord-image-data-path,
|
||||
{outputPath: tfrecord_image_data_path},
|
||||
--class-names,
|
||||
{inputValue: class_names},
|
||||
]
|
||||
@@ -191,13 +191,65 @@ def parse_dir(directory: str) -> int:
|
||||
continue
|
||||
exit_code += parse_dir(entry.path)
|
||||
elif entry.name.endswith('.ipynb'):
|
||||
exit_code += parse_notebook(entry.path, tag=directory.split('/')[-1], linkback=None, rules=rules)
|
||||
tag = directory.split('/')[-1]
|
||||
if tag == 'automl':
|
||||
tag = 'AutoML'
|
||||
elif tag == 'bigquery_ml':
|
||||
tag = 'BigQuery ML'
|
||||
elif tag == 'custom':
|
||||
tag = 'Vertex AI Training'
|
||||
elif tag == 'experiments':
|
||||
tag = 'Vertex AI Experiments'
|
||||
elif tag == 'explainable_ai':
|
||||
tag = 'Vertex Explainable AI'
|
||||
elif tag == 'feature_store':
|
||||
tag = 'Vertex AI Feature Store'
|
||||
elif tag == 'matching_engine':
|
||||
tag = 'Vertex AI Matching Engine'
|
||||
elif tag == 'migration':
|
||||
tag = 'CAIP to Vertex AI migration'
|
||||
elif tag == 'ml_metadata':
|
||||
tag = 'Vertex ML Metadata'
|
||||
elif tag == 'model_evaluation':
|
||||
tag = 'Vertex AI Model Evaluation'
|
||||
elif tag == 'model_monitoring':
|
||||
tag = 'Vertex AI Model Monitoring'
|
||||
elif tag == 'model_registry':
|
||||
tag = 'Vertex AI Model Registry'
|
||||
elif tag == 'pipelines':
|
||||
tag = 'Vertex AI Pipelines'
|
||||
elif tag == 'prediction':
|
||||
tag = 'Vertex AI Prediction'
|
||||
elif tag == 'pytorch':
|
||||
tag = 'Vertex AI Training'
|
||||
elif tag == 'reduction_server':
|
||||
tag = 'Vertex AI Reduction Server'
|
||||
elif tag == 'sdk':
|
||||
tag = 'Vertex AI SDK'
|
||||
elif tag == 'structured_data':
|
||||
tag = 'AutoML / BQML'
|
||||
elif tag == 'tabnet':
|
||||
tag = 'Vertex AI TabNet'
|
||||
elif tag == 'tabular_workflows':
|
||||
tag = 'AutoML Tabular Workflows'
|
||||
elif tag == 'tensorboard':
|
||||
tag = 'Vertex AI TensorBoard'
|
||||
elif tag == 'training':
|
||||
tag = 'Vertex AI Training'
|
||||
elif tag == 'vizier':
|
||||
tag = 'Vertex AI Vizier'
|
||||
|
||||
# special case
|
||||
if 'workbench' in directory:
|
||||
tag = 'Vertex AI Workbench'
|
||||
|
||||
exit_code += parse_notebook(entry.path, tags=[tag], linkback=None, rules=rules)
|
||||
|
||||
return exit_code
|
||||
|
||||
|
||||
def parse_notebook(path: str,
|
||||
tag: str,
|
||||
tags: List,
|
||||
linkback: str,
|
||||
rules: List) -> int:
|
||||
"""
|
||||
@@ -205,8 +257,9 @@ def parse_notebook(path: str,
|
||||
and notebook authoring requirements.
|
||||
|
||||
path: The path to the notebook.
|
||||
tag: The associated tag
|
||||
tags: The associated tags
|
||||
linkback: A link back to the web docs
|
||||
rules: The cell rules to apply
|
||||
|
||||
Returns the number of errors
|
||||
"""
|
||||
@@ -218,9 +271,20 @@ def parse_notebook(path: str,
|
||||
|
||||
# Automatic Index Generation
|
||||
if objective.desc != '':
|
||||
if overview.linkbacks:
|
||||
linkbacks = overview.linkbacks
|
||||
else:
|
||||
if linkback:
|
||||
linkbacks = [linkback]
|
||||
else:
|
||||
linkbacks = []
|
||||
|
||||
if overview.tags:
|
||||
tags = overview.tags
|
||||
|
||||
add_index(path,
|
||||
tag,
|
||||
linkback,
|
||||
tags,
|
||||
linkbacks,
|
||||
title.title,
|
||||
objective.desc,
|
||||
objective.uses,
|
||||
@@ -512,9 +576,21 @@ class OverviewRule(NotebookRule):
|
||||
"""
|
||||
Parse the overview cell
|
||||
"""
|
||||
self.linkbacks = []
|
||||
self.tags = []
|
||||
|
||||
cell = notebook.get()
|
||||
if not cell['source'][0].startswith("## Overview"):
|
||||
return notebook.report_error(ErrorCode.ERROR_OVERVIEW_NOTFOUND, "Overview section not found")
|
||||
|
||||
last_line = cell['source'][-1]
|
||||
if last_line.startswith('Learn more about ['):
|
||||
for more in last_line.split('[')[1:]:
|
||||
tag = more.split(']')[0]
|
||||
linkback = more.split('(')[1].split(')')[0]
|
||||
self.tags.append(tag)
|
||||
self.linkbacks.append(linkback)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@@ -972,8 +1048,8 @@ class TextTWRule(TextRule):
|
||||
|
||||
|
||||
def add_index(path: str,
|
||||
tag: str,
|
||||
linkback: str,
|
||||
tags: List,
|
||||
linkbacks: List,
|
||||
title : str,
|
||||
desc: str,
|
||||
uses: str,
|
||||
@@ -986,15 +1062,15 @@ def add_index(path: str,
|
||||
Add a discoverability index for this notebook
|
||||
|
||||
path: The path to the notebook
|
||||
tag: The tag (if any) for the notebook
|
||||
tags: The tags (if any) for the notebook
|
||||
title: The H1 title for the notebook
|
||||
desc:
|
||||
uses:
|
||||
steps:
|
||||
git_link:
|
||||
colab_link:
|
||||
workbench_link:
|
||||
linkback:
|
||||
desc: The notebook description
|
||||
uses: The resources/services used by the notebook
|
||||
steps: The steps specified by the notebook
|
||||
git_link: The link to the notebook in the git repo
|
||||
colab_link: Link to launch notebook in Colab
|
||||
workbench_link: Link to launch notebook in Workbench
|
||||
linkbacks: The linkbacks per tag
|
||||
"""
|
||||
global last_tag
|
||||
|
||||
@@ -1008,33 +1084,38 @@ def add_index(path: str,
|
||||
|
||||
print(' <tr>')
|
||||
print(' <td>')
|
||||
tags = tag.split(',')
|
||||
for tag in tags:
|
||||
print(f' {tag.strip()}<br/>\n')
|
||||
print(' </td>')
|
||||
print(' <td>')
|
||||
print(f' {title}<br/>\n')
|
||||
print(f' <b>{title}</b><br/>\n')
|
||||
if args.desc:
|
||||
desc = desc.replace('`', '')
|
||||
print('<br/>')
|
||||
print(f' {desc}<br/>\n')
|
||||
if linkback:
|
||||
text = ''
|
||||
for tag in tags:
|
||||
text += tag.strip() + ' '
|
||||
|
||||
print(f' Learn more about <a src="https://cloud.google.com/{linkback}">{text}</a><br/>\n')
|
||||
|
||||
if args.steps:
|
||||
print('<br/>' + steps.replace('\n', '<br/>').replace('-', ' -').replace('*', ' -') + '<br/>')
|
||||
|
||||
if linkbacks:
|
||||
num = len(tags)
|
||||
for _ in range(num):
|
||||
if linkbacks[_].startswith("vertex-ai"):
|
||||
print(f'<br/> Learn more about <a href="https://cloud.google.com/{linkbacks[_]}">{tags[_]}</a>\n')
|
||||
else:
|
||||
print(f'<br/> Learn more about <a href="{linkbacks[_]}">{tags[_]}</a>\n')
|
||||
|
||||
print(' </td>')
|
||||
print(' <td>')
|
||||
if colab_link:
|
||||
print(f' <a src="{colab_link}">Colab</a><br/>\n')
|
||||
print(f' <a href="{colab_link}" target="_blank">Colab</a><br/>\n')
|
||||
if git_link:
|
||||
print(f' <a src="{git_link}">GitHub</a><br/>\n')
|
||||
print(f' <a href="{git_link}" target="_blank">GitHub</a><br/>\n')
|
||||
if workbench_link:
|
||||
print(f' <a src="{workbench_link}">Vertex AI Workbench</a><br/>\n')
|
||||
print(f' <a href="{workbench_link}" target="_blank">Vertex AI Workbench</a><br/>\n')
|
||||
print(' </td>')
|
||||
print(' </tr>\n')
|
||||
elif args.repo:
|
||||
tags = tag.split(',')
|
||||
if tags != last_tag and tag != '':
|
||||
last_tag = tags
|
||||
flat_list = ''
|
||||
@@ -1084,21 +1165,27 @@ rules = [ copyright, notices, title, links, testenv, table, overview, objective,
|
||||
]
|
||||
|
||||
if args.web:
|
||||
print('<style>')
|
||||
print('table, th, td {')
|
||||
print(' border: 1px solid black;')
|
||||
print(' padding-left:10px')
|
||||
print('}')
|
||||
print('</style>')
|
||||
print('<table>')
|
||||
print(' <th>Vertex AI Feature</th>')
|
||||
print(' <th width="180px">Services</th>')
|
||||
print(' <th>Description</th>')
|
||||
print(' <th>Open in</th>')
|
||||
print(' <th width="80px">Open in</th>')
|
||||
|
||||
if args.notebook_dir:
|
||||
if not os.path.isdir(args.notebook_dir):
|
||||
print("Error: not a directory:", args.notebook_dir)
|
||||
print(f"Error: not a directory: {args.notebook_dir}", file=sys.stderr)
|
||||
exit(1)
|
||||
exit_code = parse_dir(args.notebook_dir)
|
||||
elif args.notebook:
|
||||
if not os.path.isfile(args.notebook):
|
||||
print("Error: not a notebook:", args.notebook)
|
||||
print(f"Error: not a notebook: {args.notebook}", file=sys.stderr)
|
||||
exit(1)
|
||||
exit_code = parse_notebook(args.notebook, tag='', linkback=None, rules=rules)
|
||||
exit_code = parse_notebook(args.notebook, tags=[], linkback=None, rules=rules)
|
||||
elif args.notebook_file:
|
||||
if not os.path.isfile(args.notebook_file):
|
||||
print("Error: file does not exist", args.notebook_file)
|
||||
@@ -1111,15 +1198,15 @@ elif args.notebook_file:
|
||||
if heading:
|
||||
heading = False
|
||||
else:
|
||||
tag = row[0]
|
||||
tags = row[0].split(',')
|
||||
notebook = row[1]
|
||||
try:
|
||||
linkback = row[2]
|
||||
except:
|
||||
linkback = None
|
||||
exit_code += parse_notebook(notebook, tag=tag, linkback=linkback, rules=rules)
|
||||
exit_code += parse_notebook(notebook, tags=tags, linkback=linkback, rules=rules)
|
||||
else:
|
||||
print("Error: must specify a directory or notebook")
|
||||
print("Error: must specify a directory or notebook", file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
if args.web:
|
||||
|
||||
@@ -63,7 +63,9 @@
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI Python client library to train and deploy a tabular classification model for online prediction.\n",
|
||||
"\n",
|
||||
"**Note**: you may incur charges for training, prediction, storage, or usage of other Google Cloud products in connection with testing this SDK."
|
||||
"**Note**: you may incur charges for training, prediction, storage, or usage of other Google Cloud products in connection with testing this SDK.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Tabular](https://cloud.google.com/vertex-ai/docs/training-overview#tabular_data)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -68,7 +68,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook walks you through the major phases of building and using an AutoML text classification model on [Vertex AI](https://cloud.google.com/vertex-ai/docs/). \n"
|
||||
"This notebook walks you through the major phases of building and using an AutoML text classification model on [Vertex AI](https://cloud.google.com/vertex-ai/docs/). \n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Text classification](https://cloud.google.com/vertex-ai/docs/text-data/classification/train-model)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"In this tutorial, you take on the role of a store planner who must determine how much inventory they will need to order for each of their products and stores for November 2019. You accomplish this by training forecasting models using historical sales data. You start with a baseline model using BigQuery ML (BQML) [ARIMA_PLUS](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-create-time-series) and then compare it against a [Vertex AI Forecasting](https://cloud.google.com/vertex-ai/docs/tabular-data/forecasting/overview) model."
|
||||
"In this tutorial, you take on the role of a store planner who must determine how much inventory they will need to order for each of their products and stores for November 2019. You accomplish this by training forecasting models using historical sales data. You start with a baseline model using BigQuery ML (BQML) [ARIMA_PLUS](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-create-time-series) and then compare it against a [Vertex AI Forecasting](https://cloud.google.com/vertex-ai/docs/tabular-data/forecasting/overview) model.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Forecasting](https://cloud.google.com/vertex-ai/docs/tabular-data/forecasting/overview) and [BQML Forecasting](https://cloud.google.com/vertex-ai/docs/tabular-data/forecasting-arima/overview)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"In this tutorial, you will use two Vertex AI Tabular Workflows pipelines to train AutoML models using different configurations. You will see how `get_automl_tabular_pipeline_and_parameters` gives you the ability to customize the default AutoML Tabular pipeline, and how `get_skip_architecture_search_pipeline_and_parameters` allows you to reduce the training time and cost for an AutoML model by using the tuning results from a previous pipeline run."
|
||||
"In this tutorial, you will use two Vertex AI Tabular Workflows pipelines to train AutoML models using different configurations. You will see how `get_automl_tabular_pipeline_and_parameters` gives you the ability to customize the default AutoML Tabular pipeline, and how `get_skip_architecture_search_pipeline_and_parameters` allows you to reduce the training time and cost for an AutoML model by using the tuning results from a previous pipeline run.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Tabular Workflows](https://cloud.google.com/vertex-ai/docs/tabular-data/tabular-workflows/e2e-automl)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -63,7 +63,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create image object detection models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create image object detection models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Image](https://cloud.google.com/vertex-ai/docs/image-data/object-detection/train-model)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create tabular forecasting models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create tabular forecasting models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Forecasting](https://cloud.google.com/vertex-ai/docs/tabular-data/forecasting/tutorials-samples)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to create tabular regression models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to create tabular regression models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Tabular](https://cloud.google.com/vertex-ai/docs/training-overview#tabular_data)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to create tabular regression models and do online prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to create tabular regression models and do online prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Tabular](https://cloud.google.com/vertex-ai/docs/training-overview#tabular_data)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to create text entity extraction models and do online prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to create text entity extraction models and do online prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Text](https://cloud.google.com/vertex-ai/docs/text-data/entity-extraction/train-model)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy an [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) text sentiment analysis model and get online predictions from it."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy an [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) text sentiment analysis model and get online predictions from it.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Text](https://cloud.google.com/vertex-ai/docs/text-data/sentiment-analysis/train-model)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -63,7 +63,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create video action recognition models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create video action recognition models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Video](https://cloud.google.com/vertex-ai/docs/video-data/action-recognition/train-model)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create video classification models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create video classification models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Video](https://cloud.google.com/vertex-ai/docs/video-data/classification/train-model)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to create video object tracking models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to create video object tracking models and do batch prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Video](https://cloud.google.com/vertex-ai/docs/video-data/object-tracking/train-model)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook is aimed at data analysts and data scientists who have data in BigQuery, want to train a model using BigQuery ML, register the model to Vertex AI Model Registry, and deploy it to an endpoint for real-time prediction. "
|
||||
"This notebook is aimed at data analysts and data scientists who have data in BigQuery, want to train a model using BigQuery ML, register the model to Vertex AI Model Registry, and deploy it to an endpoint for real-time prediction. \n",
|
||||
"\n",
|
||||
"Learn more about [BigQuery ML](https://cloud.google.com/bigquery-ml/docs/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -58,7 +58,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This tutorial walks you through building a custom container to serve a scikit-learn model on Vertex AI. You use the FastAPI Python web server framework to create a prediction and health endpoint. You also incorporate a pre-processor from training pipeline into your online serving application."
|
||||
"This tutorial walks you through building a custom container to serve a scikit-learn model on Vertex AI. You use the FastAPI Python web server framework to create a prediction and health endpoint. You also incorporate a pre-processor from training pipeline into your online serving application.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"\n",
|
||||
"This tutorial walks you through building a custom container to serve a facebook prophet model on Vertex AI. You use the FastAPI Python web server framework to create a prediction endpoint. This notebook is a modified version of an example on [serving a scikit-learn model on Vertex AI](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/sdk/SDK_Custom_Container_Prediction.ipynb).\n",
|
||||
"\n",
|
||||
"Learn more about serving an FBProphet model from this [article on testdriven.io: Deploying and Hosting a Machine Learning Model with FastAPI and Heroku](https://testdriven.io/blog/fastapi-machine-learning/).\n"
|
||||
"Learn more about serving an FBProphet model from this [article on testdriven.io: Deploying and Hosting a Machine Learning Model with FastAPI and Heroku](https://testdriven.io/blog/fastapi-machine-learning/).\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions).\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom tabular classification model for online prediction."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom tabular classification model for online prediction.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"Vertex AI TensorBoard Profiler lets you monitor and optimize your model training performance by helping you understand the resource consumption of training operations. This tutorial demonstrates how to enable Vertex AI TensorBoard Profiler so you can debug model training performance for your custom training jobs.\n"
|
||||
"Vertex AI TensorBoard Profiler lets you monitor and optimize your model training performance by helping you understand the resource consumption of training operations. This tutorial demonstrates how to enable Vertex AI TensorBoard Profiler so you can debug model training performance for your custom training jobs.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI TensorBoard Profiler](https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-profiler)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom image classification model for batch prediction."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom image classification model for batch prediction.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Batch Prediction](https://cloud.google.com/vertex-ai/docs/tabular-data/classification-regression/get-batch-predictions)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom image classification model for online prediction."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom image classification model for online prediction.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"As a Data Scientist, you want to be able to reuse code path (data preprocessing, feature engineering etc...) that others within your team have written to simplify and standardize all the complex data wrangling. "
|
||||
"As a Data Scientist, you want to be able to reuse code path (data preprocessing, feature engineering etc...) that others within your team have written to simplify and standardize all the complex data wrangling. \n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Experiments](https://cloud.google.com/vertex-ai/docs/experiments/intro-vertex-ai-experiments) and [Vertex ML Metadata](https://cloud.google.com/vertex-ai/docs/ml-metadata)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"As a Data Scientist, you probably start running model experiments locally on your notebook. Depending on the framework you use, you would need to track parameters, training time series and evaluation metrics. In this way, you would be able to explain the modelling approach you would choose. \n"
|
||||
"As a Data Scientist, you probably start running model experiments locally on your notebook. Depending on the framework you use, you would need to track parameters, training time series and evaluation metrics. In this way, you would be able to explain the modelling approach you would choose. \n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Experiments](https://cloud.google.com/vertex-ai/docs/experiments/intro-vertex-ai-experiments)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"Depending on the model life cycle of your data science team, you would like to experiment and track training pipeline runs and its associated parameters. Then, you would to compare runs of these Pipelines to each others in order to figure out which is the best configuration generates the model you will register in the Vertex AI Model Registry."
|
||||
"Depending on the model life cycle of your data science team, you would like to experiment and track training pipeline runs and its associated parameters. Then, you would to compare runs of these Pipelines to each others in order to figure out which is the best configuration generates the model you will register in the Vertex AI Model Registry.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Experiments](https://cloud.google.com/vertex-ai/docs/experiments/intro-vertex-ai-experiments) and [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create tabular binary classification models and do batch prediction with explanation using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create tabular binary classification models and do batch prediction with explanation using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Tabular](https://cloud.google.com/vertex-ai/docs/tabular-data/overview) and [Vertex Explainable AI](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create tabular classification models and do online prediction with explanation using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create tabular classification models and do online prediction with explanation using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Tabular](https://cloud.google.com/vertex-ai/docs/tabular-data/overview) and [Vertex Explainable AI](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy a custom image classification model for batch prediction with explanation."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy a custom image classification model for batch prediction with explanation.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex Explainable AI](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview) and [Vertex AI Batch Prediction](https://cloud.google.com/vertex-ai/docs/tabular-data/classification-regression/get-batch-predictions)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy a custom image classification model for online prediction with explanation."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy a custom image classification model for online prediction with explanation.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex Explainable AI](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy a custom tabular regression model for batch prediction with explanation."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy a custom tabular regression model for batch prediction with explanation.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex Explainable AI](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview) and [Vertex AI Batch Prediction](https://cloud.google.com/vertex-ai/docs/tabular-data/classification-regression/get-batch-predictions)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy a custom tabular regression model for online prediction with explanation."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy a custom tabular regression model for online prediction with explanation.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex Explainable AI](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy a custom tabular regression model for online prediction with explanation."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to train and deploy a custom tabular regression model for online prediction with explanation.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex Explainable AI](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview) and [Vertex AI Prediction](https://cloud.google.com/vertex-ai/docs/predictions/get-predictions)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -72,7 +72,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to use Vertex AI Feature Store's streaming ingestion at the SDK layer."
|
||||
"This notebook demonstrates how to use Vertex AI Feature Store's streaming ingestion at the SDK layer.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Feature Store](https://cloud.google.com/vertex-ai/docs/featurestore)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook introduces Pandas support for Feature Store using Vertex AI SDK. For pre-requisites and introduction on Vertex AI SDK and Feature Store native support, please go through this [Colab notebook](https://colab.sandbox.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/feature_store/sdk-feature-store.ipynb). "
|
||||
"This notebook introduces Pandas support for Feature Store using Vertex AI SDK. For pre-requisites and introduction on Vertex AI SDK and Feature Store native support, please go through this [Colab notebook](https://colab.sandbox.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/feature_store/sdk-feature-store.ipynb). \n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Feature Store](https://cloud.google.com/vertex-ai/docs/featurestore)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"\n",
|
||||
"This notebook introduces Vertex AI Feature Store, a managed cloud service for machine learning engineers and data scientists to store, serve, manage and share machine learning features at a large scale.\n",
|
||||
"\n",
|
||||
"This notebook assumes that you understand basic Google Cloud concepts such as [Project](https://cloud.google.com/storage/docs/projects), [Storage](https://cloud.google.com/storage) and [Vertex AI](https://cloud.google.com/vertex-ai/docs). Some machine learning knowledge is also helpful but not required.\n"
|
||||
"This notebook assumes that you understand basic Google Cloud concepts such as [Project](https://cloud.google.com/storage/docs/projects), [Storage](https://cloud.google.com/storage) and [Vertex AI](https://cloud.google.com/vertex-ai/docs). Some machine learning knowledge is also helpful but not required.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Feature Store](https://cloud.google.com/vertex-ai/docs/featurestore)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -84,7 +86,8 @@
|
||||
"- Create featurestore, entity type, and feature resources.\n",
|
||||
"- Import feature data into `Vertex AI Feature Store` resource.\n",
|
||||
"- Serve online prediction requests using the imported features.\n",
|
||||
"- Access imported features in offline jobs, such as training jobs."
|
||||
"- Access imported features in offline jobs, such as training jobs.\n",
|
||||
"- Use streaming ingestion to ingest small amount of data."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -185,7 +188,7 @@
|
||||
"source": [
|
||||
"## Installation\n",
|
||||
"\n",
|
||||
"Install the packages required for executing this notebook."
|
||||
"Install the packages required to execute this notebook."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -220,7 +223,7 @@
|
||||
"source": [
|
||||
"### Restart the kernel\n",
|
||||
"\n",
|
||||
"After you install the SDK, you need to restart the notebook kernel so it can find the packages. You can restart kernel from *Kernel -> Restart Kernel*, or running the following:"
|
||||
"After you install the SDK, you need to restart the notebook kernel so it can find the packages. You can restart kernel from *Kernel -> Restart Kernel*, or by running the following:"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -256,14 +259,14 @@
|
||||
"\n",
|
||||
"1. [Make sure that billing is enabled for your project](https://cloud.google.com/billing/docs/how-to/modify-project).\n",
|
||||
"\n",
|
||||
"1. [Enable the Vertex AI API and Compute Engine API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com,compute_component).\n",
|
||||
"1. [Enable the Vertex AI API and the Compute Engine API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com,compute_component).\n",
|
||||
"\n",
|
||||
"1. If you are running this notebook locally, you will need to install the [Cloud SDK](https://cloud.google.com/sdk).\n",
|
||||
"1. If you are running this notebook locally, you need to install the [Cloud SDK](https://cloud.google.com/sdk).\n",
|
||||
"\n",
|
||||
"1. Enter your project ID in the cell below. Then run the cell to make sure the\n",
|
||||
"1. Enter your project ID in the cell below, and then run the cell to make sure the\n",
|
||||
"Cloud SDK uses the right project for all the commands in this notebook.\n",
|
||||
"\n",
|
||||
"**Note**: Jupyter runs lines prefixed with `!` as shell commands, and it interpolates Python variables prefixed with `$` into these commands."
|
||||
"**Note**: Jupyter runs lines prefixed with `!` as shell commands, and interpolates Python variables prefixed with `$` into these commands."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -274,7 +277,7 @@
|
||||
"source": [
|
||||
"#### Set your project ID\n",
|
||||
"\n",
|
||||
"**If you don't know your project ID**, you may be able to get your project ID using `gcloud`."
|
||||
"**If you don't know your project ID**, you can get your project ID using `gcloud`."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -329,7 +332,7 @@
|
||||
"#### Region\n",
|
||||
"\n",
|
||||
"You can also change the `REGION` variable, which is used for operations\n",
|
||||
"throughout the rest of this notebook. Below are regions supported for Vertex AI. We recommend that you choose the region closest to you.\n",
|
||||
"throughout the rest of this notebook. The following regions are supported for Vertex AI. We recommend that you choose the region closest to you.\n",
|
||||
"\n",
|
||||
"- Americas: `us-central1`\n",
|
||||
"- Europe: `europe-west4`\n",
|
||||
@@ -361,7 +364,7 @@
|
||||
"source": [
|
||||
"#### UUID\n",
|
||||
"\n",
|
||||
"If you are in a live tutorial session, you might be using a shared test account or project. To avoid name collisions between users on resources created, you create a uuid for each instance session, and append it onto the name of resources you create in this tutorial."
|
||||
"If you are in a live tutorial session, you might be using a shared test account or project. To avoid name conflicts between users on resources created, you create a UUID for each instance session, and append it onto the name of resources you create in this tutorial."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -376,7 +379,7 @@
|
||||
"import string\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# Generate a uuid of a specifed length(default=8)\n",
|
||||
"# Generate a UUID of a specifed length(default=8)\n",
|
||||
"def generate_uuid(length: int = 8) -> str:\n",
|
||||
" return \"\".join(random.choices(string.ascii_lowercase + string.digits, k=length))\n",
|
||||
"\n",
|
||||
@@ -452,7 +455,7 @@
|
||||
"\n",
|
||||
" google_auth.authenticate_user()\n",
|
||||
"\n",
|
||||
" # If you are running this notebook locally, replace the string below with the\n",
|
||||
" # If you are running this notebook locally, replace the following string with the\n",
|
||||
" # path to your service account key and run this cell to authenticate your GCP\n",
|
||||
" # account.\n",
|
||||
" elif not os.getenv(\"IS_TESTING\"):\n",
|
||||
@@ -489,19 +492,19 @@
|
||||
"id": "h_HmF24mBHv9"
|
||||
},
|
||||
"source": [
|
||||
"## Terminology and Concept\n",
|
||||
"## Terminology and concept\n",
|
||||
"\n",
|
||||
"### Featurestore Data model\n",
|
||||
"### Featurestore data model\n",
|
||||
"\n",
|
||||
"Vertex AI Feature Store organizes data with the following 3 important hierarchical concepts:\n",
|
||||
"```\n",
|
||||
"Featurestore -> Entity type -> Feature\n",
|
||||
"```\n",
|
||||
"* **Featurestore**: the place to store your features\n",
|
||||
"* **Entity type**: under a Featurestore, an Entity type describes an object to be modeled, real one or virtual one.\n",
|
||||
"* **Feature**: under an Entity type, a Feature describes an attribute of the Entity type\n",
|
||||
"* **Featurestore**: The place to store your features\n",
|
||||
"* **Entity type**: Under a featurestore, an entity type describes an object to be modeled, real one or virtual one.\n",
|
||||
"* **Feature**: Under an entity type, a feature describes an attribute of the entity type\n",
|
||||
"\n",
|
||||
"In the movie prediction example, you will create a featurestore called `movie_prediction`. This store has 2 entity types: `users` and `movies`. The `users` entity type has the `age`, `gender`, and `liked_genres` features. The `movies` entity type has the `titles`, `genres`, and `average rating` features.\n"
|
||||
"The movie prediction example lets you create a featurestore called `movie_prediction`. This store has 2 entity types. `users` and `movies`. The `users` entity type has the `age`, `gender`, and `liked_genres` features. The `movies` entity type has the `titles`, `genres`, and `average rating` features.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -510,7 +513,7 @@
|
||||
"id": "9UvxYyGUimKw"
|
||||
},
|
||||
"source": [
|
||||
"## Create Featurestore and Define Schemas"
|
||||
"## Create featurestore and define schemas"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -519,11 +522,11 @@
|
||||
"id": "buQBIv3ZL3A0"
|
||||
},
|
||||
"source": [
|
||||
"### Create Featurestore\n",
|
||||
"### Create featurestore\n",
|
||||
"\n",
|
||||
"The method to create a Featurestore returns a\n",
|
||||
"The method to create a featurestore returns a\n",
|
||||
"[long-running operation](https://google.aip.dev/151) (LRO). An LRO starts an asynchronous job. LROs are returned for other API\n",
|
||||
"methods too, such as updating or deleting a featurestore. Running the code cell will create a featurestore and print the process log."
|
||||
"methods too, such as updating or deleting a featurestore. Running the code cell creates a featurestore and print the process log."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -549,7 +552,7 @@
|
||||
"id": "ag8pCQ7rNjVf"
|
||||
},
|
||||
"source": [
|
||||
"Use the function call below to retrieve a Featurestore and check that it has been created.\n"
|
||||
"Use the following function call to retrieve a featurestore and check that it has been created.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -574,9 +577,9 @@
|
||||
"id": "EpmJq75zXjmT"
|
||||
},
|
||||
"source": [
|
||||
"### Create Entity Type\n",
|
||||
"### Create entity Type\n",
|
||||
"\n",
|
||||
"Entity types can be created within the Featurestore class. Below, create the Users entity type and Movies entity type. A process log will be printed out."
|
||||
"Entity types can be created within the `Featurestore` class. Below, create the `users` and `movies` entity types. A process log is printed out."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -587,7 +590,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Create users entity type\n",
|
||||
"# Create the `users` entity type\n",
|
||||
"users_entity_type = fs.create_entity_type(\n",
|
||||
" entity_type_id=\"users\",\n",
|
||||
" description=\"Users entity\",\n",
|
||||
@@ -602,7 +605,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Create movies entity type\n",
|
||||
"# Create the `movies` entity type\n",
|
||||
"movies_entity_type = fs.create_entity_type(\n",
|
||||
" entity_type_id=\"movies\",\n",
|
||||
" description=\"Movies entity\",\n",
|
||||
@@ -649,8 +652,8 @@
|
||||
"id": "FJW4q-0jO2Xf"
|
||||
},
|
||||
"source": [
|
||||
"### Create Feature\n",
|
||||
"Features can be created within each entity type. Add defining features to the Users entity type and Movies entity type by using the `create_feature` method."
|
||||
"### Create feature\n",
|
||||
"You can create features within each entity type. Use the `create_feature` method to add features to the `users` and `movies` entity types."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -661,7 +664,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# to create features one at a time use\n",
|
||||
"# To create one feature at a time, use:\n",
|
||||
"users_feature_age = users_entity_type.create_feature(\n",
|
||||
" feature_id=\"age\",\n",
|
||||
" value_type=\"INT64\",\n",
|
||||
@@ -687,7 +690,7 @@
|
||||
"id": "RQ9-AyFYBvcX"
|
||||
},
|
||||
"source": [
|
||||
"Use the [list_features](https://github.com/googleapis/python-aiplatform/blob/main/google/cloud/aiplatform/featurestore/entity_type.py#L349) method to list all the features of a given entity type."
|
||||
"Use the [`list_features`](https://github.com/googleapis/python-aiplatform/blob/main/google/cloud/aiplatform/featurestore/entity_type.py#L349) method to list all the features of a given entity type."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -746,12 +749,14 @@
|
||||
"source": [
|
||||
"## Search created features\n",
|
||||
"\n",
|
||||
"While the `list_features` method allows you to easily view all features of a single\n",
|
||||
"entity type, the [search](https://github.com/googleapis/python-aiplatform/blob/main/google/cloud/aiplatform/featurestore/feature.py#L352) method in the Feature class searches across all featurestores and entity types in a given location (such as `us-central1`), and returns a list of features. This can help you discover features that were created by someone else.\n",
|
||||
"While the `list_features` method lets you view all features for the same entity type,\n",
|
||||
"the [`search`](https://github.com/googleapis/python-aiplatform/blob/main/google/cloud/aiplatform/featurestore/feature.py#L352) method in the `Feature` class searches across all featurestores and entity types in a given location (such as `us-central1`) and returns a list of features. This lets you discover features created by someone else.\n",
|
||||
"\n",
|
||||
"You can query based on feature properties including feature ID, entity type ID, and feature description. You can also limit results by filtering on a specific featurestore, feature value type, and/or labels. Some search examples are shown below. \n",
|
||||
"You can query based on feature properties including feature ID, entity type ID, and feature description. You can also limit results by filtering based on a specific featurestore, feature value type, and/or label. Some search examples are shown below. \n",
|
||||
"\n",
|
||||
"Search for all features within a featurestore with the code snippet below."
|
||||
"**Example of using the `search` method**\n",
|
||||
"\n",
|
||||
"Use the following code snippet to search for all features within a feature store:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -820,9 +825,9 @@
|
||||
"id": "K3n5XdK8Xjmw"
|
||||
},
|
||||
"source": [
|
||||
"## Import Feature Values\n",
|
||||
"## Import feature values\n",
|
||||
"\n",
|
||||
"You need to import feature values before you can use them for online/offline serving. In this step, you learn how to import feature values by ingesting the values from Cloud Storage. You can also import feature values from BigQuery or a Pandas dataframe.\n"
|
||||
"You need to import feature values before you can use them for online or offline serving. In this step, you learn how to import feature values by ingesting the values from GCS (Google Cloud Storage). You can also import feature values from BigQuery or a pandas dataFrame.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -831,11 +836,11 @@
|
||||
"id": "BlqJ-QdTcs6W"
|
||||
},
|
||||
"source": [
|
||||
"### Source Data Format and Layout\n",
|
||||
"### Source data format and layout\n",
|
||||
"\n",
|
||||
"BigQuery table/Avro/CSV are supported as input data types. No matter what format you are using, each imported entity *must* have an ID; also, each entity can *optionally* have a timestamp, specifying when the feature values are generated. This notebook uses Avro as an input, located at this public [bucket](https://console.cloud.google.com/storage/browser/cloud-samples-data-us-central1/vertex-ai/feature-store/datasets). The Avro schemas are as follows:\n",
|
||||
"BigQuery table/Avro/CSV are supported as input data types. No matter what format you are using, each imported entity *must* have an ID. Each entity can *optionally* have a timestamp, specifying when the feature values are generated. This notebook uses Avro as an input, located at this public [bucket](https://console.cloud.google.com/storage/browser/cloud-samples-data-us-central1/vertex-ai/feature-store/datasets). The Avro schemas are as follows:\n",
|
||||
"\n",
|
||||
"**For the Users entity**:\n",
|
||||
"**For the `users` entity**:\n",
|
||||
"```\n",
|
||||
"schema = {\n",
|
||||
" \"type\": \"record\",\n",
|
||||
@@ -865,7 +870,7 @@
|
||||
" }\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**For the Movies entity**:\n",
|
||||
"**For the `movies` entity**:\n",
|
||||
"```\n",
|
||||
"schema = {\n",
|
||||
" \"type\": \"record\",\n",
|
||||
@@ -902,7 +907,7 @@
|
||||
"id": "m7DyDa6chbJx"
|
||||
},
|
||||
"source": [
|
||||
"### Import feature values for Users entity type\n",
|
||||
"### Import feature values for `users` entity type\n",
|
||||
"\n",
|
||||
"When importing, specify the following in your request:\n",
|
||||
"\n",
|
||||
@@ -955,9 +960,9 @@
|
||||
"id": "laXdJPIqkLJO"
|
||||
},
|
||||
"source": [
|
||||
"### Import feature values for Movies entity type\n",
|
||||
"### Import feature values for `movies` entity type\n",
|
||||
"\n",
|
||||
"Similarly, import feature values for the Movies entity type into the featurestore.\n"
|
||||
"Similarly, import feature values for the `movies` entity type into the featurestore.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1014,7 +1019,7 @@
|
||||
},
|
||||
"source": [
|
||||
"[Online serving](https://cloud.google.com/vertex-ai/docs/featurestore/serving-online)\n",
|
||||
"lets you serve feature values for small batches of entities. It's designed for latency-sensitive service, such as online model prediction. For example, for a movie service, you might want to quickly show movies that the current user would most likely watch."
|
||||
"lets you serve feature values for small batches of entities. It's designed for latency-sensitive services, such as online model prediction. For example, for a movie service, you might want to quickly show movies that the current user would most likely watch."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1025,9 +1030,9 @@
|
||||
"source": [
|
||||
"### Read one entity per request\n",
|
||||
"\n",
|
||||
"With the Vertex AI SDK, it is easy to read feature values of one entity. By default, the SDK will return the latest value of each feature, meaning the feature values with the most recent timestamp.\n",
|
||||
"With the Python SDK, it's easy to read feature values of one entity. By default, the SDK returns the latest value of each feature, that is, the feature values with the most recent timestamps.\n",
|
||||
"\n",
|
||||
"To read feature values, specify the entity type ID and features to read. By default all the features of an entity type will be selected. The response will output and display the selected entity type ID and the selected feature values as a Pandas dataframe."
|
||||
"To read feature values, specify the entity type ID and features to read. By default all the features of an entity type are selected. The output response displays the selected entity type ID and the selected feature values as a Pandas dataframe."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1060,7 +1065,7 @@
|
||||
"source": [
|
||||
"### Read multiple entities per request\n",
|
||||
"\n",
|
||||
"To read feature values from multiple entities, specify the different entity type IDs. By default all the features of an entity type will be selected. Note that fetching only a small number of entities is recommended when using this SDK due to its latency-sensitive nature."
|
||||
"To read feature values from multiple entities, specify the different entity type IDs. By default, all the features of an entity type are selected. Note that fetching only a small number of entities is recommended when using this SDK due to its latency-sensitive nature."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1115,16 +1120,16 @@
|
||||
"source": [
|
||||
"### Use case\n",
|
||||
"\n",
|
||||
"**The task** is to prepare a training dataset to train a model, which predicts if a given user will watch a given movie. To achieve this, you need 2 sets of input:\n",
|
||||
"**The task** is to prepare a training dataset to train a model, which predicts if a given user is going to watch a movie. To achieve this, you need 2 sets of input:\n",
|
||||
"\n",
|
||||
"* Features: you already imported into the featurestore.\n",
|
||||
"* Labels: the ground-truth data recorded that user X has watched movie Y.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"To be more specific, the ground-truth observation is described in Table 1 and the desired training dataset is described in Table 2. Each row in Table 2 is a result of joining the imported feature values from Vertex AI Feature Store according to the entity IDs and timestamps in Table 1. In this example, the `age`, `gender` and `liked_genres` features from `users` and\n",
|
||||
"the `titles`, `genres` and `average_rating` features from `movies` are chosen to train the model. Note that only positive examples are shown in these 2 tables, i.e., you can imagine there is a label column whose values are all `True`.\n",
|
||||
"the `titles`, `genres` and `average_rating` features from `movies` are chosen to train the model. Note that only positive examples are shown in these 2 tables, that is, you can imagine there is a label column whose values are all `True`.\n",
|
||||
"\n",
|
||||
"[batch_serve_to_bq](https://github.com/googleapis/python-aiplatform/blob/main/google/cloud/aiplatform/featurestore/featurestore.py#L770) takes Table 1 as\n",
|
||||
"[`batch_serve_to_bq`](https://github.com/googleapis/python-aiplatform/blob/main/google/cloud/aiplatform/featurestore/featurestore.py#L770) takes Table 1 as\n",
|
||||
"input, joins all required feature values from the featurestore, and returns Table 2 for training.\n",
|
||||
"\n",
|
||||
"<h4 align=\"center\">Table 1. Ground-truth data</h4>\n",
|
||||
@@ -1154,7 +1159,7 @@
|
||||
"source": [
|
||||
"#### Why timestamp?\n",
|
||||
"\n",
|
||||
"Note that there is a `timestamp` column in Table 2. This indicates the time when the ground-truth was observed. This is to avoid data inconsistency.\n",
|
||||
"Note that there is a `timestamp` column in Table 2 to indicate the time when the ground-truth was observed. This is to avoid data inconsistency.\n",
|
||||
"\n",
|
||||
"For example, the 2nd row of Table 2 indicates that user `alice` watched movie `Cinema Paradiso` on `2019-11-01T00:00:00Z`. The featurestore keeps feature values for all timestamps but fetches feature values *only* at the given timestamp during batch serving. On that day, Alice might have been 54 years old, but now Alice might be 56; featurestore returns `age=54` as Alice's age, instead of `age=56`, because that is the value of the feature at the observation time. Similarly, other features might be time-variant as well, such as `liked_genres`."
|
||||
]
|
||||
@@ -1167,7 +1172,7 @@
|
||||
"source": [
|
||||
"### Create BigQuery dataset for output\n",
|
||||
"\n",
|
||||
"You need a BigQuery dataset to host the output data in `us-central1`. Input the name of the dataset you want to create and specify the name of the table you want to store the output created later. These will be used in the next section.\n",
|
||||
"You need a BigQuery dataset to host the output data in `us-central1`. Input the name of the dataset you want to create and specify the name of the table you want to store the output created later. These are used in the next section.\n",
|
||||
"\n",
|
||||
"**Make sure that the table name does NOT already exist**.\n"
|
||||
]
|
||||
@@ -1232,9 +1237,9 @@
|
||||
"id": "W8dLJ9nuDFgI"
|
||||
},
|
||||
"source": [
|
||||
"### Batch Read Feature Values\n",
|
||||
"### Batch read feature values\n",
|
||||
"\n",
|
||||
"Assemble the request which specify the following info:\n",
|
||||
"Assemble the request which specifies the following info:\n",
|
||||
"\n",
|
||||
"* Where is the label data, i.e., Table 1.\n",
|
||||
"* Which features are read, i.e., the column names in Table 2.\n",
|
||||
@@ -1281,6 +1286,96 @@
|
||||
"After the LRO finishes, you should be able to see the result in the [BigQuery console](https://console.cloud.google.com/bigquery), as a new table under the BigQuery dataset created earlier."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "7190f3c8b625"
|
||||
},
|
||||
"source": [
|
||||
"## Streaming ingestion\n",
|
||||
"\n",
|
||||
"Streaming ingestion is currently public preview. \n",
|
||||
"\n",
|
||||
"Streaming ingestion lets you make real-time updates to feature values. While batch import is suitable for importing a large volume of data with high latency, streaming ingestion is suitable for ingesting small amount of data with low latency. The written data becomes available to read using batch export and online serving."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "560e835c93db"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Since streaming ingestion is public preview, the feature is available in aiplatform_v1beta1.\n",
|
||||
"from google.cloud.aiplatform_v1beta1 import (\n",
|
||||
" FeaturestoreOnlineServingServiceClient, FeaturestoreServiceClient)\n",
|
||||
"from google.cloud.aiplatform_v1beta1.types import \\\n",
|
||||
" featurestore_online_service as featurestore_online_service_pb2\n",
|
||||
"from google.cloud.aiplatform_v1beta1.types import types as types_pb2\n",
|
||||
"\n",
|
||||
"API_ENDPOINT = \"{}-aiplatform.googleapis.com\".format(REGION)\n",
|
||||
"# Create client connection\n",
|
||||
"admin_client = FeaturestoreServiceClient(client_options={\"api_endpoint\": API_ENDPOINT})\n",
|
||||
"data_client = FeaturestoreOnlineServingServiceClient(\n",
|
||||
" client_options={\"api_endpoint\": API_ENDPOINT}\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "f53a06c9ab5c"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Call `write_feature_values` to ingest data to `users` entity type.\n",
|
||||
"data_client.write_feature_values(\n",
|
||||
" entity_type=admin_client.entity_type_path(\n",
|
||||
" PROJECT_ID, REGION, FEATURESTORE_ID, \"users\"\n",
|
||||
" ),\n",
|
||||
" payloads=[\n",
|
||||
" featurestore_online_service_pb2.WriteFeatureValuesPayload(\n",
|
||||
" entity_id=\"1305\",\n",
|
||||
" feature_values={\n",
|
||||
" \"age\": featurestore_online_service_pb2.FeatureValue(int64_value=34),\n",
|
||||
" \"gender\": featurestore_online_service_pb2.FeatureValue(\n",
|
||||
" string_value=\"female\"\n",
|
||||
" ),\n",
|
||||
" \"liked_genres\": featurestore_online_service_pb2.FeatureValue(\n",
|
||||
" string_array_value=types_pb2.StringArray(values=[\"drama\", \"action\"])\n",
|
||||
" ),\n",
|
||||
" },\n",
|
||||
" ),\n",
|
||||
" featurestore_online_service_pb2.WriteFeatureValuesPayload(\n",
|
||||
" entity_id=\"1306\",\n",
|
||||
" feature_values={\n",
|
||||
" \"age\": featurestore_online_service_pb2.FeatureValue(int64_value=50),\n",
|
||||
" \"gender\": featurestore_online_service_pb2.FeatureValue(\n",
|
||||
" string_value=\"male\"\n",
|
||||
" ),\n",
|
||||
" \"liked_genres\": featurestore_online_service_pb2.FeatureValue(\n",
|
||||
" string_array_value=types_pb2.StringArray(\n",
|
||||
" values=[\"suspense\", \"comedy\"]\n",
|
||||
" )\n",
|
||||
" ),\n",
|
||||
" },\n",
|
||||
" ),\n",
|
||||
" ],\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "700a9f1ebd19"
|
||||
},
|
||||
"source": [
|
||||
"Upon successful completion, the `write_feature_values` API returns an empty response.\n",
|
||||
"Similarly, ingest data to the `movies` entity type"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
@@ -1292,7 +1387,7 @@
|
||||
"To clean up all Google Cloud resources used in this project, you can [delete the Google Cloud\n",
|
||||
"project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#shutting_down_projects) you used for the tutorial.\n",
|
||||
"\n",
|
||||
"You can also keep the project but delete the featurestore and the BigQuery dataset by running the code below:"
|
||||
"You can also keep the project, but delete the featurestore and the BigQuery dataset by running the following code:"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrate how to train an embedding with Submatrix-wise Vector Embedding Learner ([Swivel](https://arxiv.org/abs/1602.02215)) using Vertex Pipelines. The purpose of the embedding learner is to compute cooccurrences between tokens in a given dataset and to use the cooccurrences to generate embeddings.\n",
|
||||
"This notebook demonstrate how to train an embedding with Submatrix-wise Vector Embedding Learner ([Swivel](https://arxiv.org/abs/1602.02215)) using Vertex AI Pipelines. The purpose of the embedding learner is to compute cooccurrences between tokens in a given dataset and to use the cooccurrences to generate embeddings.\n",
|
||||
"\n",
|
||||
"Vertex AI provides a pipeline template\n",
|
||||
"for training with Swivel, so you don't need to design your own pipeline or write\n",
|
||||
@@ -68,7 +68,9 @@
|
||||
"\n",
|
||||
"It will require you provide a bucket where the dataset will be stored.\n",
|
||||
"\n",
|
||||
"Note: you may incur charges for training, storage or usage of other GCP products (Dataflow) in connection with testing this SDK.\n"
|
||||
"Note: you may incur charges for training, storage or usage of other GCP products (Dataflow) in connection with testing this SDK.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Matching Engine](https://cloud.google.com/vertex-ai/docs/matching-engine/overview)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -60,7 +60,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This example demonstrates how to use the Vertex AI ANN Service. It is a high scale, low latency solution, to find similar vectors (or more specifically \"embeddings\") for a large corpus. Moreover, it is a fully managed offering, further reducing operational overhead. It is built upon [Approximate Nearest Neighbor (ANN) technology](https://ai.googleblog.com/2020/07/announcing-scann-efficient-vector.html) developed by Google Research."
|
||||
"This example demonstrates how to use the Vertex AI ANN Service. It is a high scale, low latency solution, to find similar vectors (or more specifically \"embeddings\") for a large corpus. Moreover, it is a fully managed offering, further reducing operational overhead. It is built upon [Approximate Nearest Neighbor (ANN) technology](https://ai.googleblog.com/2020/07/announcing-scann-efficient-vector.html) developed by Google Research.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Matching Engine](https://cloud.google.com/vertex-ai/docs/matching-engine/overview)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Two-Tower built-in algorithm on the Vertex AI platform.\n",
|
||||
"\n",
|
||||
"Two-tower models learn to represent two items of various types (such as user profiles, search queries, web documents, answer passages, or images) in the same vector space, so that similar or related items are close to each other. These two items are referred to as the query and candidate object, since when paired with a nearest neighbor search service such as Vertex Matching Engine, the two-tower model can retrieve candidate objects related to an input query object. These objects are encoded by a query and candidate encoder (the two \"towers\") respectively, which are trained on pairs of relevant items. This built-in algorithm exports trained query and candidate encoders as model artifacts, which can be deployed in Vertex Prediction for usage in a recommendation system.\n"
|
||||
"Two-tower models learn to represent two items of various types (such as user profiles, search queries, web documents, answer passages, or images) in the same vector space, so that similar or related items are close to each other. These two items are referred to as the query and candidate object, since when paired with a nearest neighbor search service such as Vertex AI Matching Engine, the two-tower model can retrieve candidate objects related to an input query object. These objects are encoded by a query and candidate encoder (the two \"towers\") respectively, which are trained on pairs of relevant items. This built-in algorithm exports trained query and candidate encoders as model artifacts, which can be deployed in Vertex Prediction for usage in a recommendation system.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Matching Engine](https://cloud.google.com/vertex-ai/docs/matching-engine/overview)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -54,6 +54,45 @@
|
||||
"<br/><br/><br/>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "7a8a13b86a8b"
|
||||
},
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy an AutoML image classification model.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Image](https://cloud.google.com/vertex-ai/docs/tutorials/image-recognition-automl/training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "618cfedf829a"
|
||||
},
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn to use `AutoML` to train an image model and use `Vertex AI Prediction` and `Vertex AI Batch Prediction` to do online and batch predictions.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services:\n",
|
||||
"\n",
|
||||
"- `AutoML`\n",
|
||||
"- `Vertex AI Batch Prediction`\n",
|
||||
"- `Vertex AI Model` resource\n",
|
||||
"- `Vertex AI Endpoint` resource\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
"- Train an AutoML image classification model.\n",
|
||||
"- Make a batch prediction.\n",
|
||||
"- Deploy model to a endpoint\n",
|
||||
"- Make a online prediction"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
|
||||
+3
-1
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom tabular classification scikit-learn model for batch prediction."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom tabular classification scikit-learn model for batch prediction.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -54,6 +54,42 @@
|
||||
"<br/><br/><br/>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "7a8a13b86a8b"
|
||||
},
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to hyperparamer tune a custom tabular classification TemsorFlow model.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "618cfedf829a"
|
||||
},
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn to use `Vertex AI Hyperparameter` to create and tune a custom trained model.\n",
|
||||
"\n",
|
||||
"You learn how to create and tune a custom-trained model from a Python script in a Docker container using the Vertex AI SDK for Python.\n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services:\n",
|
||||
"\n",
|
||||
"- `Vertex AI Training`\n",
|
||||
"- `Vertex AI Hyperparameter Tuning`\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
"- Create a `Vertex AI` hyperparameter tuning job for training a TensorFlow model."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
|
||||
@@ -54,6 +54,43 @@
|
||||
"<br/><br/><br/>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "7a8a13b86a8b"
|
||||
},
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train a AutoML video classification model and do a batch prediction.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Video](https://cloud.google.com/vertex-ai/docs/tutorials/video-classification-automl/training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "618cfedf829a"
|
||||
},
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn to use `AutoML` to train a video model and use `Vertex AI Batch Prediction` to do batch predictions.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services:\n",
|
||||
"\n",
|
||||
"- `AutoML`\n",
|
||||
"- `Vertex AI Batch Prediction`\n",
|
||||
"- `Vertex AI Model` resource\n",
|
||||
"- `Vertex AI Endpoint` resource\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
"- Train an AutoML video classification model.\n",
|
||||
"- Make a batch prediction."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
|
||||
@@ -54,6 +54,43 @@
|
||||
"<br/><br/><br/>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "7a8a13b86a8b"
|
||||
},
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train a AutoML video object tracking model and do a batch prediction.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Video](https://cloud.google.com/video-intelligence/automl/object-tracking/docs/index-object-tracking)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "618cfedf829a"
|
||||
},
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn to use `AutoML` to train a video model and use `Vertex AI Batch Prediction` to do batch predictions.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services:\n",
|
||||
"\n",
|
||||
"- `AutoML`\n",
|
||||
"- `Vertex AI Batch Prediction`\n",
|
||||
"- `Vertex AI Model` resource\n",
|
||||
"- `Vertex AI Endpoint` resource\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
"- Train an AutoML video object tracking model.\n",
|
||||
"- Make a batch prediction."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
|
||||
+45
@@ -54,6 +54,51 @@
|
||||
"<br/><br/><br/>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "7a8a13b86a8b"
|
||||
},
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train using a pre-built container and deploy a custom image classification model for online and batch prediction.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "f1ae7d54ad29"
|
||||
},
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn how to train a tensorflow image classification model using a prebuilt container and Vertex AI training. After training, you also deploy the model to Vertex AI using a pre-built container and generate both batch and online predictions on it. \n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services and resources:\n",
|
||||
"\n",
|
||||
"- Vertex AI Training\n",
|
||||
"- Vertex AI Model Registry\n",
|
||||
"- Vertex AI Predictions\n",
|
||||
"- Vertex AI Batch Predictions\n",
|
||||
"- Vertex AI Endpoints\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
"- *Package the training code into a python application.*\n",
|
||||
"- *Containerize the training application using Cloud Build and Artifact Registry.*\n",
|
||||
"- *Create a custom container training job in Vertex AI and run it.*\n",
|
||||
"- *Evaluate the model generated from the training job.*\n",
|
||||
"- *Create a model resource for the trained model in Vertex AI Model Registry.*\n",
|
||||
"- *Run a Vertex AI batch prediction job.*\n",
|
||||
"- *Deploy the model resource to a Vertex AI Endpoint.*\n",
|
||||
"- *Run a online prediction job on the model resource.*\n",
|
||||
"- *Clean up the resources created.*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates training a custom image classification model using Tensorflow and Vertex AI SDK by creating a custom training container. Additionally, the notebooks also deploys the trained model to Vertex AI and predictions are generated from it."
|
||||
"This notebook demonstrates training a custom image classification model using Tensorflow and Vertex AI SDK by creating a custom training container. Additionally, the notebooks also deploys the trained model to Vertex AI and predictions are generated from it.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -62,7 +62,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create tabular binary classification models and do online prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK to create tabular binary classification models and do online prediction using a Google Cloud [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) model.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Tabular](https://cloud.google.com/vertex-ai/docs/start/automl-users#tables)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -55,6 +55,45 @@
|
||||
"<br/><br/><br/>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "7a8a13b86a8b"
|
||||
},
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy an AutoML object detection model.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Image](https://cloud.google.com/vertex-ai/docs/tutorials/image-recognition-automl/training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "618cfedf829a"
|
||||
},
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn to use `AutoML` to train an image model and use `Vertex AI Prediction` and `Vertex AI Batch Prediction` to do online and batch predictions.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services:\n",
|
||||
"\n",
|
||||
"- `AutoML`\n",
|
||||
"- `Vertex AI Batch Prediction`\n",
|
||||
"- `Vertex AI Model` resource\n",
|
||||
"- `Vertex AI Endpoint` resource\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
"- Train an AutoML object detection model.\n",
|
||||
"- Make a batch prediction.\n",
|
||||
"- Deploy model to a endpoint\n",
|
||||
"- Make a online prediction"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
|
||||
@@ -61,11 +61,11 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"<a name=\"section-1\"></a>\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to create an AutoML Video Classification Model, with a Vertex AI video dataset, and how to serve the model for batch prediction. It requires you provide a bucket where the dataset will be stored.\n",
|
||||
"\n",
|
||||
"Note: you may incur charges for training, prediction, storage or usage of other GCP products in connection with testing this SDK.\n"
|
||||
"Note: you may incur charges for training, prediction, storage or usage of other GCP products in connection with testing this SDK.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Text](https://cloud.google.com/vertex-ai/docs/text-data/classification/prepare-data)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,11 +61,11 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"<a name=\"section-1\"></a>\n",
|
||||
"This notebook demonstrates how to create an AutoML Text Entity Extraction model, with a Vertex AI ncbi disease research dataset, and how to serve the model for batch prediction. It requires you provide a bucket where the dataset will be stored.\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to create an AutoML Text Entity Extrasction Model, with a Vertex AI ncbi disease research dataset, and how to serve the model for batch prediction. It requires you provide a bucket where the dataset will be stored.\n",
|
||||
"Note: you may incur charges for training, prediction, storage or usage of other Google Cloud products in connection with testing this SDK.\n",
|
||||
"\n",
|
||||
"Note: you may incur charges for training, prediction, storage or usage of other GCP products in connection with testing this SDK."
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Text](https://cloud.google.com/vertex-ai/docs/text-data/entity-extraction/prepare-data)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -76,7 +76,7 @@
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"The objective of this notebook is to build a AutoML Text Entity Extrasction Model. The following steps have been followed:\n",
|
||||
"The objective of this notebook is to build a AutoML Text Entity Extraction Model. The following steps have been followed:\n",
|
||||
"This tutorial uses the following Google Cloud ML services :\n",
|
||||
"\n",
|
||||
"* Vertex AI Dataset resource\n",
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "bdccc50b",
|
||||
"metadata": {
|
||||
"id": "copyright"
|
||||
},
|
||||
@@ -26,7 +25,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c6c22009",
|
||||
"metadata": {
|
||||
"id": "title:migration,new"
|
||||
},
|
||||
@@ -58,7 +56,47 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b3558cd7",
|
||||
"metadata": {
|
||||
"id": "2277f661a148"
|
||||
},
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to create an AutoML Text Sentiment Analysis model, with a Vertex AI ncbi disease research dataset, and how to serve the model for batch prediction. It requires you provide a bucket where the dataset will be stored.\n",
|
||||
"\n",
|
||||
"Note: you may incur charges for training, prediction, storage or usage of other Google Cloud products in connection with testing this SDK.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [AutoML Text](https://cloud.google.com/vertex-ai/docs/text-data/sentiment-analysis/prepare-data)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "f926ec7acab3"
|
||||
},
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"The objective of this notebook is to build a AutoML Text Sentiment Analysis model. The following steps have been followed:\n",
|
||||
"This tutorial uses the following Google Cloud ML services :\n",
|
||||
"\n",
|
||||
"* Vertex AI Dataset resource\n",
|
||||
"* AutoML Training\n",
|
||||
"* Vertex AI Model resource\n",
|
||||
"* Vertex AI Batch Prediction\n",
|
||||
"\n",
|
||||
"The steps performed include the following:\n",
|
||||
"\n",
|
||||
"* Copy AutoML video demo train data for creating managed dataset\n",
|
||||
"* Create a dataset on Vertex AI.\n",
|
||||
"* Configure a training job\n",
|
||||
"* Launch a training job and create a model on Vertex AI\n",
|
||||
"* Copy AutoML Video Demo Prediction Data for creating batch prediction job\n",
|
||||
"* Perform batch prediction job on the model"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "dataset:claritin,tst"
|
||||
},
|
||||
@@ -70,7 +108,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9b9362da",
|
||||
"metadata": {
|
||||
"id": "costs"
|
||||
},
|
||||
@@ -91,7 +128,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "05425dbe",
|
||||
"metadata": {
|
||||
"id": "setup_local"
|
||||
},
|
||||
@@ -125,7 +161,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "070c64e0",
|
||||
"metadata": {
|
||||
"id": "install_aip:mbsdk"
|
||||
},
|
||||
@@ -138,7 +173,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f6b14b99",
|
||||
"metadata": {
|
||||
"id": "install_aip:mbsdk"
|
||||
},
|
||||
@@ -157,7 +191,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "81f60b84",
|
||||
"metadata": {
|
||||
"id": "restart"
|
||||
},
|
||||
@@ -170,7 +203,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a95627f0",
|
||||
"metadata": {
|
||||
"id": "restart"
|
||||
},
|
||||
@@ -188,7 +220,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b7f6b038",
|
||||
"metadata": {
|
||||
"id": "before_you_begin:nogpu"
|
||||
},
|
||||
@@ -220,7 +251,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f55cca7c",
|
||||
"metadata": {
|
||||
"id": "set_project_id"
|
||||
},
|
||||
@@ -232,7 +262,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6917314c",
|
||||
"metadata": {
|
||||
"id": "autoset_project_id"
|
||||
},
|
||||
@@ -248,7 +277,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "53236aa8",
|
||||
"metadata": {
|
||||
"id": "set_gcloud_project_id"
|
||||
},
|
||||
@@ -259,7 +287,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c009cc18",
|
||||
"metadata": {
|
||||
"id": "region"
|
||||
},
|
||||
@@ -281,7 +308,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "071a11c0",
|
||||
"metadata": {
|
||||
"id": "region"
|
||||
},
|
||||
@@ -295,7 +321,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ae48374d",
|
||||
"metadata": {
|
||||
"id": "timestamp"
|
||||
},
|
||||
@@ -308,7 +333,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "41ba0990",
|
||||
"metadata": {
|
||||
"id": "timestamp"
|
||||
},
|
||||
@@ -328,7 +352,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2128e871",
|
||||
"metadata": {
|
||||
"id": "gcp_authenticate"
|
||||
},
|
||||
@@ -357,7 +380,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "433e860c",
|
||||
"metadata": {
|
||||
"id": "gcp_authenticate"
|
||||
},
|
||||
@@ -390,7 +412,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b57cb5f6",
|
||||
"metadata": {
|
||||
"id": "bucket:mbsdk"
|
||||
},
|
||||
@@ -407,7 +428,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "61b082b1",
|
||||
"metadata": {
|
||||
"id": "bucket"
|
||||
},
|
||||
@@ -420,7 +440,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "ff81b3cc",
|
||||
"metadata": {
|
||||
"id": "autoset_bucket"
|
||||
},
|
||||
@@ -433,7 +452,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f8c009cd",
|
||||
"metadata": {
|
||||
"id": "create_bucket"
|
||||
},
|
||||
@@ -444,7 +462,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "2f881cb5",
|
||||
"metadata": {
|
||||
"id": "create_bucket"
|
||||
},
|
||||
@@ -455,7 +472,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d746d0f0",
|
||||
"metadata": {
|
||||
"id": "validate_bucket"
|
||||
},
|
||||
@@ -466,7 +482,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "8c435668",
|
||||
"metadata": {
|
||||
"id": "validate_bucket"
|
||||
},
|
||||
@@ -477,7 +492,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f578b01b",
|
||||
"metadata": {
|
||||
"id": "setup_vars"
|
||||
},
|
||||
@@ -491,7 +505,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f41ecf1e",
|
||||
"metadata": {
|
||||
"id": "import_aip:mbsdk"
|
||||
},
|
||||
@@ -502,7 +515,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "292245fd",
|
||||
"metadata": {
|
||||
"id": "init_aip:mbsdk"
|
||||
},
|
||||
@@ -515,7 +527,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "56dc88d8",
|
||||
"metadata": {
|
||||
"id": "init_aip:mbsdk"
|
||||
},
|
||||
@@ -526,7 +537,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "87e20f86",
|
||||
"metadata": {
|
||||
"id": "import_file:u_dataset,csv"
|
||||
},
|
||||
@@ -539,7 +549,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "fffdec5d",
|
||||
"metadata": {
|
||||
"id": "import_file:claritin,csv,tst"
|
||||
},
|
||||
@@ -551,7 +560,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9c8d950b",
|
||||
"metadata": {
|
||||
"id": "quick_peek:csv"
|
||||
},
|
||||
@@ -566,7 +574,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "da6d0980",
|
||||
"metadata": {
|
||||
"id": "quick_peek:csv"
|
||||
},
|
||||
@@ -586,7 +593,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "00e9f81e",
|
||||
"metadata": {
|
||||
"id": "create_a_dataset:migration"
|
||||
},
|
||||
@@ -596,7 +602,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "14b72768",
|
||||
"metadata": {
|
||||
"id": "datasets_create:migration,new,mbsdk"
|
||||
},
|
||||
@@ -606,7 +611,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "00d777bd",
|
||||
"metadata": {
|
||||
"id": "create_dataset:text,tst"
|
||||
},
|
||||
@@ -625,7 +629,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "ca8a6f66",
|
||||
"metadata": {
|
||||
"id": "create_dataset:text,tst"
|
||||
},
|
||||
@@ -642,7 +645,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "068df169",
|
||||
"metadata": {
|
||||
"id": "create_dataset:text,tst"
|
||||
},
|
||||
@@ -662,7 +664,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "fb50a4ce",
|
||||
"metadata": {
|
||||
"id": "train_a_model:migration"
|
||||
},
|
||||
@@ -672,7 +673,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "293160ba",
|
||||
"metadata": {
|
||||
"id": "trainingpipelines_create:migration,new,mbsdk"
|
||||
},
|
||||
@@ -682,7 +682,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "84801634",
|
||||
"metadata": {
|
||||
"id": "create_automl_pipeline:text,tst"
|
||||
},
|
||||
@@ -709,7 +708,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "69eaae0e",
|
||||
"metadata": {
|
||||
"id": "create_automl_pipeline:text,tst"
|
||||
},
|
||||
@@ -726,7 +724,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "da9ecb4e",
|
||||
"metadata": {
|
||||
"id": "create_automl_pipeline:text,tst"
|
||||
},
|
||||
@@ -738,7 +735,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "55f19997",
|
||||
"metadata": {
|
||||
"id": "run_automl_pipeline:text"
|
||||
},
|
||||
@@ -761,7 +757,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6149074c",
|
||||
"metadata": {
|
||||
"id": "run_automl_pipeline:text"
|
||||
},
|
||||
@@ -778,7 +773,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "6e8fe148",
|
||||
"metadata": {
|
||||
"id": "run_automl_pipeline:text"
|
||||
},
|
||||
@@ -804,7 +798,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c25dee28",
|
||||
"metadata": {
|
||||
"id": "evaluate_the_model:migration"
|
||||
},
|
||||
@@ -814,7 +807,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "903e8226",
|
||||
"metadata": {
|
||||
"id": "models_evaluations_list:migration,new"
|
||||
},
|
||||
@@ -824,7 +816,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "cb2d95f3",
|
||||
"metadata": {
|
||||
"id": "evaluate_the_model:mbsdk"
|
||||
},
|
||||
@@ -838,7 +829,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "9b1ec312",
|
||||
"metadata": {
|
||||
"id": "evaluate_the_model:mbsdk"
|
||||
},
|
||||
@@ -860,7 +850,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9eab460e",
|
||||
"metadata": {
|
||||
"id": "evaluate_the_model:mbsdk"
|
||||
},
|
||||
@@ -901,7 +890,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d4111c50",
|
||||
"metadata": {
|
||||
"id": "make_batch_predictions:migration"
|
||||
},
|
||||
@@ -911,7 +899,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f73fad68",
|
||||
"metadata": {
|
||||
"id": "batchpredictionjobs_create:migration,new,mbsdk"
|
||||
},
|
||||
@@ -921,7 +908,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ba77f1c7",
|
||||
"metadata": {
|
||||
"id": "get_test_items:batch_prediction"
|
||||
},
|
||||
@@ -934,7 +920,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "1c9fc91f",
|
||||
"metadata": {
|
||||
"id": "get_test_items:automl,tst,csv"
|
||||
},
|
||||
@@ -956,7 +941,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2a18c8e2",
|
||||
"metadata": {
|
||||
"id": "make_batch_file:automl,text"
|
||||
},
|
||||
@@ -976,7 +960,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "70461c41",
|
||||
"metadata": {
|
||||
"id": "make_batch_file:automl,text"
|
||||
},
|
||||
@@ -1006,7 +989,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "254cbdbb",
|
||||
"metadata": {
|
||||
"id": "batch_request:mbsdk"
|
||||
},
|
||||
@@ -1024,7 +1006,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "8f3cf8b6",
|
||||
"metadata": {
|
||||
"id": "batch_request:mbsdk"
|
||||
},
|
||||
@@ -1042,7 +1023,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "530dbf5b",
|
||||
"metadata": {
|
||||
"id": "batch_request:mbsdk"
|
||||
},
|
||||
@@ -1062,7 +1042,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "89414481",
|
||||
"metadata": {
|
||||
"id": "batch_request_wait:mbsdk"
|
||||
},
|
||||
@@ -1075,7 +1054,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a579bd4a",
|
||||
"metadata": {
|
||||
"id": "batch_request_wait:mbsdk"
|
||||
},
|
||||
@@ -1086,7 +1064,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2cba4cc6",
|
||||
"metadata": {
|
||||
"id": "batch_request_wait:mbsdk"
|
||||
},
|
||||
@@ -1121,7 +1098,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c46e3e76",
|
||||
"metadata": {
|
||||
"id": "get_batch_prediction:mbsdk,tst"
|
||||
},
|
||||
@@ -1140,7 +1116,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "d2af5ea8",
|
||||
"metadata": {
|
||||
"id": "get_batch_prediction:mbsdk,tst"
|
||||
},
|
||||
@@ -1169,7 +1144,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9fc83253",
|
||||
"metadata": {
|
||||
"id": "get_batch_prediction:mbsdk,tst"
|
||||
},
|
||||
@@ -1181,7 +1155,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "19466786",
|
||||
"metadata": {
|
||||
"id": "make_online_predictions:migration"
|
||||
},
|
||||
@@ -1191,7 +1164,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "e97f1e55",
|
||||
"metadata": {
|
||||
"id": "deploy_model:migration,new,mbsdk"
|
||||
},
|
||||
@@ -1201,7 +1173,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d2745f77",
|
||||
"metadata": {
|
||||
"id": "deploy_model:mbsdk,automatic"
|
||||
},
|
||||
@@ -1214,7 +1185,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6d30aa15",
|
||||
"metadata": {
|
||||
"id": "deploy_model:mbsdk,automatic"
|
||||
},
|
||||
@@ -1225,7 +1195,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c2c876d0",
|
||||
"metadata": {
|
||||
"id": "deploy_model:mbsdk,automatic"
|
||||
},
|
||||
@@ -1244,7 +1213,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9bb982a8",
|
||||
"metadata": {
|
||||
"id": "endpoints_predict:migration,new,mbsdk"
|
||||
},
|
||||
@@ -1254,7 +1222,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "246945bb",
|
||||
"metadata": {
|
||||
"id": "get_test_item"
|
||||
},
|
||||
@@ -1267,7 +1234,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "e21c3f76",
|
||||
"metadata": {
|
||||
"id": "get_test_item:automl,tst,csv"
|
||||
},
|
||||
@@ -1284,7 +1250,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "95ffe1ea",
|
||||
"metadata": {
|
||||
"id": "predict_request:mbsdk,tst"
|
||||
},
|
||||
@@ -1313,7 +1278,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "16b7ab95",
|
||||
"metadata": {
|
||||
"id": "predict_request:mbsdk,tst"
|
||||
},
|
||||
@@ -1327,7 +1291,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f4c79c7f",
|
||||
"metadata": {
|
||||
"id": "predict_request:mbsdk,tst"
|
||||
},
|
||||
@@ -1339,7 +1302,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "52717fb9",
|
||||
"metadata": {
|
||||
"id": "undeploy_model:mbsdk"
|
||||
},
|
||||
@@ -1352,7 +1314,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "7c164d13",
|
||||
"metadata": {
|
||||
"id": "undeploy_model:mbsdk"
|
||||
},
|
||||
@@ -1363,7 +1324,6 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "4b844c87",
|
||||
"metadata": {
|
||||
"id": "cleanup:mbsdk"
|
||||
},
|
||||
@@ -1389,7 +1349,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "2ea906d0",
|
||||
"metadata": {
|
||||
"id": "cleanup:mbsdk"
|
||||
},
|
||||
|
||||
+43
@@ -53,6 +53,49 @@
|
||||
"<br/><br/><br/>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "7a8a13b86a8b"
|
||||
},
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train and deploy a custom tabular classification XGBoost model for batch prediction.\n",
|
||||
"\n",
|
||||
"Learn more about [Migrate to Vertex AI](https://cloud.google.com/vertex-ai/docs/start/migrating-to-vertex-ai) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "618cfedf829a"
|
||||
},
|
||||
"source": [
|
||||
"### Objective\n",
|
||||
"\n",
|
||||
"In this tutorial, you learn to use `Vertex AI Training` to create a custom trained model and use `Vertex AI Batch Prediction` to do a batch prediction on the trained model.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"You learn how to create a custom-trained model from a Python script in a Docker container using the Vertex AI SDK for Python, and then do a prediction on the deployed model by sending data.\n",
|
||||
"\n",
|
||||
"This tutorial uses the following Google Cloud ML services:\n",
|
||||
"\n",
|
||||
"- `Vertex AI Training`\n",
|
||||
"- `Vertex AI Batch Prediction`\n",
|
||||
"- `Vertex AI Model` resource\n",
|
||||
"- `Vertex AI Endpoint` resource\n",
|
||||
"\n",
|
||||
"The steps performed include:\n",
|
||||
"\n",
|
||||
"- Create a `Vertex AI` custom job for training a scikit-learn model.\n",
|
||||
"- Upload the trained model artifacts as a `Model` resource.\n",
|
||||
"- Make a batch prediction.\n",
|
||||
"- Deploy model to a endpoint\n",
|
||||
"- Make a online prediction"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to track metrics and parameters for Vertex AI custom training jobs, and how to perform detailed analysis using this data."
|
||||
"This notebook demonstrates how to track metrics and parameters for Vertex AI custom training jobs, and how to perform detailed analysis using this data.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex ML Metadata](https://cloud.google.com/vertex-ai/docs/ml-metadata) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to track metrics and parameters for ML training jobs and analyze this metadata using Vertex AI SDK for Python."
|
||||
"This notebook demonstrates how to track metrics and parameters for ML training jobs and analyze this metadata using Vertex AI SDK for Python.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex ML Metadata](https://cloud.google.com/vertex-ai/docs/ml-metadata)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to track metrics and artifacts across Vertex AI Pipelines runs, and analyze this metadata using the Vertex AI SDK. If you'd prefer to follow a step-by-step tutorial, check out the [codelab version](https://codelabs.developers.google.com/vertex-mlmd-pipelines#0) of this notebook."
|
||||
"This notebook demonstrates how to track metrics and artifacts across Vertex AI Pipelines runs, and analyze this metadata using the Vertex AI SDK. If you'd prefer to follow a step-by-step tutorial, check out the [codelab version](https://codelabs.developers.google.com/vertex-mlmd-pipelines#0) of this notebook.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex ML Metadata](https://cloud.google.com/vertex-ai/docs/ml-metadata) and [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to use the Vertex AI classification model evaluation component to evaluate an AutoML Tabular classification model. Model evaluation helps determine your model's performance based on the evaluation metrics and improve the model whenever necessary. "
|
||||
"This notebook demonstrates how to use the Vertex AI classification model evaluation component to evaluate an AutoML Tabular classification model. Model evaluation helps determine your model's performance based on the evaluation metrics and improve the model whenever necessary. \n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Model Evaluation](https://cloud.google.com/vertex-ai/docs/evaluation/introduction) and [AutoML Tabular](https://cloud.google.com/vertex-ai/docs/start/automl-users#tables)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to use Vertex AI regression model evaluation component to evaluate an AutoML Tabular regression model. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. "
|
||||
"This notebook demonstrates how to use Vertex AI regression model evaluation component to evaluate an AutoML Tabular regression model. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. \n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Model Evaluation](https://cloud.google.com/vertex-ai/docs/evaluation/introduction) and [AutoML Tabular](https://cloud.google.com/vertex-ai/docs/start/automl-users#tables)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to use the Vertex AI classification model evaluation component to evaluate an AutoML text classification model. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. "
|
||||
"This notebook demonstrates how to use the Vertex AI classification model evaluation component to evaluate an AutoML text classification model. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. \n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Model Evaluation](https://cloud.google.com/vertex-ai/docs/evaluation/introduction) and [AutoML Text](https://cloud.google.com/vertex-ai/docs/text-data/classification/prepare-data)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+18
-13
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to use the Vertex AI classification model evaluation component to evaluate an AutoML video classification model. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. "
|
||||
"This notebook demonstrates how to use the Vertex AI classification model evaluation component to evaluate an AutoML video classification model. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. \n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Model Evaluation](https://cloud.google.com/vertex-ai/docs/evaluation/introduction) and [AutoML Video](https://cloud.google.com/vertex-ai/docs/video-data/classification/prepare-data)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -202,7 +204,7 @@
|
||||
"\n",
|
||||
"! pip3 install --upgrade google-cloud-aiplatform \\\n",
|
||||
" kfp \\\n",
|
||||
" google-cloud-pipeline-components \\\n",
|
||||
" google-cloud-pipeline-components==1.0.26 \\\n",
|
||||
" google-cloud-storage {USER_FLAG} -q"
|
||||
]
|
||||
},
|
||||
@@ -752,9 +754,9 @@
|
||||
"\n",
|
||||
"- `display_name`: The human readable name for the `TrainingJob` resource.\n",
|
||||
"- `prediction_type`: The type task to train the model for.\n",
|
||||
"- `classification`: A video classification model.\n",
|
||||
"- `object_tracking`: A video object tracking model.\n",
|
||||
"- `action_recognition`: A video action recognition model.\n"
|
||||
" - `classification`: A video classification model.\n",
|
||||
" - `object_tracking`: A video object tracking model.\n",
|
||||
" - `action_recognition`: A video action recognition model.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1013,12 +1015,13 @@
|
||||
"\n",
|
||||
"- `GetVertexModelOp`: Gets a Vertex AI Model Artifact. \n",
|
||||
"- `EvaluationDataSamplerOp`: Randomly downsamples an input dataset to a specified size for generating predictions from AutoML and custom models. Creates a Dataflow job with Apache Beam to downsample the dataset. \n",
|
||||
"- `TargetFieldDataRemoverOp`: Removes the target field from the input dataset.\n",
|
||||
"- `ModelBatchPredictOp`: Creates a Google Cloud Vertex BatchPredictionJob and waits for it to complete. \n",
|
||||
"- `ModelEvaluationClassificationOp`: Compute evaluation metrics on a trained model’s batch prediction results. Creates a Dataflow job with Apache Beam and TFMA to compute evaluation metrics. Supports mutliclass classification evaluation for image, video, and text data. \n",
|
||||
"\n",
|
||||
"- `ModelImportEvaluationOp`: Imports a model evaluation artifact to an existing Vertex model with ModelService.ImportModelEvaluation. \n",
|
||||
"\n",
|
||||
"Learn more about [Google Cloud Pipeline Model Evaluation components](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.20/google_cloud_pipeline_components.experimental.evaluation.html)."
|
||||
"Learn more about [Google Cloud Pipeline Model Evaluation components](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.26/google_cloud_pipeline_components.experimental.evaluation.html)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1036,9 +1039,9 @@
|
||||
" root_dir: str,\n",
|
||||
" prediction_type: str,\n",
|
||||
" model_name: str,\n",
|
||||
" target_column_name: str,\n",
|
||||
" target_field_name: str,\n",
|
||||
" ground_truth_gcs_uri: list,\n",
|
||||
" class_labels: list = \"{}\",\n",
|
||||
" class_labels: list,\n",
|
||||
" batch_predict_instances_format: str = \"jsonl\",\n",
|
||||
" batch_predict_predictions_format: str = \"jsonl\",\n",
|
||||
" batch_predict_machine_type: str = \"n1-standard-16\",\n",
|
||||
@@ -1070,7 +1073,7 @@
|
||||
" root_dir=root_dir,\n",
|
||||
" gcs_source_uris=data_sampler_task.outputs[\"gcs_output_directory\"],\n",
|
||||
" instances_format=batch_predict_instances_format,\n",
|
||||
" target_field_name=target_column_name,\n",
|
||||
" target_field_name=target_field_name,\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
" # Run Batch Prediction.\n",
|
||||
@@ -1095,10 +1098,10 @@
|
||||
" location=location,\n",
|
||||
" root_dir=root_dir,\n",
|
||||
" ground_truth_gcs_source=data_sampler_task.outputs[\"gcs_output_directory\"],\n",
|
||||
" target_field_name=target_column_name,\n",
|
||||
" target_field_name=target_field_name,\n",
|
||||
" prediction_score_column=\"prediction.confidence\",\n",
|
||||
" prediction_label_column=\"prediction.displayName\",\n",
|
||||
" class_labels=[\"brush_hair\", \"cartwheel\"],\n",
|
||||
" class_labels=class_labels,\n",
|
||||
" ground_truth_format=batch_predict_instances_format,\n",
|
||||
" predictions_format=batch_predict_predictions_format,\n",
|
||||
" predictions_gcs_source=batch_predict_task.outputs[\"gcs_output_directory\"],\n",
|
||||
@@ -1152,7 +1155,7 @@
|
||||
"- `location`: Region where the pipeline is run.\n",
|
||||
"- `root_dir`: The GCS directory for keeping staging files and artifacts. A random subdirectory is created under the directory to keep job info for resuming the job in case of failure.\n",
|
||||
"- `model_name`: Resource name of the trained AutoML Video Classification model.\n",
|
||||
"- `target_column_name`: Name of the column to be used as the target for classification.\n",
|
||||
"- `target_field_name`: Name of the column to be used as the target for classification.\n",
|
||||
"- `batch_predict_instances_format`: Format of the input instances for batch prediction. Can be '**jsonl**' or '**bigquery**' or '**csv**'.\n",
|
||||
"- `batch_predict_sample_size`: Size of the samples to be considered for batch prediction and evaluation."
|
||||
]
|
||||
@@ -1168,14 +1171,16 @@
|
||||
"LABEL_COLUMN = \"outputLabel\"\n",
|
||||
"PIPELINE_ROOT = f\"{BUCKET_URI}/pipeline_root/pen{UUID}\"\n",
|
||||
"SAMPLE_SIZE = 2\n",
|
||||
"CLASS_LABELS = [\"brush_hair\", \"cartwheel\"]\n",
|
||||
"parameters = {\n",
|
||||
" \"project\": PROJECT_ID,\n",
|
||||
" \"location\": REGION,\n",
|
||||
" \"root_dir\": PIPELINE_ROOT,\n",
|
||||
" \"prediction_type\": \"segment-classification\",\n",
|
||||
" \"model_name\": MODEL_RSC_NAME,\n",
|
||||
" \"target_column_name\": LABEL_COLUMN,\n",
|
||||
" \"target_field_name\": LABEL_COLUMN,\n",
|
||||
" \"ground_truth_gcs_uri\": [gcs_ground_truth_uri],\n",
|
||||
" \"class_labels\": CLASS_LABELS,\n",
|
||||
" \"batch_predict_instances_format\": \"jsonl\",\n",
|
||||
" \"batch_predict_sample_size\": SAMPLE_SIZE,\n",
|
||||
"}"
|
||||
|
||||
+10
-8
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to use the Vertex AI classification model evaluation component to evaluate a custom-trained tabular classification model saved in Vertex AI Model Registry. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. "
|
||||
"This notebook demonstrates how to use the Vertex AI classification model evaluation component to evaluate a custom-trained tabular classification model saved in Vertex AI Model Registry. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. \n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Model Evaluation](https://cloud.google.com/vertex-ai/docs/evaluation/introduction) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -150,7 +152,7 @@
|
||||
"source": [
|
||||
"# Install the latest versions of the following packages\n",
|
||||
"! pip3 install --upgrade google-cloud-aiplatform \\\n",
|
||||
" google-cloud-pipeline-components \\\n",
|
||||
" google-cloud-pipeline-components==1.0.26 \\\n",
|
||||
" matplotlib \\\n",
|
||||
" pyarrow -q\n",
|
||||
"# Install the specified versions of the following packages\n",
|
||||
@@ -666,7 +668,7 @@
|
||||
"source": [
|
||||
"# Create a bigquery dataset\n",
|
||||
"bq_dataset = bigquery.Dataset(f\"{PROJECT_ID}.{PREDICTION_INPUT_DATASET_ID}\")\n",
|
||||
"bq_dataset = bq_client.create_dataset(bq_dataset)\n",
|
||||
"bq_dataset = bq_client.create_dataset(bq_dataset, exists_ok=True)\n",
|
||||
"print(f\"Created dataset {bq_client.project}.{bq_dataset.dataset_id}\")"
|
||||
]
|
||||
},
|
||||
@@ -1163,7 +1165,7 @@
|
||||
" location: str,\n",
|
||||
" root_dir: str,\n",
|
||||
" model_name: str,\n",
|
||||
" target_column_name: str,\n",
|
||||
" target_field_name: str,\n",
|
||||
" bigquery_source_input_uri: str,\n",
|
||||
" bigquery_destination_output_uri: str,\n",
|
||||
" batch_predict_instances_format: str,\n",
|
||||
@@ -1203,7 +1205,7 @@
|
||||
" root_dir=root_dir,\n",
|
||||
" bigquery_source_uri=data_sampler_task.outputs[\"bigquery_output_table\"],\n",
|
||||
" instances_format=batch_predict_instances_format,\n",
|
||||
" target_field_name=target_column_name,\n",
|
||||
" target_field_name=target_field_name,\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
" # Run the batch prediction task\n",
|
||||
@@ -1229,7 +1231,7 @@
|
||||
" class_labels=evaluation_class_names,\n",
|
||||
" prediction_label_column=evaluation_prediction_label_column,\n",
|
||||
" prediction_score_column=evaluation_prediction_score_column,\n",
|
||||
" target_field_name=target_column_name,\n",
|
||||
" target_field_name=target_field_name,\n",
|
||||
" ground_truth_format=batch_predict_instances_format,\n",
|
||||
" ground_truth_bigquery_source=data_sampler_task.outputs[\"bigquery_output_table\"],\n",
|
||||
" predictions_format=batch_predict_predictions_format,\n",
|
||||
@@ -1283,7 +1285,7 @@
|
||||
"- `location`: Region where the pipeline needs to be run. If not set, the pipeline defaults to the region that Vertex AI SDK is configured with.\n",
|
||||
"- `root_dir`: The Cloud Storage directory for keeping the staged files and artifacts. A random subdirectory is created under the directory to keep the job information for resuming the job in case of a failure.\n",
|
||||
"- `model_name`: Resource name of the trained custom tabular classification model.\n",
|
||||
"- `target_column_name`: Name of the column to be used as the ground truth for evaluation.\n",
|
||||
"- `target_field_name`: Name of the column to be used as the ground truth for evaluation.\n",
|
||||
"- `bigquery_source_input_uri`: BigQuery table URI where the test input is stored.\n",
|
||||
"- `bigquery_destination_output_uri`: BigQuery dataset URI for exporting predictions on the test set.\n",
|
||||
"- `batch_predict_instances_format`: Format of the input for batch prediction and evaluation.\n",
|
||||
@@ -1305,7 +1307,7 @@
|
||||
" \"location\": REGION,\n",
|
||||
" \"root_dir\": PIPELINE_ROOT,\n",
|
||||
" \"model_name\": aip_model.resource_name,\n",
|
||||
" \"target_column_name\": TARGET,\n",
|
||||
" \"target_field_name\": TARGET,\n",
|
||||
" \"bigquery_source_input_uri\": f\"bq://{PROJECT_ID}.{table_ref.dataset_id}.{table_ref.table_id}\",\n",
|
||||
" \"bigquery_destination_output_uri\": f\"bq://{PROJECT_ID}.{table_ref.dataset_id}\",\n",
|
||||
" \"batch_predict_instances_format\": \"bigquery\",\n",
|
||||
|
||||
+11
-9
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates how to use the Vertex AI regression model evaluation component to evaluate a custom regression model. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. "
|
||||
"This notebook demonstrates how to use the Vertex AI regression model evaluation component to evaluate a custom regression model. Model evaluation helps you determine your model performance based on the evaluation metrics and improve the model if necessary. \n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Model Evaluation](https://cloud.google.com/vertex-ai/docs/evaluation/introduction) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1518,7 +1520,7 @@
|
||||
"\n",
|
||||
"- `serving_input`: The name of the input layer of the underlying model.\n",
|
||||
"- `content`: The feature values of the test item as a list.\n",
|
||||
"- `ground_truth_column`: Give any name to this key. Use the same name in target_column_name in the below pipeline parameters.\n",
|
||||
"- `ground_truth_column`: Give any name to this key. Use the same name in target_field_name in the below pipeline parameters.\n",
|
||||
"- `value`: Ground truth value of this instance.\n",
|
||||
"\n",
|
||||
" "
|
||||
@@ -1600,14 +1602,14 @@
|
||||
"\n",
|
||||
"- `GetVertexModelOp`: Gets a Vertex AI Model resource Artifact. \n",
|
||||
"- `EvaluationDataSamplerOp`: Randomly downsamples an input dataset to a specified size for computing Vertex Explainable AI feature attributions for AutoML Tabular and custom models. Creates a Dataflow job with Apache Beam to downsample the dataset. \n",
|
||||
"- `TargetFieldDataRemoverOp`: Removes the target field from the input dataset for supporting unstructured AutoML models and custom models for Vertex Batch Prediction. Creates a Dataflow job with Apache Beam to remove the target field.. \n",
|
||||
"- `TargetFieldDataRemoverOp`: Removes the Ground Truth columns from the input dataset for supporting unstructured AutoML models and custom models in Batch Prediction. Creates a Dataflow job with Apache Beam to remove the ground truth columns. \n",
|
||||
"- `ModelBatchPredictOp`: Creates a Google Cloud Vertex BatchPredictionJob and waits for it to complete. \n",
|
||||
"- `ModelEvaluationRegressionOp`: Compute evaluation metrics on a trained model’s batch prediction results. Creates a Dataflow job with Apache Beam and TFMA to compute evaluation metrics. Supports regression for tabular data.\n",
|
||||
"- `ModelEvaluationFeatureAttributionOp`: Compute feature attribution on a trained model’s batch explanation results. Creates a Dataflow job with Apache Beam and TFMA to compute feature attributions. \n",
|
||||
"- `ModelImportEvaluationOp`: Imports a model evaluation artifact to an existing Vertex AI Model resource with ModelService.ImportModelEvaluation. \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Learn more about [Google Cloud Pipeline Model Evaluation components](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.20/google_cloud_pipeline_components.experimental.evaluation.html).\n",
|
||||
"Learn more about [Google Cloud Pipeline Model Evaluation components](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.26/google_cloud_pipeline_components.experimental.evaluation.html).\n",
|
||||
"\n",
|
||||
"##### Example workflow\n",
|
||||
"\n",
|
||||
@@ -1648,7 +1650,7 @@
|
||||
" location: str,\n",
|
||||
" root_dir: str,\n",
|
||||
" model_name: str,\n",
|
||||
" target_column_name: str,\n",
|
||||
" target_field_name: str,\n",
|
||||
" batch_predict_gcs_source_uris: list,\n",
|
||||
" batch_predict_instances_format: str,\n",
|
||||
" batch_predict_sample_size: int,\n",
|
||||
@@ -1682,7 +1684,7 @@
|
||||
" root_dir=root_dir,\n",
|
||||
" gcs_source_uris=data_sampler_task.outputs[\"gcs_output_directory\"],\n",
|
||||
" instances_format=batch_predict_instances_format,\n",
|
||||
" target_field_name=target_column_name,\n",
|
||||
" target_field_name=target_field_name,\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
" # Run Batch Explanations\n",
|
||||
@@ -1711,7 +1713,7 @@
|
||||
" ground_truth_gcs_source=data_sampler_task.outputs[\"gcs_output_directory\"],\n",
|
||||
" predictions_format=batch_predict_predictions_format,\n",
|
||||
" prediction_score_column=\"prediction\",\n",
|
||||
" target_field_name=target_column_name,\n",
|
||||
" target_field_name=target_field_name,\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
" # Get Feature Attributions\n",
|
||||
@@ -1773,7 +1775,7 @@
|
||||
"- `location`: Region where the pipeline is run.\n",
|
||||
"- `root_dir`: The Cloud Storage directory for keeping staging files and artifacts. A random subdirectory will be created under the directory to keep job info for resuming the job in case of failure.\n",
|
||||
"- `model_name`: Resource name of the trained Custom Tabular Regression model.\n",
|
||||
"- `target_column_name`: Name of the column to be used as the target for regression.\n",
|
||||
"- `target_field_name`: Name of the column to be used as the target for regression.\n",
|
||||
"- `batch_predict_gcs_source_uris`: List of the Cloud Storage bucket uris of input instances for batch prediction.\n",
|
||||
"- `batch_predict_instances_format`: Format of the input instances for batch prediction. Can be \"jsonl\", \"csv\" or \"bigquery\".\n",
|
||||
"- `batch_predict_explanation_data_sample_size`: Size of the samples to be considered for batch prediction and evaluation.\n"
|
||||
@@ -1794,7 +1796,7 @@
|
||||
" \"location\": REGION,\n",
|
||||
" \"root_dir\": PIPELINE_ROOT,\n",
|
||||
" \"model_name\": model.resource_name,\n",
|
||||
" \"target_column_name\": \"MEDV\",\n",
|
||||
" \"target_field_name\": \"MEDV\",\n",
|
||||
" \"batch_predict_gcs_source_uris\": [\n",
|
||||
" BUCKET_URI + \"/\" + \"test_file_with_ground_truth.jsonl\"\n",
|
||||
" ],\n",
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to train a model with BigQuery ML and upload it on Vertex AI Model Registry, then make batch predictions.\n"
|
||||
"This tutorial demonstrates how to train a model with BigQuery ML and upload it on Vertex AI Model Registry, then make batch predictions.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Model Registry](https://cloud.google.com/vertex-ai/docs/model-registry/introduction) and [BigQuery ML](https://cloud.google.com/bigquery-ml/docs/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -66,7 +66,9 @@
|
||||
"\n",
|
||||
"You build a pipeline in this notebook that looks like this:\n",
|
||||
"\n",
|
||||
"<a href=\"https://storage.googleapis.com/amy-jo/images/mp/beans.png\" target=\"_blank\"><img src=\"https://storage.googleapis.com/amy-jo/images/mp/beans.png\" width=\"95%\"/></a>"
|
||||
"<a href=\"https://storage.googleapis.com/amy-jo/images/mp/beans.png\" target=\"_blank\"><img src=\"https://storage.googleapis.com/amy-jo/images/mp/beans.png\" width=\"95%\"/></a>\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [AutoML components](https://cloud.google.com/vertex-ai/docs/pipelines/vertex-automl-component)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebooks shows how to use [the Kubeflow Pipelines (KFP) SDK](https://www.kubeflow.org/docs/components/pipelines/) to build [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) that use control structures."
|
||||
"This notebooks shows how to use [the Kubeflow Pipelines (KFP) SDK](https://www.kubeflow.org/docs/components/pipelines/) to build [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) that use control structures.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -63,7 +63,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use Vertex AI Pipelines with pre-built Google Cloud Pipeline Components for custom training."
|
||||
"This tutorial demonstrates how to use Vertex AI Pipelines with pre-built Google Cloud Pipeline Components for custom training.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [Vertex AI Training components](https://cloud.google.com/vertex-ai/docs/training/create-training-pipeline)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook demonstrates performing training and batch prediction for a custom tabular classification model inside a Vertex AI pipeline. The batch prediction job takes data from a BigQuery source and writes the results to a BigQuery destination."
|
||||
"This notebook demonstrates performing training and batch prediction for a custom tabular classification model inside a Vertex AI pipeline. The batch prediction job takes data from a BigQuery source and writes the results to a BigQuery destination.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [Vertex AI Batch Prediction components](https://cloud.google.com/vertex-ai/docs/pipelines/batchprediction-component)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook shows how to use the components defined in [`google_cloud_pipeline_components`](https://github.com/kubeflow/pipelines/tree/master/components/google-cloud) to build an `AutoML` image classification workflow on [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines)."
|
||||
"This notebook shows how to use the components defined in [`google_cloud_pipeline_components`](https://github.com/kubeflow/pipelines/tree/master/components/google-cloud) to build an `AutoML` image classification workflow on [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines).\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [AutoML components](https://cloud.google.com/vertex-ai/docs/pipelines/vertex-automl-component)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook shows how to use the components defined in [`google_cloud_pipeline_components`](https://github.com/kubeflow/pipelines/tree/master/components/google-cloud) to build an AutoML tabular regression workflow on [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines)."
|
||||
"This notebook shows how to use the components defined in [`google_cloud_pipeline_components`](https://github.com/kubeflow/pipelines/tree/master/components/google-cloud) to build an AutoML tabular regression workflow on Vertex AI Pipelines.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [AutoML components](https://cloud.google.com/vertex-ai/docs/pipelines/vertex-automl-component)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook shows how to use the components defined in [`google_cloud_pipeline_components`](https://github.com/kubeflow/pipelines/tree/master/components/google-cloud) to build an AutoML text classification workflow on [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines)."
|
||||
"This notebook shows how to use the components defined in [`google_cloud_pipeline_components`](https://github.com/kubeflow/pipelines/tree/master/components/google-cloud) to build an AutoML text classification workflow on [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines).\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [AutoML components](https://cloud.google.com/vertex-ai/docs/pipelines/vertex-automl-component)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -70,7 +70,9 @@
|
||||
"3. Apply the Swivel model to generate embeddings of your document’s content.\n",
|
||||
"4. Train a Logistic regression model to classify if an article is about corporate acquisitions (`acq` category). \n",
|
||||
"5. Evaluate the model.\n",
|
||||
"6. Apply the model to a dataset in order to generate predictions."
|
||||
"6. Apply the model to a dataset in order to generate predictions.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [BigQuery ML components](https://cloud.google.com/vertex-ai/docs/pipelines/bigqueryml-component)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook shows how to build a Spark ML pipeline using Spark MLlib and DataprocPySparkBatchOp component to determine the customer eligibility for a loan from a banking company. In particular, the pipeline covers a Spark MLib pipeline, from data preprocessing to hyperparameter tuning of a random forest classifier which predicts the probability of a customer being eligible for a loan. "
|
||||
"This notebook shows how to build a Spark ML pipeline using Spark MLlib and DataprocPySparkBatchOp component to determine the customer eligibility for a loan from a banking company. In particular, the pipeline covers a Spark MLib pipeline, from data preprocessing to hyperparameter tuning of a random forest classifier which predicts the probability of a customer being eligible for a loan. \n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [Dataproc components](https://cloud.google.com/vertex-ai/docs/pipelines/dataproc-component)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook shows how to use the components defined in [`google_cloud_pipeline_components`](https://github.com/kubeflow/pipelines/tree/master/components/google-cloud) to build a [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) workflow that trains a [custom model](https://cloud.google.com/vertex-ai/docs/training/containers-overview), uploads the model as a `Model` resource, creates an `Endpoint` resource, and deploys the `Model` resource to the `Endpoint` resource."
|
||||
"This notebook shows how to use the components defined in [`google_cloud_pipeline_components`](https://github.com/kubeflow/pipelines/tree/master/components/google-cloud) to build a [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) workflow that trains a [custom model](https://cloud.google.com/vertex-ai/docs/training/containers-overview), uploads the model as a `Model` resource, creates an `Endpoint` resource, and deploys the `Model` resource to the `Endpoint` resource.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [Vertex AI Training components](https://cloud.google.com/vertex-ai/docs/pipelines/customjob-component)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook shows how to use the components defined in [`google_cloud_pipeline_components`](https://github.com/kubeflow/pipelines/tree/master/components/google-cloud) in conjunction with an experimental `evaluation` method, to build a [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) workflow that uploads a tabular custom model as a `Model` resource, creates a `BatchPredictionJob` resource, and evaluates the `Model` resource with the `BatchPredictionJob` results to create an evaluation `system.Metrics` artifact."
|
||||
"This notebook shows how to use the components defined in [`google_cloud_pipeline_components`](https://github.com/kubeflow/pipelines/tree/master/components/google-cloud) in conjunction with an experimental `evaluation` method, to build a [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) workflow that uploads a tabular custom model as a `Model` resource, creates a `BatchPredictionJob` resource, and evaluates the `Model` resource with the `BatchPredictionJob` results to create an evaluation `system.Metrics` artifact.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction) and [Vertex AI Model components](https://cloud.google.com/vertex-ai/docs/pipelines/model-endpoint-component)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebooks shows how to use [the Kubeflow Pipelines (KFP) SDK](https://www.kubeflow.org/docs/components/pipelines/) to build [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) that use lightweight Python function based components, as well as supporting component I/O using the KFP SDK."
|
||||
"This notebooks shows how to use [the Kubeflow Pipelines (KFP) SDK](https://www.kubeflow.org/docs/components/pipelines/) to build [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) that use lightweight Python function based components, as well as supporting component I/O using the KFP SDK.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook shows how to use [the Kubeflow Pipelines (KFP) SDK](https://www.kubeflow.org/docs/components/pipelines/) to build [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) that generate model metrics and metrics visualizations, and comparing pipeline runs."
|
||||
"This notebook shows how to use [the Kubeflow Pipelines (KFP) SDK](https://www.kubeflow.org/docs/components/pipelines/) to build [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) that generate model metrics and metrics visualizations, and comparing pipeline runs.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook provides an introduction to using [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) with [the Kubeflow Pipelines (KFP) SDK](https://www.kubeflow.org/docs/components/pipelines/)."
|
||||
"This notebook provides an introduction to using [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines) with [the Kubeflow Pipelines (KFP) SDK](https://www.kubeflow.org/docs/components/pipelines/).\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -72,7 +72,9 @@
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train a custom tabular classification model and perform batch prediction with feature filtering. This means that you can run batch prediction on a list of selected features or exclude a list of features from prediction."
|
||||
"This tutorial demonstrates how to use the Vertex AI SDK for Python to train a custom tabular classification model and perform batch prediction with feature filtering. This means that you can run batch prediction on a list of selected features or exclude a list of features from prediction.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Batch Prediction](https://cloud.google.com/vertex-ai/docs/tabular-data/classification-regression/get-batch-predictions)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -63,7 +63,9 @@
|
||||
"\n",
|
||||
"This notebook demonstrates building and deploying a text sentiment classification model by fine-tuing a pre-trained [BERT](https://huggingface.co/bert-base-cased) model using Vertex AI and Pytorch SDK. This example is inspired by the Hugging Face [Token_Classification](https://github.com/huggingface/notebooks/blob/master/examples/token_classification.ipynb) and [Run_Glue](https://github.com/huggingface/transformers/blob/v2.5.0/examples/run_glue.py) notebooks. \n",
|
||||
"\n",
|
||||
"You can find more details about the model at [Hugging Face Hub](https://huggingface.co/bert-base-cased). For more notebooks with the state of the art PyTorch/Tensorflow/JAX, you can explore [Hugging FaceNotebooks](https://huggingface.co/transformers/notebooks.html).\n"
|
||||
"You can find more details about the model at [Hugging Face Hub](https://huggingface.co/bert-base-cased). For more notebooks with the state of the art PyTorch/Tensorflow/JAX, you can explore [Hugging FaceNotebooks](https://huggingface.co/transformers/notebooks.html).\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"When you run a distributed training job across multiple nodes using GPUs, communicating gradients between nodes can contribute significant latency. Reduction Server is an all-reduce algorithm that can increase throughput and reduce latency for distributed training. This notebook demonstrates how to run a PyTorch distributed training job with Reduction Server on Vertex AI. The training job is created to fine-tune pretrained model `bert-large-cased` from the Hugging Face Transformers library on the `imdb` dataset for sentiment classification."
|
||||
"When you run a distributed training job across multiple nodes using GPUs, communicating gradients between nodes can contribute significant latency. Reduction Server is an all-reduce algorithm that can increase throughput and reduce latency for distributed training. This notebook demonstrates how to run a PyTorch distributed training job with Reduction Server on Vertex AI. The training job is created to fine-tune pretrained model `bert-large-cased` from the Hugging Face Transformers library on the `imdb` dataset for sentiment classification.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training) and [Vertex AI Reduction Server](https://cloud.google.com/blog/topics/developers-practitioners/optimize-training-performance-reduction-server-vertex-ai)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,9 @@
|
||||
"\n",
|
||||
"This notebook demonstrates how to create an AutoML Video Classification Model, with a Vertex AI video dataset, and how to serve the model for batch prediction. It requires you provide a bucket where the dataset will be stored.\n",
|
||||
"\n",
|
||||
"Note: you may incur charges for training, prediction, storage or usage of other GCP products in connection with testing this SDK."
|
||||
"Note: you may incur charges for training, prediction, storage or usage of other GCP products in connection with testing this SDK.\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML Video](https://cloud.google.com/vertex-ai/docs/tutorials/video-classification-automl/training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -62,7 +62,9 @@
|
||||
"\n",
|
||||
"This notebook demonstrates how to create a Custom Model using Custom Python Package Training, with a Vertex AI Dataset, and how to serve the model using TensorFlow-Serving Container for online prediction, and batch prediction. It requires you to provide a bucket where the dataset will be stored.\n",
|
||||
"\n",
|
||||
"Note: You may incur charges for training, prediction, storage or usage of other GCP products in connection with testing this SDK.\n"
|
||||
"Note: You may incur charges for training, prediction, storage or usage of other GCP products in connection with testing this SDK.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -64,7 +64,9 @@
|
||||
"This tutorial demonstrates how to use Vertex AI Pipelines to rapid prototype a model using both AutoML and BQML, do an evaluation comparison, for a baseline, before progressing to a custom model.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"<img src=\"https://storage.googleapis.com/rafacarv-public-bucket-do-not-delete/abalone/automl_and_bqml.png\" />"
|
||||
"<img src=\"https://storage.googleapis.com/rafacarv-public-bucket-do-not-delete/abalone/automl_and_bqml.png\" />\n",
|
||||
"\n",
|
||||
"Learn more about [AutoML](https://cloud.google.com/vertex-ai/docs/start/automl-users) and [BigQuery ML](https://cloud.google.com/bigquery-ml/docs/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -63,7 +63,9 @@
|
||||
"\n",
|
||||
"Vertex AI provides a algorithm called on [TabNet] (https://arxiv.org/abs/1908.07442). TabNet is an interpretable deep learning architecture for tabular (structured) data, the most common data type among enterprises. TabNet combines the best of two worlds: it is explainable, like simpler tree-based models, and can achieve the high accuracy of complex black-box models and ensembles, meaning it is precise without obscuring how the model works. This makes TabNet well-suited for a wide range of tabular data tasks where model explainability is just as important as accuracy.\n",
|
||||
"\n",
|
||||
"The goal of the tutorial is to provide a sample plotting tool to visualize the output of TabNet, which is helpful in explaining the algorithm.\n"
|
||||
"The goal of the tutorial is to provide a sample plotting tool to visualize the output of TabNet, which is helpful in explaining the algorithm.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI TabNet](https://cloud.google.com/vertex-ai/docs/tabular-data/tabular-workflows/tabnet) and [Vertex Explainable AI](https://cloud.google.com/vertex-ai/docs/explainable-ai/overview)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -65,7 +65,9 @@
|
||||
"\n",
|
||||
"TabNet combines the best of two worlds: it is explainable (similar to simpler tree-based models) while benefiting from high performance (similar to deep neural networks). This makes it great for retailers, finance and insurance industry applications such as predicting credit scores, fraud detection and forecasting. \n",
|
||||
"\n",
|
||||
"TabNet uses a machine learning technique called sequential attention to select which model features to reason from at each step in the model. This mechanism makes it possible to explain how the model arrives at its predictions and helps it learn more accurate models. Thanks to this design, TabNet not only outperforms other neural networks and decision trees but also provides interpretable feature attributions. Releasing TabNet as a First Party Trainer in Vertex AI means you'll be able to easily take advantage of TabNet's architecture and explainability and use it to train models on your own data. "
|
||||
"TabNet uses a machine learning technique called sequential attention to select which model features to reason from at each step in the model. This mechanism makes it possible to explain how the model arrives at its predictions and helps it learn more accurate models. Thanks to this design, TabNet not only outperforms other neural networks and decision trees but also provides interpretable feature attributions. Releasing TabNet as a First Party Trainer in Vertex AI means you'll be able to easily take advantage of TabNet's architecture and explainability and use it to train models on your own data. \n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI TabNet](https://cloud.google.com/vertex-ai/docs/tabular-data/tabular-workflows/tabnet) and [Vertex AI Hyperparameter Tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook showcases how to run the TabNet algorithm using Vertex AI Tabular Workflows.\n"
|
||||
"This notebook showcases how to run the TabNet algorithm using Vertex AI Tabular Workflows.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI TabNet](https://cloud.google.com/vertex-ai/docs/tabular-data/tabular-workflows/tabnet) and [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -128,7 +130,7 @@
|
||||
"source": [
|
||||
"### Set up your local development environment\n",
|
||||
"\n",
|
||||
"**If you are using Colab or Vertex AI SDK Workbench Notebooks**, your environment already meets\n",
|
||||
"**If you are using Colab or Vertex AI Workbench Notebooks**, your environment already meets\n",
|
||||
"all the requirements to run this notebook. You can skip this step.\n",
|
||||
"\n",
|
||||
"**Otherwise**, make sure your environment meets this notebook's requirements.\n",
|
||||
@@ -170,7 +172,7 @@
|
||||
"source": [
|
||||
"## Installation\n",
|
||||
"\n",
|
||||
"Install the following packages required to execute this notebook. "
|
||||
"Install the following packages required to execute this notebook."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -194,8 +196,7 @@
|
||||
"if IS_WORKBENCH_NOTEBOOK:\n",
|
||||
" USER_FLAG = \"--user\"\n",
|
||||
"\n",
|
||||
"! pip3 install --upgrade google-cloud-aiplatform {USER_FLAG} -q\n",
|
||||
"! pip3 install --upgrade google-cloud-pipeline-components -q"
|
||||
"! pip3 install --upgrade google-cloud-aiplatform google-cloud-pipeline-components {USER_FLAG} -q\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -376,7 +377,7 @@
|
||||
"### Authenticate your Google Cloud account\n",
|
||||
"\n",
|
||||
"**If you are using Vertex AI Workbench Notebooks**, your environment is already\n",
|
||||
"authenticated. \n",
|
||||
"authenticated.\n",
|
||||
"\n",
|
||||
"**If you are using Colab**, run the cell below and follow the instructions when prompted to authenticate your account via oAuth.\n",
|
||||
"\n",
|
||||
@@ -601,7 +602,6 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Import required modules\n",
|
||||
"import json\n",
|
||||
"from typing import Any, Dict, List\n",
|
||||
"\n",
|
||||
"from google.cloud import aiplatform, storage\n",
|
||||
@@ -615,9 +615,9 @@
|
||||
"id": "c0423f260423"
|
||||
},
|
||||
"source": [
|
||||
"## Initialize Vertex SDK for Python\n",
|
||||
"## Initialize Vertex AI SDK for Python\n",
|
||||
"\n",
|
||||
"Initialize the Vertex SDK for Python for your project."
|
||||
"Initialize the Vertex AI SDK for Python for your project."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -637,7 +637,18 @@
|
||||
"id": "3LWH3PRF5o2v"
|
||||
},
|
||||
"source": [
|
||||
"### Define helper functions"
|
||||
"### Define helper functions",
|
||||
"\n",
|
||||
"Define the following helper functions:\n",
|
||||
"\n",
|
||||
"- `get_model_artifacts_path`: Get the model artifacts path from task details.\n",
|
||||
"- `get_model_uri`: Get the model uri from the task details..\n",
|
||||
"- `get_bucket_name_and_path`: Get the bucket name and path.\n",
|
||||
"- `download_from_gcs`: Download the content from the bucket.\n",
|
||||
"- `write_to_gcs`: Upload content into the bucket.\n",
|
||||
"- `get_task_detail`: Get the task details by using task name.\n",
|
||||
"- `get_model_name`: Get the model name from pipeline job ID.\n",
|
||||
"- `get_evaluation_metrics`: Get the evaluation metrics from pipeline task details.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -648,7 +659,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Get the mdoel artifacts path from task details.\n",
|
||||
"# Get the model artifacts path from task details.\n",
|
||||
"def get_model_artifacts_path(task_details: List[Dict[str, Any]], task_name: str) -> str:\n",
|
||||
" task = get_task_detail(task_details, task_name)\n",
|
||||
" return task.outputs[\"unmanaged_container_model\"].artifacts[0].uri\n",
|
||||
@@ -678,7 +689,7 @@
|
||||
" return blob.download_as_string()\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# Upload content in to the bucket.\n",
|
||||
"# Upload content into the bucket.\n",
|
||||
"def write_to_gcs(uri: str, content: str):\n",
|
||||
" bucket_name, path = get_bucket_name_and_path(uri)\n",
|
||||
" storage_client = storage.Client()\n",
|
||||
@@ -696,7 +707,7 @@
|
||||
" return task_detail\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# Get the model name from pipeline task details.\n",
|
||||
"# Get the model name from pipeline job ID.\n",
|
||||
"def get_model_name(job_id: str) -> str:\n",
|
||||
" pipeline_task_details = aiplatform.PipelineJob.get(\n",
|
||||
" job_id\n",
|
||||
@@ -721,7 +732,7 @@
|
||||
"id": "gvNFMRmBegZq"
|
||||
},
|
||||
"source": [
|
||||
"## Define training specification"
|
||||
"## Define the training specification"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -730,12 +741,14 @@
|
||||
"id": "7a7332a3f8e2"
|
||||
},
|
||||
"source": [
|
||||
"### Configure dataset\n",
|
||||
"### Configure the dataset\n",
|
||||
"\n",
|
||||
"You define either of the following parameters:\n",
|
||||
"\n",
|
||||
"- `data_source_csv_filenames`: The CSV data source.\n",
|
||||
"- `data_source_bigquery_table_path`: The BigQuery data source.\n"
|
||||
"- `data_source_bigquery_table_path`: The BigQuery data source.\n",
|
||||
"\n",
|
||||
"***Notes***: Please note that the dataset's location has to be the same as the same as the service location (i.e., `REGION`) set for launching the training pipeline.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -760,9 +773,20 @@
|
||||
"source": [
|
||||
"### Configure feature transformation\n",
|
||||
"\n",
|
||||
"Transformations can be specified using Feature Transform Engine (FTE) specific configurations. Below, you configure full auto transformations (i.e., `auto_transform_config`). FTE automatically configures a set of built-in transformations for each input column based on its data statistics. \n",
|
||||
"Transformations can be specified using Feature Transform Engine (FTE) specific configurations. FTE supports both TensorFlow-based row-level and BigQuery-based dataset-level transformations.\n",
|
||||
"\n",
|
||||
"For a complete list of supported feature transformation configs and examples, please go [here](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.15/google_cloud_pipeline_components.experimental.automl.tabular.html#google_cloud_pipeline_components.experimental.automl.tabular.FeatureTransformEngineOp)."
|
||||
"* TensorFlow-based row-level transformations:\n",
|
||||
" * Full automatic transformations: FTE automatically configures a set of built-in transformations for each input column based on its data statistics. This can be set via `tf_auto_transform_features` in the training pipeline.\n",
|
||||
" * Fully specified transformations: All transformations on input columns are explicitly specified with FTE's built-in transformations. Chaining of multiple transformations on a single column is also supported. These transformations can be saved to JSON configuration file and specified via `tf_transformations_path` argument of the training pipeline.\n",
|
||||
" * Custom transformations: Custom, bring-your-own transform function, where you can define and import your own transform function and use it with other FTE's built-in transformations. You can specify custom transformations as an array of JSON object and pass through the `tf_custom_transformation_definitions` argument of the training pipeline.\n",
|
||||
"\n",
|
||||
"* BigQuery-based dataset-level transformations:\n",
|
||||
" * Fully specified transformations: All transformations on input columns are explicitly specified with FTE's built-in transformations. These transformations can be specified as an array of JSON objects via `dataset_level_transformations` argument of the training pipeline.\n",
|
||||
" * Custom transformations: Custom, bring-your-own transform function, where you can define and import your own transform function and use it with other FTE's built-in transformations. You can specify custom transformations as an array of JSON object and pass through the `dataset_level_custom_transformation_definitions` argument of the training pipeline.\n",
|
||||
"\n",
|
||||
"Below, you configure full automatic transformations by specifying a list of input features to pass to the `tf_auto_transform_features` argument of the training pipeline.\n",
|
||||
"\n",
|
||||
"For a complete list of supported feature transformation configurations and examples, please go [here](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.31/google_cloud_pipeline_components.experimental.automl.tabular.html#google_cloud_pipeline_components.experimental.automl.tabular.FeatureTransformEngineOp)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -773,7 +797,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"features = [\n",
|
||||
"auto_transform_features = [\n",
|
||||
" \"age\",\n",
|
||||
" \"job\",\n",
|
||||
" \"marital\",\n",
|
||||
@@ -790,9 +814,39 @@
|
||||
" \"pdays\",\n",
|
||||
" \"previous\",\n",
|
||||
" \"poutcome\",\n",
|
||||
"]\n",
|
||||
"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "-t1fAaCFs8Os"
|
||||
},
|
||||
"source": [
|
||||
"### Configure feature selection\n",
|
||||
"\n",
|
||||
"auto_transform_config = {\"auto_transforms\": features}"
|
||||
"In addition to transformations, you can also apply feature selection via Feature Transform Engine to use only highly ranked features, evaluated by supported algorithms. If enabled, it will be applied right after dataset level transformations, and exclude any feature that's not selected.\n",
|
||||
"\n",
|
||||
"To enable it, you need to set `run_feature_selection` to True.\n",
|
||||
"\n",
|
||||
"To configure the algorihtm to use, and number of features to be selected, you need to configure both `feature_selection_algorithm` and `max_selected_features` parameter.\n",
|
||||
"\n",
|
||||
"For a complete list of supported feature selection algorithms and configurations, please go [here](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.31/google_cloud_pipeline_components.experimental.automl.tabular.html#google_cloud_pipeline_components.experimental.automl.tabular.FeatureTransformEngineOp)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "YroYjOTJwytk"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"RUN_FEATURE_SELECTION = True # @param {type:\"boolean\"}\n",
|
||||
"\n",
|
||||
"FEATURE_SELECTION_ALGORITHM = \"AMI\" # @param {type:\"string\"}\n",
|
||||
"\n",
|
||||
"MAX_SELECTED_FEATURES = 10 # @param {type:\"integer\"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -808,7 +862,6 @@
|
||||
"- `target_column`: The target column name.\n",
|
||||
"- `prediction_type`: The type of prediction the model is to produce.\n",
|
||||
" 'classification' or 'regression'.\n",
|
||||
"- `transform_config`: The path to a GCS file containing the transformations to apply.\n",
|
||||
"- `predefined_split_key`: The predefined_split column name.\n",
|
||||
"- `timestamp_split_key`: The timestamp_split column name.\n",
|
||||
"- `stratified_split_key`: The stratified_split column name.\n",
|
||||
@@ -848,9 +901,7 @@
|
||||
" validation_fraction = None\n",
|
||||
" test_fraction = None\n",
|
||||
"\n",
|
||||
"weight_column = None\n",
|
||||
"\n",
|
||||
"transform_config = auto_transform_config"
|
||||
"weight_column = None"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -902,7 +953,7 @@
|
||||
"source": [
|
||||
"## Customize TabNet CustomJob configuration and create pipeline\n",
|
||||
"\n",
|
||||
"This is best choice if you know exactly which hyperparameter values to use for model training. It uses fewer training resources than a HyperparameterTuningJob. \n",
|
||||
"This is best choice if you know exactly which hyperparameter values to use for model training. It uses fewer training resources than a HyperparameterTuningJob.\n",
|
||||
"\n",
|
||||
"In the example below, you configure the following:\n",
|
||||
"\n",
|
||||
@@ -934,9 +985,6 @@
|
||||
"\n",
|
||||
"learning_rate = 0.01\n",
|
||||
"\n",
|
||||
"transform_config_path = os.path.join(pipeline_job_root_dir, \"transform_config.json\")\n",
|
||||
"write_to_gcs(transform_config_path, json.dumps(transform_config))\n",
|
||||
"\n",
|
||||
"worker_pool_specs_override = [\n",
|
||||
" {\"machine_spec\": {\"machine_type\": \"c2-standard-16\"}} # Override for TF chief node\n",
|
||||
"]\n",
|
||||
@@ -965,7 +1013,10 @@
|
||||
" learning_rate=learning_rate,\n",
|
||||
" target_column=target_column,\n",
|
||||
" prediction_type=prediction_type,\n",
|
||||
" transform_config=transform_config_path,\n",
|
||||
" tf_auto_transform_features=auto_transform_features,\n",
|
||||
" run_feature_selection=RUN_FEATURE_SELECTION,\n",
|
||||
" feature_selection_algorithm=FEATURE_SELECTION_ALGORITHM,\n",
|
||||
" max_selected_features=MAX_SELECTED_FEATURES,\n",
|
||||
" training_fraction=training_fraction,\n",
|
||||
" validation_fraction=validation_fraction,\n",
|
||||
" test_fraction=test_fraction,\n",
|
||||
@@ -1029,7 +1080,7 @@
|
||||
"source": [
|
||||
"## Customize TabNet HyperparameterTuningJob configuration and create pipeline\n",
|
||||
"\n",
|
||||
"To get the best set of hyperparameters for your dataset, you recommend running a HyperparameterTuningJob.\n",
|
||||
"To get the best set of hyperparameters for your dataset, it is recommended to run a HyperparameterTuningJob.\n",
|
||||
"\n",
|
||||
"Hyperparameters that can be tuned are set in the optional `study_spec_parameters_override` parameter. you provide a helper function called `get_tabnet_study_spec_parameters_override` to get these hyperparameters. You provide `dataset_size_bucket` (one of 'small' (< 1M rows), 'medium' (1M - 100M rows), or 'large' (> 100M rows)), `training_budget_bucket` (one of 'small' (< \\\\$600), 'medium' (\\\\$600 - \\\\$2400), or 'large' (> \\\\$2400)), and `prediction_type` and Vertex AI returns a list of hyperparameters and ranges. `study_spec_parameters_override` can be empty or one or more of these hyperparameters can be specified. For hyperparameters not specified in `study_spec_parameters_override`, you set ranges in the pipeline. For a full list of hyperparameters available for tuning, see [here](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.23/google_cloud_pipeline_components.experimental.automl.tabular.html#google_cloud_pipeline_components.experimental.automl.tabular.utils.get_tabnet_trainer_pipeline_and_parameters).\n",
|
||||
"\n",
|
||||
@@ -1047,7 +1098,7 @@
|
||||
"\n",
|
||||
"For a full list of HyperparameterTuningJob parameters, see [here](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.23/google_cloud_pipeline_components.experimental.automl.tabular.html#google_cloud_pipeline_components.experimental.automl.tabular.utils.get_tabnet_hyperparameter_tuning_job_pipeline_and_parameters).\n",
|
||||
"\n",
|
||||
"Multiple trials can be configured. The pipeline returns the best trial based on the metric configured in `study_spec_metrics`. In the example below, you return the trial with the lowest loss value. "
|
||||
"Multiple trials can be configured. The pipeline returns the best trial based on the metric configured in `study_spec_metrics`. In the example below, you return the trial with the lowest loss value."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1101,7 +1152,10 @@
|
||||
" root_dir=pipeline_job_root_dir,\n",
|
||||
" target_column=target_column,\n",
|
||||
" prediction_type=prediction_type,\n",
|
||||
" transform_config=transform_config_path,\n",
|
||||
" tf_auto_transform_features=auto_transform_features,\n",
|
||||
" run_feature_selection=RUN_FEATURE_SELECTION,\n",
|
||||
" feature_selection_algorithm=FEATURE_SELECTION_ALGORITHM,\n",
|
||||
" max_selected_features=MAX_SELECTED_FEATURES,\n",
|
||||
" training_fraction=training_fraction,\n",
|
||||
" validation_fraction=validation_fraction,\n",
|
||||
" test_fraction=test_fraction,\n",
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
"source": [
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
"This notebook showcases how to run the Wide & Deep algorithm using Vertex AI Tabular Workflows.\n"
|
||||
"This notebook showcases how to run the Wide & Deep algorithm using Vertex AI Tabular Workflows.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI Wide & Deep](https://cloud.google.com/vertex-ai/docs/tabular-data/tabular-workflows/wide-and-deep) and [Vertex AI Pipelines](https://cloud.google.com/vertex-ai/docs/pipelines/introduction)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -170,7 +172,7 @@
|
||||
"source": [
|
||||
"## Installation\n",
|
||||
"\n",
|
||||
"Install the following packages required to execute this notebook. "
|
||||
"Install the following packages required to execute this notebook."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -194,8 +196,7 @@
|
||||
"if IS_WORKBENCH_NOTEBOOK:\n",
|
||||
" USER_FLAG = \"--user\"\n",
|
||||
"\n",
|
||||
"! pip3 install --upgrade google-cloud-aiplatform {USER_FLAG} -q\n",
|
||||
"! pip3 install --upgrade google-cloud-pipeline-components -q"
|
||||
"! pip3 install --upgrade google-cloud-aiplatform google-cloud-pipeline-components {USER_FLAG} -q\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -376,7 +377,7 @@
|
||||
"### Authenticate your Google Cloud account\n",
|
||||
"\n",
|
||||
"**If you are using Vertex AI Workbench Notebooks**, your environment is already\n",
|
||||
"authenticated. \n",
|
||||
"authenticated.\n",
|
||||
"\n",
|
||||
"**If you are using Colab**, run the cell below and follow the instructions when prompted to authenticate your account via oAuth.\n",
|
||||
"\n",
|
||||
@@ -530,7 +531,6 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Import required modules\n",
|
||||
"import json\n",
|
||||
"from typing import Any, Dict, List\n",
|
||||
"\n",
|
||||
"from google.cloud import aiplatform, storage\n",
|
||||
@@ -544,9 +544,9 @@
|
||||
"id": "c0423f260423"
|
||||
},
|
||||
"source": [
|
||||
"## Initialize Vertex SDK for Python\n",
|
||||
"## Initialize Vertex AI SDK for Python\n",
|
||||
"\n",
|
||||
"Initialize the Vertex SDK for Python for your project."
|
||||
"Initialize the Vertex AI SDK for Python for your project."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -566,7 +566,18 @@
|
||||
"id": "3LWH3PRF5o2v"
|
||||
},
|
||||
"source": [
|
||||
"### Define helper functions"
|
||||
"### Define helper functions",
|
||||
"\n",
|
||||
"Define the following helper functions:\n",
|
||||
"\n",
|
||||
"- `get_model_artifacts_path`: Get the model artifacts path from task details.\n",
|
||||
"- `get_model_uri`: Get the model uri from the task details..\n",
|
||||
"- `get_bucket_name_and_path`: Get the bucket name and path.\n",
|
||||
"- `download_from_gcs`: Download the content from the bucket.\n",
|
||||
"- `write_to_gcs`: Upload content into the bucket.\n",
|
||||
"- `get_task_detail`: Get the task details by using task name.\n",
|
||||
"- `get_model_name`: Get the model name from pipeline job ID.\n",
|
||||
"- `get_evaluation_metrics`: Get the evaluation metrics from pipeline task details.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -642,7 +653,7 @@
|
||||
"id": "gvNFMRmBegZq"
|
||||
},
|
||||
"source": [
|
||||
"## Define training specification"
|
||||
"## Define the training specification"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -651,12 +662,14 @@
|
||||
"id": "7a7332a3f8e2"
|
||||
},
|
||||
"source": [
|
||||
"### Configure dataset\n",
|
||||
"### Configure the dataset\n",
|
||||
"\n",
|
||||
"You define either of the following parameters:\n",
|
||||
"\n",
|
||||
"- `data_source_csv_filenames`: The CSV data source.\n",
|
||||
"- `data_source_bigquery_table_path`: The BigQuery data source.\n"
|
||||
"- `data_source_bigquery_table_path`: The BigQuery data source.\n",
|
||||
"\n",
|
||||
"***Notes***: Please note that the dataset's location has to be the same as the same as the service location (i.e., `REGION`) set for launching the training pipeline.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -681,9 +694,20 @@
|
||||
"source": [
|
||||
"### Configure feature transformation\n",
|
||||
"\n",
|
||||
"Transformations can be specified using Feature Transform Engine (FTE) specific configurations. Below, we configure full auto transformations (i.e., `auto_transform_config`). FTE automatically configures a set of built-in transformations for each input column based on its data statistics. \n",
|
||||
"Transformations can be specified using Feature Transform Engine (FTE) specific configurations. FTE supports both TensorFlow-based row-level and BigQuery-based dataset-level transformations.\n",
|
||||
"\n",
|
||||
"For a complete list of supported feature transformation configs and examples, please go [here](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.15/google_cloud_pipeline_components.experimental.automl.tabular.html#google_cloud_pipeline_components.experimental.automl.tabular.FeatureTransformEngineOp)."
|
||||
"* TensorFlow-based row-level transformations:\n",
|
||||
" * Full automatic transformations: FTE automatically configures a set of built-in transformations for each input column based on its data statistics. This can be set via `tf_auto_transform_features` in the training pipeline.\n",
|
||||
" * Fully specified transformations: All transformations on input columns are explicitly specified with FTE's built-in transformations. Chaining of multiple transformations on a single column is also supported. These transformations can be saved to JSON configuration file and specified via `tf_transformations_path` argument of the training pipeline.\n",
|
||||
" * Custom transformations: Custom, bring-your-own transform function, where you can define and import your own transform function and use it with other FTE's built-in transformations. You can specify custom transformations as an array of JSON object and pass through the `tf_custom_transformation_definitions` argument of the training pipeline.\n",
|
||||
"\n",
|
||||
"* BigQuery-based dataset-level transformations:\n",
|
||||
" * Fully specified transformations: All transformations on input columns are explicitly specified with FTE's built-in transformations. These transformations can be specified as an array of JSON objects via `dataset_level_transformations` argument of the training pipeline.\n",
|
||||
" * Custom transformations: Custom, bring-your-own transform function, where you can define and import your own transform function and use it with other FTE's built-in transformations. You can specify custom transformations as an array of JSON object and pass through the `dataset_level_custom_transformation_definitions` argument of the training pipeline.\n",
|
||||
"\n",
|
||||
"Below, you configure full automatic transformations by specifying a list of input features to pass to the `tf_auto_transform_features` argument of the training pipeline.\n",
|
||||
"\n",
|
||||
"For a complete list of supported feature transformation configurations and examples, please go [here](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.31/google_cloud_pipeline_components.experimental.automl.tabular.html#google_cloud_pipeline_components.experimental.automl.tabular.FeatureTransformEngineOp)."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -694,7 +718,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"features = [\n",
|
||||
"auto_transform_features = [\n",
|
||||
" \"age\",\n",
|
||||
" \"job\",\n",
|
||||
" \"marital\",\n",
|
||||
@@ -711,9 +735,39 @@
|
||||
" \"pdays\",\n",
|
||||
" \"previous\",\n",
|
||||
" \"poutcome\",\n",
|
||||
"]\n",
|
||||
"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "dgmd7dHi21Sb"
|
||||
},
|
||||
"source": [
|
||||
"### Configure feature selection\n",
|
||||
"\n",
|
||||
"auto_transform_config = {\"auto_transforms\": features}"
|
||||
"In addition to transformations, you can also apply feature selection via Feature Transform Engine to use only highly ranked features, evaluated by supported algorithms. If enabled, it will be applied right after dataset level transformations, and exclude any feature that's not selected.\n",
|
||||
"\n",
|
||||
"To enable it, you need to set `run_feature_selection` to True.\n",
|
||||
"\n",
|
||||
"To configure the algorihtm to use, and number of features to be selected, you need to configure both `feature_selection_algorithm` and `max_selected_features` parameter.\n",
|
||||
"\n",
|
||||
"For a complete list of supported feature selection algorithms and configs, please go [here](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.31/google_cloud_pipeline_components.experimental.automl.tabular.html#google_cloud_pipeline_components.experimental.automl.tabular.FeatureTransformEngineOp)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "drdGfJ4824pZ"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"RUN_FEATURE_SELECTION = True # @param {type:\"boolean\"}\n",
|
||||
"\n",
|
||||
"FEATURE_SELECTION_ALGORITHM = \"AMI\" # @param {type:\"string\"}\n",
|
||||
"\n",
|
||||
"MAX_SELECTED_FEATURES = 10 # @param {type:\"integer\"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -729,7 +783,6 @@
|
||||
"- `target_column`: The target column name.\n",
|
||||
"- `prediction_type`: The type of prediction the model is to produce.\n",
|
||||
" 'classification' or 'regression'.\n",
|
||||
"- `transform_config`: The path to a GCS file containing the transformations to apply.\n",
|
||||
"- `predefined_split_key`: The predefined_split column name.\n",
|
||||
"- `timestamp_split_key`: The timestamp_split column name.\n",
|
||||
"- `stratified_split_key`: The stratified_split column name.\n",
|
||||
@@ -769,9 +822,7 @@
|
||||
" validation_fraction = None\n",
|
||||
" test_fraction = None\n",
|
||||
"\n",
|
||||
"weight_column = None\n",
|
||||
"\n",
|
||||
"transform_config = auto_transform_config"
|
||||
"weight_column = None"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -823,7 +874,7 @@
|
||||
"source": [
|
||||
"## Customize Wide & Deep CustomJob configuration and create pipeline\n",
|
||||
"\n",
|
||||
"This is best choice if you know exactly which hyperparameter values to use for model training. It uses fewer training resources than a HyperparameterTuningJob. \n",
|
||||
"This is best choice if you know exactly which hyperparameter values to use for model training. It uses fewer training resources than a HyperparameterTuningJob.\n",
|
||||
"\n",
|
||||
"In the example below, you configure the following:\n",
|
||||
"\n",
|
||||
@@ -858,9 +909,6 @@
|
||||
"learning_rate = 0.01\n",
|
||||
"dnn_learning_rate = 0.01\n",
|
||||
"\n",
|
||||
"transform_config_path = os.path.join(pipeline_job_root_dir, \"transform_config.json\")\n",
|
||||
"write_to_gcs(transform_config_path, json.dumps(transform_config))\n",
|
||||
"\n",
|
||||
"worker_pool_specs_override = [\n",
|
||||
" {\"machine_spec\": {\"machine_type\": \"c2-standard-16\"}} # Override for TF chief node\n",
|
||||
"]\n",
|
||||
@@ -890,7 +938,10 @@
|
||||
" dnn_learning_rate=dnn_learning_rate,\n",
|
||||
" target_column=target_column,\n",
|
||||
" prediction_type=prediction_type,\n",
|
||||
" transform_config=transform_config_path,\n",
|
||||
" tf_auto_transform_features=auto_transform_features,\n",
|
||||
" run_feature_selection=RUN_FEATURE_SELECTION,\n",
|
||||
" feature_selection_algorithm=FEATURE_SELECTION_ALGORITHM,\n",
|
||||
" max_selected_features=MAX_SELECTED_FEATURES,\n",
|
||||
" training_fraction=training_fraction,\n",
|
||||
" validation_fraction=validation_fraction,\n",
|
||||
" test_fraction=test_fraction,\n",
|
||||
@@ -956,7 +1007,7 @@
|
||||
"source": [
|
||||
"## Customize Wide & Deep HyperparameterTuningJob configuration and create pipeline\n",
|
||||
"\n",
|
||||
"To get the best set of hyperparameters for your dataset, we recommend running a HyperparameterTuningJob.\n",
|
||||
"To get the best set of hyperparameters for your dataset, it isrecommended to run a HyperparameterTuningJob.\n",
|
||||
"\n",
|
||||
"Hyperparameters that can be tuned are set in the optional `study_spec_parameters_override` parameter. We provide a helper function called `get_wide_and_deep_study_spec_parameters_override` to get these hyperparameters. The function returns a list of hyperparameters and ranges. `study_spec_parameters_override` can be empty or one or more of these hyperparameters can be specified. For hyperparameters not specified in `study_spec_parameters_override`, we set ranges in the pipeline. For a full list of hyperparameters available for tuning, see [here](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.23/google_cloud_pipeline_components.experimental.automl.tabular.html#google_cloud_pipeline_components.experimental.automl.tabular.utils.get_wide_and_deep_trainer_pipeline_and_parameters).\n",
|
||||
"\n",
|
||||
@@ -974,7 +1025,7 @@
|
||||
"\n",
|
||||
"For a full list of HyperparameterTuningJob parameters, see [here](https://google-cloud-pipeline-components.readthedocs.io/en/google-cloud-pipeline-components-1.0.23/google_cloud_pipeline_components.experimental.automl.tabular.html#google_cloud_pipeline_components.experimental.automl.tabular.utils.get_wide_and_deep_hyperparameter_tuning_job_pipeline_and_parameters).\n",
|
||||
"\n",
|
||||
"Multiple trials can be configured. The pipeline returns the best trial based on the metric configured in `study_spec_metrics`. In the example below, we return the trial with the lowest loss value. "
|
||||
"Multiple trials can be configured. The pipeline returns the best trial based on the metric configured in `study_spec_metrics`. In the example below, we return the trial with the lowest loss value."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1026,7 +1077,10 @@
|
||||
" root_dir=pipeline_job_root_dir,\n",
|
||||
" target_column=target_column,\n",
|
||||
" prediction_type=prediction_type,\n",
|
||||
" transform_config=transform_config_path,\n",
|
||||
" tf_auto_transform_features=auto_transform_features,\n",
|
||||
" run_feature_selection=RUN_FEATURE_SELECTION,\n",
|
||||
" feature_selection_algorithm=FEATURE_SELECTION_ALGORITHM,\n",
|
||||
" max_selected_features=MAX_SELECTED_FEATURES,\n",
|
||||
" training_fraction=training_fraction,\n",
|
||||
" validation_fraction=validation_fraction,\n",
|
||||
" test_fraction=test_fraction,\n",
|
||||
|
||||
+3
-1
@@ -89,7 +89,9 @@
|
||||
"* Enterprise-grade security, privacy, and compliance\n",
|
||||
"\n",
|
||||
"With Vertex AI TensorBoard, you can track, visualize, and compare\n",
|
||||
"ML experiments and share them with your team.\n"
|
||||
"ML experiments and share them with your team.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI TensorBoard](https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-overview) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -89,7 +89,9 @@
|
||||
"* Enterprise-grade security, privacy, and compliance\n",
|
||||
"\n",
|
||||
"With Vertex AI TensorBoard, you can track, visualize, and compare\n",
|
||||
"ML experiments and share them with your team."
|
||||
"ML experiments and share them with your team.\n",
|
||||
"\n",
|
||||
"Learn more about [Vertex AI TensorBoard](https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-overview) and [Vertex AI Training](https://cloud.google.com/vertex-ai/docs/training/custom-training)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user