Skip to content
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

Create Index #1

Merged
merged 20 commits into from
Jun 7, 2023
Merged

Create Index #1

merged 20 commits into from
Jun 7, 2023

Conversation

daiiz
Copy link
Owner

@daiiz daiiz commented Jun 6, 2023

https://scrapbox.io/daiiz/Vertex_AI_Matching_Engineを使ってみる

中身は確認できていないが my-demo-index-22 の作成が完了した。

メモ

  • my-demo-index-22 の作成が完了したら my-demo-index は削除してよし
    • どちらも STREAM_UPDATE には対応していない
    • -22の方はBool filterの練習用の仕込みをしてある
  • どちらもエンドポイントは未作成
  • JavaScriptのclient libraryは不安定なのかな

index.js Outdated
Comment on lines 26 to 42
const request = {
parent,
index: {
displayName: "my-demo-index",
indexUpdateMethod: "STREAM_UPDATE",
description: "My fist index",
metadataSchemaUri:
"gs://google-cloud-aiplatform/schema/matchingengine/metadata/nearest_neighbor_search_1.0.0.yaml",
metadata: {
config: {
dimensions: 1536,
shardSize: "SHARD_SIZE_SMALL",
},
},
},
};
console.log("[createIndex] request", request);
Copy link
Owner Author

@daiiz daiiz Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dimensions is required but missing from Index metadata. って言われる。なんで。

metadataの与え方はあっているはず
https://cloud.google.com/vertex-ai/docs/matching-engine/configuring-indexes?hl=ja

--metadata-file="metadata/my-demo-index.json" \
--display-name="my-demo-index" \
--project=$PROJECT \
--region=us-central1
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実行に成功したものの、作成できなかった。

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほど?

Using endpoint [https://us-central1-aiplatform.googleapis.com/]
ERROR: (gcloud.ai.indexes.create) FAILED_PRECONDITION: The Cloud Storage bucket of `gs://my-demo-embbeddings/` is in location `us`. It must be in the same regional location as the service location `us-central1`.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

アイオワのバケットを指定して再度実行

Using endpoint [https://us-central1-aiplatform.googleapis.com/]
ERROR: (gcloud.ai.indexes.create) FAILED_PRECONDITION: The given gcs path `gs://my-demo-embbeddings2/` is not a valid directory or the directory is empty.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

初期データをなにか入れないと作れないのか!

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そしてこの方法だと STREAM_UPDATE モードにならないことに気付いてしまった
https://zenn.dev/google_cloud_jp/articles/getting-started-matching-engine#index-%E3%82%92%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B

},
"shardSize": "SHARD_SIZE_SMALL"
}
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3次元ベクトルのデータを2件でテスト作成してみる

進行しているのはめでたいが、この程度のデータ数で10分以上待っていて不穏。

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

できた。1時間もかかった。もしかして、データポイント数によらずにこれくらいかかるのかもしれない。

@daiiz daiiz changed the title Impl createIndex Create Index Jun 7, 2023
@daiiz daiiz merged commit 9b2bdbc into main Jun 7, 2023
@daiiz daiiz deleted the createIndex branch June 7, 2023 00:31
@@ -0,0 +1 @@
{"id": "Cat1","embedding": [1, 0.2, 0.1],"restricts": [{ "namespace": "class", "allow": ["cat", "pet"] },{ "namespace": "category", "allow": ["feline"] }]}
Copy link
Owner Author

@daiiz daiiz Jun 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このように1行1レコードの形式にすること!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant