-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vertex-ai
: add :UPLOAD
support for model resource
#12075
base: vertex-ai-model-resource
Are you sure you want to change the base?
Conversation
f964094
to
d9a7bde
Compare
fc631f3
to
8904529
Compare
25fafc1
to
5e6bf9b
Compare
latest commit fixes some errors from initial running the basic_upload test. After running locally it works as intended. Next is breaking up the list of model upload types. |
9a89dda
to
05bb7e1
Compare
05bb7e1
to
2507926
Compare
recent commit reflects updates from |
2507926
to
f16163d
Compare
ready for review after cleanup
|
38f197e
to
46696d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some thoughts after getting upload_basic to pass, though there is some things to consider.
What's next is supporting the copy tests with upload in order to:
- setup a model
- copy the pre-made model in the same test in order to test the functionality of copy without needing a model to always be present since nightly tests update these and we need to be explicit with the model ID
@@ -309,9 +318,9 @@ properties: | |||
ignore_read: true | |||
- type: Array | |||
name: 'versionAliases' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently trying to resolve the diff we get on versionAliases where a user inputs their field [v2beta2]
but get returned a diff on a second apply due to default_from_api
returning [default, v2beta2]
although we could remove default_from_api this is necessary for copy to work since we don't input versionAlias
yet we still expect a value from the model we want to copy.
In this case we can input the value but we should expect it to have default already as part of the config. I haven't been able to figure out a proper solution. A DiffSuppress was the first idea but because this is an array we are unable to use it (unless there's a hacky way that I don't know about. Leaving this for suggestions @SarahFrench
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some further investigation we may want to consider removing this for the time being, there is currently no way to include suppot of StateFunc
which would help with supporting this (more can be found here). A Diff_suppress_func can't be applied due to lack of support on Lists.
I was almost convinced to leave it with ignore_read: true
though this leaves us with a case where we don't receive the version_aliases when copying (e.g the target model contains v1beta1 but instead is set as null when attempting to copy)
Because of the reasons above it may be best to remove this field. Any thoughts on this would be appreciated.
@@ -1,4 +1,8 @@ | |||
func vertexAiModelDiffSuppress(ctx context.Context, diff *schema.ResourceDiff, meta interface{}) error { | |||
// we require diffSuppress on COPY method and not UPLOAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is included so that we can fill out the description field on create when wanting to upload.
As a reminder this diffsuppress was created because of copy not supporting description field on create. More info can be found in this thread. #12074 (comment)
recent commit supports UPLOAD for COPY tests, this allows us to not rely on a pre-existing model for source_model testing: (base) ┌─(~/Dev/terraform-provider-google)────────────────────────────────────────────────────────────(mau@mau-JKDT676NCP:s083)─┐
└─(18:53:19 on vertex-ai-model-base ✹ ✭)──> envchain GCLOUD make testacc TEST=./google/services/vertexai TESTARGS='-run=TestAccVertexAIModel_'
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google/services/vertexai -v -run=TestAccVertexAIModel_ -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google/version.ProviderVersion=acc"
=== RUN TestAccVertexAIModel_vertexAiModelUploadBasicExample
=== PAUSE TestAccVertexAIModel_vertexAiModelUploadBasicExample
=== RUN TestAccVertexAIModel_postCreationUpdates
=== PAUSE TestAccVertexAIModel_postCreationUpdates
=== RUN TestAccVertexAIModel_modelIdNotProvidedAtCreateTime
=== PAUSE TestAccVertexAIModel_modelIdNotProvidedAtCreateTime
=== RUN TestAccVertexAIModel_modelIdProvidedAtCreateTime
=== PAUSE TestAccVertexAIModel_modelIdProvidedAtCreateTime
=== CONT TestAccVertexAIModel_vertexAiModelUploadBasicExample
=== CONT TestAccVertexAIModel_modelIdNotProvidedAtCreateTime
=== CONT TestAccVertexAIModel_modelIdProvidedAtCreateTime
=== CONT TestAccVertexAIModel_postCreationUpdates
--- PASS: TestAccVertexAIModel_vertexAiModelUploadBasicExample (23.28s)
--- PASS: TestAccVertexAIModel_modelIdNotProvidedAtCreateTime (34.93s)
--- PASS: TestAccVertexAIModel_modelIdProvidedAtCreateTime (35.33s)
--- PASS: TestAccVertexAIModel_postCreationUpdates (45.14s)
PASS
ok github.com/hashicorp/terraform-provider-google/google/services/vertexai 46.573s |
618905e
to
8d7d880
Compare
obj["displayName"] = obj["modelName"] | ||
delete(obj, "modelName") | ||
delete(obj, "sourceModel") | ||
return obj, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This update_encoder is necessary due to source_model being included in PATCH. The API Reference doesn't include any mention of source_model for patching existing models (such as for updating the description for a copied model)
Reference: https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.models/patch
This is ready for another review. Only thing to consider is whether we want to keep investigating solutions for versionAlias as discussed in #12075 (comment) @SarahFrench |
adding support of
:UPLOAD
for models resource. Once completed will be merged into base models PR: #12490:UPLOAD
explanation_spec_examples
vertex-ai
: add:UPLOAD
explanation_spec_examples
tests #12170explanation_gradients
vertex-ai
: add:UPLOAD
integrated_gradients
tests #12171explanation_xrai
vertex-ai
: add:UPLOAD
xrai_attributions
test #12173explanation_shapley
vertex-ai
: add:UPLOAD
sampled_shapley_attributions
test #12172Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.