mirror of
https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
synced 2026-09-26 22:51:56 +00:00
Compare commits
72
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
613f473302 | ||
|
|
280d5ddb71 | ||
|
|
61fcdc74d5 | ||
|
|
f366a9f9dd | ||
|
|
f1506099ad | ||
|
|
42cd7104bb | ||
|
|
37fcbcee64 | ||
|
|
0fef453a4a | ||
|
|
6f361fa478 | ||
|
|
77ddbf3521 | ||
|
|
1aa0a1a1f2 | ||
|
|
fb67387f41 | ||
|
|
1be10f485c | ||
|
|
0198a4cc61 | ||
|
|
127c38cf46 | ||
|
|
ef9ab4dd4a | ||
|
|
6909ae569a | ||
|
|
454dddc472 | ||
|
|
8ba3c29396 | ||
|
|
2f1069a61d | ||
|
|
2493d9985b | ||
|
|
59536e9e61 | ||
|
|
811eab6761 | ||
|
|
ed07e436b2 | ||
|
|
e17674d0bb | ||
|
|
f39cfb27a9 | ||
|
|
15b2c24008 | ||
|
|
e1eefdb3e8 | ||
|
|
7d74bc3caa | ||
|
|
9c100bb1d4 | ||
|
|
3579dd2b5a | ||
|
|
bcacd75c46 | ||
|
|
a0cecc480c | ||
|
|
818a61d8d8 | ||
|
|
5d754300d9 | ||
|
|
7abadc58b2 | ||
|
|
587ba6e98e | ||
|
|
dc58c14f26 | ||
|
|
d0f45d3d9b | ||
|
|
753ce8c725 | ||
|
|
6b7aba9356 | ||
|
|
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 | ||
|
|
1448645ba4 | ||
|
|
3d19ffb131 | ||
|
|
b6018551a5 | ||
|
|
65fbf0ee0b | ||
|
|
427bd3d5ea |
@@ -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()
|
||||
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.11.0
|
||||
@@ -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},
|
||||
]
|
||||
@@ -15,15 +15,19 @@ pip install -r requirements.txt
|
||||
* resnet_dp.py - Train ResNet-50 on single node multiple GPUs with `DataParallel` strategy.
|
||||
* resnet_ddp.py - Train ResNet-50 on single node multiple GPUs with `DistributedDataParallel` strategy.
|
||||
* resnet_ddp_wds.py - Train ResNet-50 on single node multiple GPUs with `DistributedDataParallel` strategy and `Webdataset`.
|
||||
* resnet_fsdp.py - Train ResNet-50 on single node multiple GPUs with `FullyShardedDataParallel` strategy.
|
||||
* resnet_fsdp_wds.py - Train ResNet-50 on single node multiple GPUs with `FullyShardedDataParallel` strategy and `Webdataset`.
|
||||
* shard_imagenet.py - Shard ImagNet individual files into `tar` files.
|
||||
|
||||
## Benchmark
|
||||
|
||||
When run the benchmark on Nvidia T4 GPUs using ImageNet validation dataset, you can get the result like:
|
||||
Strategy | Seconds/Epoch - Local Data | Seconds/Epoch - Cloud Data
|
||||
--------------------- | -------------------------- | --------------------------
|
||||
On 1 GPU | 489 | 804 (2x slower)
|
||||
On 4 GPUs (DP) | 157 | 738 (5x slower)
|
||||
On 4 GPUs (DDP) | 134 | 432 (3x slower)
|
||||
On 4 GPUs (DDP + WDS) | 131 | 133 (same performance)
|
||||
Strategy | Seconds/Epoch - Local Data | Seconds/Epoch - Cloud Data
|
||||
---------------------- | -------------------------- | --------------------------
|
||||
On 1 GPU | 489 | 804 (2x slower)
|
||||
On 4 GPUs (DP) | 157 | 738 (5x slower)
|
||||
On 4 GPUs (DDP) | 134 | 432 (3x slower)
|
||||
On 4 GPUs (DDP + WDS) | 131 | 133 (same performance)
|
||||
On 4 GPUs (FSDP) | 139 | 353 (3x slower)
|
||||
On 4 GPUs (FSDP + WDS) | 138 | 135 (same performance)
|
||||
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the \"License\");
|
||||
# you may not use this file except in compliance with the License.\n",
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an \"AS IS\" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Train resnet on multiple GPUs with FSDP."""
|
||||
|
||||
import argparse
|
||||
import functools
|
||||
import os
|
||||
import time
|
||||
|
||||
from PIL import Image
|
||||
import torch
|
||||
from torch import nn
|
||||
import torch.distributed as dist
|
||||
from torch.distributed.fsdp import FullyShardedDataParallel as FSDP
|
||||
from torch.distributed.fsdp.wrap import size_based_auto_wrap_policy
|
||||
import torch.multiprocessing as mp
|
||||
import torchmetrics
|
||||
import torchvision
|
||||
from torchvision.models import resnet50
|
||||
|
||||
|
||||
class ImageFolder(torchvision.datasets.ImageFolder):
|
||||
"""Class for loading imagenet."""
|
||||
|
||||
def __init__(self, image_list_file, transform=None, target_transform=None):
|
||||
self.samples = self._make_dataset(image_list_file)
|
||||
self.loader = self._loader
|
||||
|
||||
self.imgs = self.samples
|
||||
self.targets = [s[1] for s in self.samples]
|
||||
|
||||
self.transform = transform
|
||||
self.target_transform = target_transform
|
||||
|
||||
def _make_dataset(self, image_list_file):
|
||||
items = []
|
||||
with open(image_list_file, 'r') as f:
|
||||
for line in f:
|
||||
item = line.strip().split(' ')
|
||||
items.append((item[0], int(item[1])))
|
||||
return items
|
||||
|
||||
def _loader(self, image_path):
|
||||
with open(image_path, 'rb') as f:
|
||||
img = Image.open(f)
|
||||
img = img.convert('RGB')
|
||||
return img
|
||||
|
||||
|
||||
def train(model, device, dataloader, optimizer):
|
||||
model.train()
|
||||
for image, target in dataloader:
|
||||
image = image.to(device, non_blocking=True)
|
||||
target = target.to(device, non_blocking=True)
|
||||
pred = model(image)
|
||||
# pred.shape (N, C), target.shape (N)
|
||||
loss = nn.functional.cross_entropy(pred, target)
|
||||
optimizer.zero_grad()
|
||||
loss.backward()
|
||||
optimizer.step()
|
||||
return loss
|
||||
|
||||
|
||||
def evaluate(model, device, dataloader, metric):
|
||||
model.eval()
|
||||
with torch.no_grad():
|
||||
for image, target in dataloader:
|
||||
image = image.to(device, non_blocking=True)
|
||||
target = target.to(device, non_blocking=True)
|
||||
pred = model(image)
|
||||
metric.update(pred, target)
|
||||
accuracy = metric.compute()
|
||||
metric.reset()
|
||||
return accuracy
|
||||
|
||||
|
||||
def worker(gpu, args):
|
||||
"""Run training and evaluation."""
|
||||
# Init process group.
|
||||
print(f'Initiating process {gpu}')
|
||||
dist.init_process_group(
|
||||
backend='nccl',
|
||||
init_method='env://',
|
||||
world_size=args.gpus,
|
||||
rank=gpu)
|
||||
|
||||
# Create train dataloader.
|
||||
train_dataset = ImageFolder(
|
||||
image_list_file=args.train_data_path,
|
||||
transform=torchvision.transforms.Compose([
|
||||
torchvision.transforms.RandomResizedCrop(224),
|
||||
torchvision.transforms.RandomHorizontalFlip(),
|
||||
torchvision.transforms.ToTensor(),
|
||||
torchvision.transforms.Normalize(
|
||||
mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
||||
]))
|
||||
train_sampler = torch.utils.data.distributed.DistributedSampler(
|
||||
train_dataset, num_replicas=args.gpus, rank=gpu)
|
||||
train_dataloader = torch.utils.data.DataLoader(
|
||||
dataset=train_dataset,
|
||||
batch_size=args.train_batch_size,
|
||||
shuffle=False,
|
||||
num_workers=args.dataloader_num_workers,
|
||||
pin_memory=True,
|
||||
sampler=train_sampler)
|
||||
if gpu == 0:
|
||||
print(f'Train dataloader | samples: {len(train_dataloader.dataset)}, '
|
||||
f'num workers: {train_dataloader.num_workers}, '
|
||||
f'global batch size: {args.train_batch_size * args.gpus}, '
|
||||
f'batches/epoch: {len(train_dataloader)}')
|
||||
|
||||
# Create eval dataloader.
|
||||
eval_dataset = ImageFolder(
|
||||
image_list_file=args.eval_data_path,
|
||||
transform=torchvision.transforms.Compose([
|
||||
torchvision.transforms.Resize(256),
|
||||
torchvision.transforms.CenterCrop(224),
|
||||
torchvision.transforms.ToTensor(),
|
||||
torchvision.transforms.Normalize(
|
||||
mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
||||
]))
|
||||
eval_sampler = torch.utils.data.distributed.DistributedSampler(
|
||||
eval_dataset, num_replicas=args.gpus, rank=gpu)
|
||||
eval_dataloader = torch.utils.data.DataLoader(
|
||||
dataset=eval_dataset,
|
||||
batch_size=args.eval_batch_size,
|
||||
shuffle=False,
|
||||
num_workers=args.dataloader_num_workers,
|
||||
pin_memory=True,
|
||||
drop_last=True,
|
||||
sampler=eval_sampler)
|
||||
if gpu == 0:
|
||||
print(f'Eval dataloader | samples: {len(eval_dataloader.dataset)}, '
|
||||
f'num workers: {eval_dataloader.num_workers}, '
|
||||
f'batch size: {args.eval_batch_size}, '
|
||||
f'batches/epoch: {len(eval_dataloader)}')
|
||||
|
||||
# Wrap policy.
|
||||
my_auto_wrap_policy = functools.partial(
|
||||
size_based_auto_wrap_policy, min_num_params=100)
|
||||
torch.cuda.set_device(gpu)
|
||||
|
||||
# Create model.
|
||||
model = resnet50(weights=None)
|
||||
model.to(args.device)
|
||||
model = FSDP(model, auto_wrap_policy=my_auto_wrap_policy)
|
||||
|
||||
# Optimizer.
|
||||
optimizer = torch.optim.SGD(model.parameters(), 0.1)
|
||||
|
||||
# Main loop.
|
||||
metric = torchmetrics.classification.Accuracy(top_k=1).to(args.device)
|
||||
for epoch in range(1, args.epochs + 1):
|
||||
if gpu == 0:
|
||||
print(f'Running epoch {epoch}')
|
||||
train_sampler.set_epoch(epoch)
|
||||
|
||||
start = time.time()
|
||||
train(model, args.device, train_dataloader, optimizer)
|
||||
end = time.time()
|
||||
if gpu == 0:
|
||||
print(f'Training finished in {(end - start):>0.3f} seconds')
|
||||
|
||||
start = time.time()
|
||||
evaluate(model, args.device, eval_dataloader, metric)
|
||||
end = time.time()
|
||||
if gpu == 0:
|
||||
print(f'Evaluation finished in {(end - start):>0.3f} seconds')
|
||||
|
||||
if gpu == 0:
|
||||
print('Done')
|
||||
dist.destroy_process_group()
|
||||
|
||||
|
||||
def create_args():
|
||||
"""Create main args."""
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument(
|
||||
'--gpus',
|
||||
default=4,
|
||||
type=int,
|
||||
help='number of gpus to use')
|
||||
parser.add_argument(
|
||||
'--epochs',
|
||||
default=2,
|
||||
type=int,
|
||||
help='number of total epochs to run')
|
||||
parser.add_argument(
|
||||
'--dataloader_num_workers',
|
||||
default=2,
|
||||
type=int,
|
||||
help='number of workders for dataloader')
|
||||
parser.add_argument(
|
||||
'--train_data_path',
|
||||
default='',
|
||||
type=str,
|
||||
help='path to training data')
|
||||
parser.add_argument(
|
||||
'--train_batch_size',
|
||||
default=32,
|
||||
type=int,
|
||||
help='batch size for training per gpu')
|
||||
parser.add_argument(
|
||||
'--eval_data_path',
|
||||
default='',
|
||||
type=str,
|
||||
help='path to evaluation data')
|
||||
parser.add_argument(
|
||||
'--eval_batch_size',
|
||||
default=32,
|
||||
type=int,
|
||||
help='batch size for evaluation per gpu')
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
def main():
|
||||
args = create_args()
|
||||
|
||||
os.environ['MASTER_ADDR'] = 'localhost'
|
||||
os.environ['MASTER_PORT'] = '8888'
|
||||
|
||||
args.device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
||||
print(f'Launch job on {args.gpus} GPUs with FSDP')
|
||||
mp.spawn(worker, nprocs=args.gpus, args=(args,))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,240 @@
|
||||
"""Train resnet on multiple GPUs with DDP."""
|
||||
|
||||
import argparse
|
||||
import functools
|
||||
import itertools
|
||||
import math
|
||||
import os
|
||||
import time
|
||||
|
||||
import torch
|
||||
from torch import nn
|
||||
import torch.distributed as dist
|
||||
from torch.distributed.fsdp import FullyShardedDataParallel as FSDP
|
||||
from torch.distributed.fsdp.wrap import size_based_auto_wrap_policy
|
||||
import torch.multiprocessing as mp
|
||||
import torchmetrics
|
||||
from torchvision.models import resnet50
|
||||
from torchvision.transforms import transforms
|
||||
import webdataset as wds
|
||||
|
||||
|
||||
def wds_split(src, rank, world_size):
|
||||
"""Shards split function for webdataset."""
|
||||
# The context of caller of this function is within multiple processes
|
||||
# (by DDP world_size) and multiple workers (by dataloader_num_workers).
|
||||
# So we totally have (world_size * num_workers) workers for processing data.
|
||||
# NOTE: Raw data should be sharded to enough shards to make sure one process
|
||||
# can handle at least one shard, otherwise the process may hang.
|
||||
worker_id = 0
|
||||
num_workers = 1
|
||||
worker_info = torch.utils.data.get_worker_info()
|
||||
if worker_info:
|
||||
worker_id = worker_info.id
|
||||
num_workers = worker_info.num_workers
|
||||
for s in itertools.islice(src, rank * num_workers + worker_id, None,
|
||||
world_size * num_workers):
|
||||
yield s
|
||||
|
||||
|
||||
def identity(x):
|
||||
return x
|
||||
|
||||
|
||||
def create_wds_dataloader(rank, args, mode):
|
||||
"""Create webdataset dataset and dataloader."""
|
||||
if mode == 'train':
|
||||
transform = transforms.Compose([
|
||||
transforms.RandomResizedCrop(224),
|
||||
transforms.RandomHorizontalFlip(),
|
||||
transforms.ToTensor(),
|
||||
transforms.Normalize(
|
||||
mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
||||
])
|
||||
data_path = args.train_data_path
|
||||
data_size = args.train_data_size
|
||||
batch_size_local = args.train_batch_size
|
||||
batch_size_global = args.train_batch_size * args.gpus
|
||||
# Since webdataset disallows partial batch, we pad the last batch for train.
|
||||
batches = int(math.ceil(data_size / batch_size_global))
|
||||
else:
|
||||
transform = transforms.Compose([
|
||||
transforms.Resize(256),
|
||||
transforms.CenterCrop(224),
|
||||
transforms.ToTensor(),
|
||||
transforms.Normalize(
|
||||
mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
||||
])
|
||||
data_path = args.eval_data_path
|
||||
data_size = args.eval_data_size
|
||||
batch_size_local = args.eval_batch_size
|
||||
batch_size_global = args.eval_batch_size * args.gpus
|
||||
# Since webdataset disallows partial batch, we drop the last batch for eval.
|
||||
batches = int(data_size / batch_size_global)
|
||||
|
||||
dataset = wds.DataPipeline(
|
||||
wds.SimpleShardList(data_path),
|
||||
functools.partial(wds_split, rank=rank, world_size=args.gpus),
|
||||
wds.tarfile_to_samples(),
|
||||
wds.decode('pil'),
|
||||
wds.to_tuple('jpg;png;jpeg cls'),
|
||||
wds.map_tuple(transform, identity),
|
||||
wds.batched(batch_size_local, partial=False),
|
||||
)
|
||||
num_workers = args.dataloader_num_workers
|
||||
dataloader = wds.WebLoader(
|
||||
dataset=dataset,
|
||||
batch_size=None,
|
||||
shuffle=False,
|
||||
num_workers=num_workers,
|
||||
persistent_workers=True if num_workers > 0 else False,
|
||||
pin_memory=True).repeat(nbatches=batches)
|
||||
print(f'{mode} dataloader | samples: {data_size}, '
|
||||
f'num_workers: {num_workers}, '
|
||||
f'local batch size: {batch_size_local}, '
|
||||
f'global batch size: {batch_size_global}, '
|
||||
f'batches: {batches}')
|
||||
return dataloader
|
||||
|
||||
|
||||
def train(model, device, dataloader, optimizer):
|
||||
model.train()
|
||||
for image, target in dataloader:
|
||||
image = image.to(device, non_blocking=True)
|
||||
target = target.to(device, non_blocking=True)
|
||||
pred = model(image)
|
||||
# pred.shape (N, C), target.shape (N)
|
||||
loss = nn.functional.cross_entropy(pred, target)
|
||||
optimizer.zero_grad()
|
||||
loss.backward()
|
||||
optimizer.step()
|
||||
return loss
|
||||
|
||||
|
||||
def evaluate(model, device, dataloader, metric):
|
||||
model.eval()
|
||||
with torch.no_grad():
|
||||
for image, target in dataloader:
|
||||
image = image.to(device, non_blocking=True)
|
||||
target = target.to(device, non_blocking=True)
|
||||
pred = model(image)
|
||||
metric.update(pred, target)
|
||||
accuracy = metric.compute()
|
||||
metric.reset()
|
||||
return accuracy
|
||||
|
||||
|
||||
def worker(gpu, args):
|
||||
"""Run training and evaluation."""
|
||||
# Init process group.
|
||||
print(f'Initiating process {gpu}')
|
||||
dist.init_process_group(
|
||||
backend='nccl',
|
||||
init_method='env://',
|
||||
world_size=args.gpus,
|
||||
rank=gpu)
|
||||
|
||||
# Create dataloader.
|
||||
train_dataloader = create_wds_dataloader(gpu, args, 'train')
|
||||
eval_dataloader = create_wds_dataloader(gpu, args, 'eval')
|
||||
|
||||
# Wrap policy.
|
||||
my_auto_wrap_policy = functools.partial(
|
||||
size_based_auto_wrap_policy, min_num_params=100)
|
||||
torch.cuda.set_device(gpu)
|
||||
|
||||
# Create model.
|
||||
model = resnet50(weights=None)
|
||||
model.to(args.device)
|
||||
model = FSDP(model, auto_wrap_policy=my_auto_wrap_policy)
|
||||
|
||||
# Optimizer.
|
||||
optimizer = torch.optim.SGD(model.parameters(), 0.1)
|
||||
|
||||
# Main loop.
|
||||
metric = torchmetrics.classification.Accuracy(top_k=1).to(args.device)
|
||||
for epoch in range(1, args.epochs + 1):
|
||||
if gpu == 0:
|
||||
print(f'Running epoch {epoch}')
|
||||
|
||||
start = time.time()
|
||||
train(model, args.device, train_dataloader, optimizer)
|
||||
end = time.time()
|
||||
if gpu == 0:
|
||||
print(f'Training finished in {(end - start):>0.3f} seconds')
|
||||
|
||||
start = time.time()
|
||||
evaluate(model, args.device, eval_dataloader, metric)
|
||||
end = time.time()
|
||||
if gpu == 0:
|
||||
print(f'Evaluation finished in {(end - start):>0.3f} seconds')
|
||||
|
||||
if gpu == 0:
|
||||
print('Done')
|
||||
|
||||
|
||||
def create_args():
|
||||
"""Create main args."""
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument(
|
||||
'--gpus',
|
||||
default=4,
|
||||
type=int,
|
||||
help='number of gpus to use')
|
||||
parser.add_argument(
|
||||
'--epochs',
|
||||
default=2,
|
||||
type=int,
|
||||
help='number of total epochs to run')
|
||||
parser.add_argument(
|
||||
'--dataloader_num_workers',
|
||||
default=2,
|
||||
type=int,
|
||||
help='number of workders for dataloader')
|
||||
parser.add_argument(
|
||||
'--train_data_path',
|
||||
default='',
|
||||
type=str,
|
||||
help='path to training data')
|
||||
parser.add_argument(
|
||||
'--train_batch_size',
|
||||
default=32,
|
||||
type=int,
|
||||
help='batch size for training per gpu')
|
||||
parser.add_argument(
|
||||
'--train_data_size',
|
||||
default=50000,
|
||||
type=int,
|
||||
help='data size for training')
|
||||
parser.add_argument(
|
||||
'--eval_data_path',
|
||||
default='',
|
||||
type=str,
|
||||
help='path to evaluation data')
|
||||
parser.add_argument(
|
||||
'--eval_batch_size',
|
||||
default=32,
|
||||
type=int,
|
||||
help='batch size for evaluation per gpu')
|
||||
parser.add_argument(
|
||||
'--eval_data_size',
|
||||
default=50000,
|
||||
type=int,
|
||||
help='data size for evaluation')
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
def main():
|
||||
args = create_args()
|
||||
os.environ['MASTER_ADDR'] = 'localhost'
|
||||
os.environ['MASTER_PORT'] = '8888'
|
||||
|
||||
args.device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
||||
print(f'Launch job on {args.gpus} GPUs with FSDP')
|
||||
mp.spawn(worker, nprocs=args.gpus, args=(args,))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
+86
-115
@@ -159,9 +159,9 @@
|
||||
"\n",
|
||||
"# Install the packages\n",
|
||||
"\n",
|
||||
"! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG -q\n",
|
||||
"! pip3 install --upgrade tensorflow $USER_FLAG -q\n",
|
||||
"! pip3 install --upgrade tensorflow-hub $USER_FLAG -q"
|
||||
"! pip3 install --upgrade google-cloud-aiplatform \\\n",
|
||||
" tensorflow \\\n",
|
||||
" tensorflow-hub $USER_FLAG -q"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -307,22 +307,29 @@
|
||||
"id": "timestamp"
|
||||
},
|
||||
"source": [
|
||||
"#### Timestamp\n",
|
||||
"#### 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 timestamp for each instance session, and append the timestamp 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 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."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "timestamp"
|
||||
"id": "84Vdv7R-QEH6"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from datetime import datetime\n",
|
||||
"import random\n",
|
||||
"import string\n",
|
||||
"\n",
|
||||
"TIMESTAMP = datetime.now().strftime(\"%Y%m%d%H%M%S\")"
|
||||
"\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",
|
||||
"\n",
|
||||
"UUID = generate_uuid()"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -421,7 +428,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"if BUCKET_URI == \"\" or BUCKET_URI is None or BUCKET_URI == \"gs://[your-bucket-name]\":\n",
|
||||
" BUCKET_NAME = PROJECT_ID + \"aip-\" + TIMESTAMP\n",
|
||||
" BUCKET_NAME = PROJECT_ID + \"aip-\" + UUID\n",
|
||||
" BUCKET_URI = \"gs://\" + BUCKET_NAME"
|
||||
]
|
||||
},
|
||||
@@ -523,7 +530,7 @@
|
||||
"\n",
|
||||
"Setup up the following constants for Vertex AI:\n",
|
||||
"\n",
|
||||
"- `API_ENDPOINT`: The Vertex AI API service endpoint for `Endpoint` services."
|
||||
"- `API_ENDPOINT`: The Vertex AI API service endpoint."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -538,46 +545,10 @@
|
||||
"API_ENDPOINT = \"{}-aiplatform.googleapis.com\".format(REGION)\n",
|
||||
"\n",
|
||||
"# Vertex location root path for your dataset, model and endpoint resources\n",
|
||||
"PARENT = \"projects/\" + PROJECT_ID + \"/locations/\" + REGION"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "clients:metadata"
|
||||
},
|
||||
"source": [
|
||||
"## Set up clients\n",
|
||||
"PARENT = \"projects/\" + PROJECT_ID + \"/locations/\" + REGION\n",
|
||||
"\n",
|
||||
"The Vertex works as a client/server model. On your side (the Python script) you will create a client that sends requests and receives responses from the Vertex AI server.\n",
|
||||
"\n",
|
||||
"You will use different clients in this tutorial for different steps in the workflow. So set them all up upfront.\n",
|
||||
"\n",
|
||||
"- Endpoint Service for creating endpoints, and deploying models to endpoints."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "clients:metadata"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# client options same for all services\n",
|
||||
"client_options = {\"api_endpoint\": API_ENDPOINT}\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def create_endpoint_client():\n",
|
||||
" client = aip_beta.EndpointServiceClient(client_options=client_options)\n",
|
||||
" return client\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"clients = {}\n",
|
||||
"clients[\"endpoint\"] = create_endpoint_client()\n",
|
||||
"\n",
|
||||
"for client in clients.items():\n",
|
||||
" print(client)"
|
||||
"client_options = {\"api_endpoint\": API_ENDPOINT}"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -592,7 +563,7 @@
|
||||
"\n",
|
||||
"Set the variables `DEPLOY_GPU/DEPLOY_NGPU` to use a container image supporting a GPU and the number of GPUs allocated to the virtual machine (VM) instance. For example, to use a GPU container image with 4 Nvidia Telsa K80 GPUs allocated to each VM, you would specify:\n",
|
||||
"\n",
|
||||
" (aip.AcceleratorType.NVIDIA_TESLA_K80, 4)\n",
|
||||
" (aip.gapic.AcceleratorType.NVIDIA_TESLA_K80, 4)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Otherwise specify `(None, None)` to use a container image to run on a CPU.\n",
|
||||
@@ -902,7 +873,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"model_icn = aiplatform.Model.upload(\n",
|
||||
" display_name=\"icn_\" + TIMESTAMP,\n",
|
||||
" display_name=\"icn_\" + UUID,\n",
|
||||
" artifact_uri=MODEL_ICN_DIR,\n",
|
||||
" serving_container_image_uri=DEPLOY_IMAGE,\n",
|
||||
")\n",
|
||||
@@ -1013,7 +984,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"model_use = aiplatform.Model.upload(\n",
|
||||
" display_name=\"icn_\" + TIMESTAMP,\n",
|
||||
" display_name=\"icn_\" + UUID,\n",
|
||||
" artifact_uri=MODEL_USE_DIR,\n",
|
||||
" serving_container_image_uri=DEPLOY_IMAGE,\n",
|
||||
")\n",
|
||||
@@ -1029,64 +1000,52 @@
|
||||
"source": [
|
||||
"## Creating a deployment resource pool\n",
|
||||
"\n",
|
||||
"Currently, creating deploynent resource pools is only supported via the REST-based API (e.g., CURL).\n",
|
||||
"Currently, creating deploynent resource pools is only supported via the REST-based API (e.g., CURL) and GAPIC APIs (Python).\n",
|
||||
"\n",
|
||||
"Use `CreateDeploymentResourcePool` API to create a resource pool, with the following configuration:\n",
|
||||
"Use `create_deployment_resource_pool` API to create a resource pool, with the following configuration:\n",
|
||||
"\n",
|
||||
"- `dedicated_resources`: Compute (HW) resources to allocate for the shared vm.\n",
|
||||
"- `min_replica_count`: Auto-scaling, the minimum number of compute nodes.\n",
|
||||
"- `max_replica_count`: Auto-scaling, the maximum number of compute nodes.\n",
|
||||
"\n",
|
||||
"Learn more about [Deployment Resource Pools]()."
|
||||
"Learn more about [Deployment Resource Pools](https://googleapis.dev/python/aiplatform/latest/aiplatform_v1beta1/deployment_resource_pool_service.html)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "YiBmoiWYcMQt"
|
||||
"id": "90c51b6cf34a"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"DEPLOYMENT_RESOURCE_POOL_ID = \"shared-vm\" # @param {type: \"string\"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "0CHPJ4h-Slgs"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import pprint\n",
|
||||
"pp = pprint.PrettyPrinter(indent=4)\n",
|
||||
"\n",
|
||||
"DEPLOYMENT_RESOURCE_POOL_ID = f\"shared-vm-{UUID}\" # @param {type: \"string\"}\n",
|
||||
"MIN_NODES = 1\n",
|
||||
"MAX_NODES = 2\n",
|
||||
"\n",
|
||||
"CREATE_RP_PAYLOAD = {\n",
|
||||
" \"deployment_resource_pool\":{\n",
|
||||
" \"dedicated_resources\":{\n",
|
||||
" \"machine_spec\":{\n",
|
||||
" \"machine_type\": DEPLOY_COMPUTE\n",
|
||||
" },\n",
|
||||
" \"min_replica_count\": MIN_NODES, \n",
|
||||
" \"max_replica_count\": MAX_NODES\n",
|
||||
" }\n",
|
||||
" },\n",
|
||||
" \"deployment_resource_pool_id\":DEPLOYMENT_RESOURCE_POOL_ID\n",
|
||||
"}\n",
|
||||
"CREATE_RP_REQUEST=json.dumps(CREATE_RP_PAYLOAD)\n",
|
||||
"pp.pprint(\"CREATE_RP_REQUEST: \" + CREATE_RP_REQUEST)\n",
|
||||
"# Initialize request argument(s)\n",
|
||||
"deployment_resource_pool = aip_beta.DeploymentResourcePool()\n",
|
||||
"deployment_resource_pool.dedicated_resources.min_replica_count = MIN_NODES\n",
|
||||
"deployment_resource_pool.dedicated_resources.max_replica_count = MAX_NODES\n",
|
||||
"deployment_resource_pool.dedicated_resources.machine_spec.machine_type = DEPLOY_COMPUTE\n",
|
||||
"\n",
|
||||
"! curl \\\n",
|
||||
"-X POST \\\n",
|
||||
"-H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n",
|
||||
"-H \"Content-Type: application/json\" \\\n",
|
||||
"https://{REGION}-aiplatform.googleapis.com/v1beta1/projects/{PROJECT_ID}/locations/{REGION}/deploymentResourcePools \\\n",
|
||||
"-d '{CREATE_RP_REQUEST}'"
|
||||
"request = aip_beta.CreateDeploymentResourcePoolRequest(\n",
|
||||
" parent=f\"projects/{PROJECT_ID}/locations/{REGION}\",\n",
|
||||
" deployment_resource_pool=deployment_resource_pool,\n",
|
||||
" deployment_resource_pool_id=DEPLOYMENT_RESOURCE_POOL_ID,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"pool_client = aip_beta.services.deployment_resource_pool_service.DeploymentResourcePoolServiceClient(\n",
|
||||
" client_options=client_options\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"op = pool_client.create_deployment_resource_pool(request=request)\n",
|
||||
"print(op)\n",
|
||||
"\n",
|
||||
"result = op.result()\n",
|
||||
"print(result)\n",
|
||||
"\n",
|
||||
"deployment_pool_id = result.name"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1099,21 +1058,19 @@
|
||||
"\n",
|
||||
"Use `GetDeploymentResourcePool` API to check out the deploynent resource pool that you created. \n",
|
||||
"\n",
|
||||
"Learn more about [Get Deployment Resource Pool](https://source.corp.google.com/piper///depot/google3/google/cloud/aiplatform/master/deployment_resource_pool_service.proto;l=75?q=deployment_resource_pool&sq=package:piper%20file:%2F%2Fdepot%2Fgoogle3%20-file:google3%2Fexperimental)."
|
||||
"Learn more about [Get Deployment Resource Pool](https://googleapis.dev/python/aiplatform/latest/aiplatform_v1beta1/deployment_resource_pool_service.html)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "6wTLyhPraFah"
|
||||
"id": "b740253903c0"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"! curl -X GET \\\n",
|
||||
"-H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n",
|
||||
"-H \"Content-Type: application/json\" \\\n",
|
||||
"https://{REGION}-aiplatform.googleapis.com/v1beta1/projects/{PROJECT_ID}/locations/{REGION}/deploymentResourcePools/{DEPLOYMENT_RESOURCE_POOL_ID}"
|
||||
"response = pool_client.get_deployment_resource_pool(name=deployment_pool_id)\n",
|
||||
"print(response)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1126,21 +1083,22 @@
|
||||
"\n",
|
||||
"Use `ListDeploymentResourcePools` API to list all the deployment resource pools. \n",
|
||||
"\n",
|
||||
"Learn more about [Listing Deployment Resource Pools](https://source.corp.google.com/piper///depot/google3/google/cloud/aiplatform/master/deployment_resource_pool_service.proto;l=101?q=deployment_resource_pool&sq=package:piper%20file:%2F%2Fdepot%2Fgoogle3%20-file:google3%2Fexperimental)."
|
||||
"Learn more about [Listing Deployment Resource Pools](https://googleapis.dev/python/aiplatform/latest/aiplatform_v1beta1/deployment_resource_pool_service.html)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "Pxls4sNnaltU"
|
||||
"id": "3ebfd007bff2"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"! curl -X GET \\\n",
|
||||
"-H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n",
|
||||
"-H \"Content-Type: application/json\" \\\n",
|
||||
"https://{REGION}-aiplatform.googleapis.com/v1beta1/projects/{PROJECT_ID}/locations/{REGION}/deploymentResourcePools"
|
||||
"pools = pool_client.list_deployment_resource_pools(\n",
|
||||
" parent=f\"projects/{PROJECT_ID}/locations/{REGION}\"\n",
|
||||
")\n",
|
||||
"for pool in pools:\n",
|
||||
" print(pool)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1170,11 +1128,11 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"endpoint_icn = aiplatform.Endpoint.create(display_name=\"icn_\" + TIMESTAMP)\n",
|
||||
"endpoint_icn = aiplatform.Endpoint.create(display_name=\"icn_\" + UUID)\n",
|
||||
"\n",
|
||||
"print(endpoint_icn)\n",
|
||||
"\n",
|
||||
"endpoint_use = aiplatform.Endpoint.create(display_name=\"use_\" + TIMESTAMP)\n",
|
||||
"endpoint_use = aiplatform.Endpoint.create(display_name=\"use_\" + UUID)\n",
|
||||
"\n",
|
||||
"print(endpoint_use)"
|
||||
]
|
||||
@@ -1204,6 +1162,12 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import pprint\n",
|
||||
"\n",
|
||||
"pp = pprint.PrettyPrinter(indent=4)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"SHARED_RESOURCE = \"projects/{project_id}/locations/{region}/deploymentResourcePools/{deployment_resource_pool_id}\".format(\n",
|
||||
" project_id=PROJECT_ID,\n",
|
||||
" region=REGION,\n",
|
||||
@@ -1363,18 +1327,27 @@
|
||||
" time.sleep(30)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"id": "52248c450776"
|
||||
},
|
||||
"source": [
|
||||
"### Get deployment details for the endpoint\n",
|
||||
"\n",
|
||||
"List the deployed models on the endpoint."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "86a659bf60f0"
|
||||
"id": "3b768614e7c6"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"! curl -X GET \\\n",
|
||||
" -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n",
|
||||
" -H \"Content-Type: application/json\" \\\n",
|
||||
"https://{REGION}-aiplatform.googleapis.com/v1/projects/759209241365/locations/us-central1/endpoints/2259566763823857664"
|
||||
"print(endpoint_icn.list_models())\n",
|
||||
"print(endpoint_use.list_models())"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1557,21 +1530,19 @@
|
||||
"source": [
|
||||
"#### Delete the `DeploymentResourcePool`\n",
|
||||
"\n",
|
||||
"The method 'delete()' will delete your deployment resource pool."
|
||||
"The method 'delete_deployment_resource_pool()' will delete your deployment resource pool."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"id": "ac40cc1d594a"
|
||||
"id": "b76a4de1e57e"
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"! curl -X DELETE \\\n",
|
||||
"-H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n",
|
||||
"-H \"Content-Type: application/json\" \\\n",
|
||||
"https://{REGION}-aiplatform.googleapis.com/v1beta1/projects/{PROJECT_ID}/locations/{REGION}/deploymentResourcePools/{DEPLOYMENT_RESOURCE_POOL_ID}"
|
||||
"response = pool_client.delete_deployment_resource_pool(name=deployment_pool_id)\n",
|
||||
"print(response)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+21
-19
@@ -567,7 +567,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%%writefile trainer/Dockerfile\n",
|
||||
"FROM gcr.io/deeplearning-platform-release/pytorch-gpu.1-12\n",
|
||||
"FROM gcr.io/deeplearning-platform-release/pytorch-gpu.1-13:m102\n",
|
||||
"\n",
|
||||
"RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \\\n",
|
||||
" # Install reduction server plugin on GPU containers. google-fast-socket is\n",
|
||||
@@ -588,16 +588,31 @@
|
||||
"RUN apt-get update -y && \\\n",
|
||||
" apt-get install -y curl gnupg telnet nano net-tools iputils-ping\n",
|
||||
"\n",
|
||||
"# Set ETCD version\n",
|
||||
"ARG ETCD_VER=v2.3.0\n",
|
||||
"# Choose either URL\n",
|
||||
"ARG GOOGLE_URL=https://storage.googleapis.com/etcd\n",
|
||||
"ARG GITHUB_URL=https://github.com/etcd-io/etcd/releases/download\n",
|
||||
"# Set ETCD URL to download from\n",
|
||||
"ARG DOWNLOAD_URL=$GOOGLE_URL\n",
|
||||
"\n",
|
||||
"# Install ETCD\n",
|
||||
"RUN mkdir -p /tmp/etcd-download-test && \\\n",
|
||||
" curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz && \\\n",
|
||||
" tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1 && \\\n",
|
||||
" rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz\n",
|
||||
"\n",
|
||||
"# Copy training application code\n",
|
||||
"COPY . /trainer\n",
|
||||
"\n",
|
||||
"WORKDIR /trainer\n",
|
||||
"\n",
|
||||
"# Install dependencies\n",
|
||||
"RUN pip install -r requirements.txt\n",
|
||||
"\n",
|
||||
"RUN chmod 777 main.sh\n",
|
||||
"\n",
|
||||
"# download data to the container\n",
|
||||
"# Download data to the container\n",
|
||||
"RUN wget -q -P /trainer/data https://image-net.org/data/tiny-imagenet-200.zip\n",
|
||||
"RUN unzip -q /trainer/data/tiny-imagenet-200.zip\n",
|
||||
"RUN rm /trainer/data/tiny-imagenet-200.zip\n",
|
||||
@@ -614,8 +629,8 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%%writefile trainer/requirements.txt\n",
|
||||
"torch==1.12.0\n",
|
||||
"torchvision==0.13.0\n",
|
||||
"torch==1.13.0\n",
|
||||
"torchvision==0.14.0\n",
|
||||
"tensorboard==2.5.0\n",
|
||||
"protobuf==3.20.*\n",
|
||||
"python-etcd\n",
|
||||
@@ -675,30 +690,17 @@
|
||||
"setup_etcd() {\n",
|
||||
" HOST_IP=$1\n",
|
||||
" # Start a local instane of ETCD v2 \n",
|
||||
" ETCD_VER=v2.3.0 #v3.5.6\n",
|
||||
" export ETCD_ENABLE_V2=true\n",
|
||||
" export ETCDCTL_API=2\n",
|
||||
"\n",
|
||||
" # choose either URL\n",
|
||||
" GOOGLE_URL=https://storage.googleapis.com/etcd\n",
|
||||
" GITHUB_URL=https://github.com/etcd-io/etcd/releases/download\n",
|
||||
" DOWNLOAD_URL=${GOOGLE_URL}\n",
|
||||
"\n",
|
||||
" rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz\n",
|
||||
" rm -rf /tmp/etcd-download-test && mkdir -p /tmp/etcd-download-test\n",
|
||||
"\n",
|
||||
" curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz\n",
|
||||
" tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1\n",
|
||||
" rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz\n",
|
||||
"\n",
|
||||
" /tmp/etcd-download-test/etcd --name s1 --data-dir /tmp/etcd-download-test/s1 \\\n",
|
||||
" --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://$HOST_IP:2379 \\\n",
|
||||
" --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://$HOST_IP:2380 \\\n",
|
||||
" --initial-cluster s1=http://$HOST_IP:2380 --initial-cluster-token tkn \\\n",
|
||||
" --initial-cluster-state new &> /tmp/etcd-download-test/node.log &\n",
|
||||
"\n",
|
||||
" sudo /tmp/etcd-download-test/etcd --version\n",
|
||||
" sudo /tmp/etcd-download-test/etcdctl --version\n",
|
||||
" /tmp/etcd-download-test/etcd --version\n",
|
||||
" /tmp/etcd-download-test/etcdctl --version\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"\n",
|
||||
|
||||
@@ -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)."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user