Skip to content

Commit

Permalink
feat(components): support aliases arg in ModelUploadOp
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 600096017
  • Loading branch information
connor-mccarthy authored and Google Cloud Pipeline Components maintainers committed Jan 20, 2024
1 parent bd0dd77 commit bce8487
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/google-cloud/RELEASE.md
Expand Up @@ -4,6 +4,7 @@
* Upload the tuned adapter to Model Registry instead of model checkpoint from `preview.llm.rlhf_pipeline`.
* Add Vertex model get component (`v1.model.ModelGetOp`).
* Migrate to Protobuf 4 (`protobuf>=4.21.1,<5`). Require `kfp>=2.6.0`.
* Support setting version aliases in (`v1.model.ModelUploadOp`).

## Release 2.8.0
* Release AutoSxS pipeline to preview.
Expand Down
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Dict
from typing import Dict, List

from google_cloud_pipeline_components import _image
from google_cloud_pipeline_components import _placeholders
Expand All @@ -39,6 +39,7 @@ def model_upload(
unmanaged_container_model: Input[UnmanagedContainerModel] = None,
explanation_metadata: Dict[str, str] = {},
explanation_parameters: Dict[str, str] = {},
version_aliases: List[str] = [],
labels: Dict[str, str] = {},
encryption_spec_key_name: str = '',
project: str = _placeholders.PROJECT_ID_PLACEHOLDER,
Expand All @@ -60,6 +61,7 @@ def model_upload(
explanation_metadata: Metadata describing the Model's input and output for explanation. Both `explanation_metadata` and `explanation_parameters` must be passed together when used. [More information.](https://cloud.google.com/vertex-ai/docs/reference/rest/v1/ExplanationSpec#explanationmetadata)
explanation_parameters: Parameters to configure explaining for Model's predictions. [More information.](https://cloud.google.com/vertex-ai/docs/reference/rest/v1/ExplanationSpec#ExplanationParameters)
version_aliases: User provided version aliases so that a model version can be referenced via alias (i.e. `projects/{project}/locations/{location}/models/{modelId}@{version_alias}` instead of auto-generated version id (i.e. `projects/{project}/locations/{location}/models/{modelId}@{versionId}`). The format is [a-z][a-zA-Z0-9-]{0,126}[a-z0-9] to distinguish from versionId. A default version alias will be created for the first version of the model, and there must be exactly one default version alias for a model.
encryption_spec_key_name: Customer-managed encryption key spec for a Model. If set, this Model and all sub-resources of this Model will be secured by this key. Has the form: `projects/my-project/locations/my-location/keyRings/my-kr/cryptoKeys/my-key`. The key needs to be in the same region as where the compute resource is created.
labels: The labels with user-defined metadata to organize your model. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels.
project: Project to upload this Model to. Defaults to the project in which the PipelineJob is run.
Expand Down Expand Up @@ -98,6 +100,8 @@ def model_upload(
', "encryption_spec": {"kms_key_name":"',
encryption_spec_key_name,
'"}',
', "version_aliases": ',
version_aliases,
', "labels": ',
labels,
', "pipeline_job": "',
Expand Down

0 comments on commit bce8487

Please sign in to comment.