google cloud platform - Make gemini-1.5-flash-002 accesible for my GCloud Run project - Stack Overflow
I am trying a basic script to summarize text:
def generate(self, text_to_summarize):
vertexai.init(project="<PROJECT_ID", location="MY_REGION")
model = GenerativeModel(
"gemini-1.5-flash-002",
system_instruction=[my_prompt]
)
responses = model.generate_content(
[text_to_summarize],
stream=True,
)
for response in responses:
print(response.text, end="")
This works as intended locally, using "gemini-1.5-flash-002"
In order to run in gcloud run, I have built the script in a docker container and have deployed it to gcloud run.
Calling the endpoint then fails with error:
"PermissionDenied(\"Permission 'aiplatform.endpoints.predict' denied on resource '//aiplatform.googleapis/projects/<PROJECT-ID>/locations/<REGION>/publishers/google/models/gemini-1.5-flash-002' (or it may not exist).\")"
I have double-checked permissions with gcloud projects get-iam-policy <PROJECT-ID>
and see:
bindings:
- members:
- serviceAccount:service-<CODE>@gcp-sa-vertex-op.iam.gserviceaccount
role: roles/aiplatform.onlinePredictionServiceAgent
- members:
- serviceAccount:service-<CODE>@gcp-sa-aiplatform.iam.gserviceaccount
role: roles/aiplatform.serviceAgent
- members:
- serviceAccount:<CODE>[email protected]
- user:<MY-EMAIL>
role: roles/aiplatform.user
...
I checked the models here and aiplatform.endpoints.predict
is a permission for roles/aiplatform.user
, so I have permission.
This has led me to conclude the model does not exist. I thought gcloud run would automatically use the gemini flash one as it does locally. I have run
gcloud ai models list --region=<REGION>
and there are no models.
Even trying to deploy that model to my endpoint fails. The code to deploy is:
gcloud ai endpoints deploy-model <MY-ENDPOINT-ID>\
--model=gemini-1.5-flash-002 \
--region=<REGION> \
--display-name="flash-deployment" \
--machine-type="n1-standard-4"
and this fails with
(gcloud.ai.endpoints.deploy-model) There is an error while getting the model information. Please make sure the model 'projects/<PROJECT-ID>/locations/<REGION>/models/gemini-1.5-flash-002' exists.
I think I have to register the model somewhere, but when I open the model registry and try to "Create" one, it asks me for training data and so on. I do not want to train a new model, just use the flash pretrained one.
Does anyone know how this can be achieved?
- Win11革命性新变化来了!31年的NTFS被取代:ReFS将成默认文件系统
- Intel毫不客气:ARM+Win8软硬件都不行
- 恶意软件侵害苹果用户!4G更易受攻击
- visual studio code - Azure Functions HTTPTrigger running locally with VSCode weird bug but API still works .NET - Stack Overflow
- php - Yii2 ActiveForm Model doesn't exist - Stack Overflow
- Jetpack Compose TextField keyboard dismisses immediately after typing first letter - Stack Overflow
- ST_CONTAINS() giving FALSE even if Point lies within polygon. google-bigquery - Stack Overflow
- frontend - Rescript and Fetch with Post Request - Stack Overflow
- java - I am using spring boot to create an application, my application is running when I hit the end point but it is showing me
- c# - Getting "The signature key was not found" error when using JWT Bearer Authentication with Keycloak in ASP
- kotlin - How to triegger LauncedEffect on user navigating to page OR value change - Stack Overflow
- reactjs - How to change output directory of wxt extension framework - Stack Overflow
- kotlin - How to add SerialName annotation for a DTO class - Stack Overflow
- javascript - React Leaflet custom marker with NextJS window undefined - Stack Overflow
- json - How do I convert a string to a table in Lua? - Stack Overflow
- python - Call function from macos framework (e.g. IntelPowerGadget) - Stack Overflow
- amazon web services - Nuxt build fails on AWS Amplify: Failed to find the deploy-manifest.json file in the build output - Stack