Skip to content

Commit

Permalink
initial models setup
Browse files Browse the repository at this point in the history
  • Loading branch information
BBBmau committed Oct 23, 2024
1 parent 2b46201 commit d3c770b
Show file tree
Hide file tree
Showing 6 changed files with 513 additions and 0 deletions.
440 changes: 440 additions & 0 deletions mmv1/products/vertexai/Models.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if d.Get("name").(string) == "" {
return v.(string)
}

return d.Get("name")
}
5 changes: 5 additions & 0 deletions mmv1/templates/terraform/decoders/vertex_ai_models.go.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if res["model"] != "" {
res["name"] = res["model"]
}

return res, nil
15 changes: 15 additions & 0 deletions mmv1/templates/terraform/encoders/vertex_ai_models.go.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
newObj := make(map[string]interface{})
name := ""
if v, ok := d.GetOk("model_id"); ok {
name = v.(string)
delete(obj,"modelId")
} else {
name = d.Get("name").(string)
}
newObj["modelId"] = name
if v, ok := d.GetOk("parent_model"); ok {
newObj["parentModel"] = v
delete(obj,"parentModel")
}
newObj["model"] = obj
return newObj, nil
13 changes: 13 additions & 0 deletions mmv1/templates/terraform/examples/vertex_ai_model_basic.tf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "google_vertex_ai_models" "<%= ctx[:primary_resource_id] %>" {
display_name = "<%= ctx[:vars]['display_name'] %>"
description = "sample description"
labels = {
"key1" : "value1",
"key2" : "value2"
}

// encryption_spec {
// kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>"
// }
region = "us-central1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
resource "google_vertex_ai_models" "<%= ctx[:primary_resource_id] %>" {
display_name = "<%= ctx[:vars]['display_name'] %>"
description = "basic upload model"

metadata_schema_uri = "gs://cloud-ai-platform-d357fffa-aab0-409b-8e4e-3af03de82d76/instance_schemas/job-5547038670390820864/analysis"

version_aliases = ["v2beta1"]
model_id = "id_upload_test"

metadata {
config {
algorithm_config {
tree_ah_config {
leaf_node_embedding_count = 1
leaf_nodes_to_search_percent = 1
}
}
approximate_neighbors_count = 1
dimensions = 1
distance_measure_type = 1
feature_norm_type = "normal"
shard_size = 1
}
contents_delta_uri = "test"
is_complete_overwrite = false
}

labels = {
"key1" : "value1",
"key2" : "value2"
}
region = "us-central1"
}

0 comments on commit d3c770b

Please sign in to comment.