[Python] Vertex AI Text Embedding model forbidden

Discussão em 'Python' iniciado por Stack, Dezembro 8, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to run the tutorial here about text embedding on GCP : https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings?hl=fr

    However, the code snippet below does not work (the error message indicates a disabled service while Vertex AI API is actually enabled on my GCP project):

    from vertexai.language_models import TextEmbeddingModel
    import vertexai

    vertexai.init(project="MY_PROJET_ID", location="europe-west1")

    texts = ["banana muffins? ", "banana bread? banana muffins?"]
    dimensionality = 256
    task = "RETRIEVAL_DOCUMENT"


    model = TextEmbeddingModel.from_pretrained("text-multilingual-embedding-002")


    Version: google-cloud-aiplatform = "1.74.0"

    on Python 3.11 [​IMG]

    Error output (=> DISABLED_SERVICE):

    PermissionDenied: 403 Your application is authenticating by using local Application Default Credentials. The aiplatform.googleapis.com API requires a quota project, which is not set by default. To learn how to set your quota project, see https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds . [reason: "SERVICE_DISABLED"
    domain: "googleapis.com"
    metadata {
    key: "service"
    value: "aiplatform.googleapis.com"
    }
    metadata {
    key: "consumer"
    value: "projects/764086051850"
    }


    Still, I can use other VertexAI services such as GenerativeModels.

    I suspect that a wrong project 764086051850 is used instead of mine. I don't see where I can change that. Does anyone kown how to solve this issue ?

    Continue reading...

Compartilhe esta Página