getting this error when running prompt = "What do you think could be a good name for a flower shop that specializes in selling bouquets of dried flowers more than fresh flowers? Thank you!" print(generation_model.predict(prompt=prompt, max_output_tokens=256).text) #28
_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Permission denied on resource project qwiklabs-gcp-04-53b3d52c8891 ."
debug_error_string = "UNKNOWN:Error received from peer ipv4:173.194.195.95:443 {created_time:"2024-09-01T06:37:14.560709939+00:00", grpc_status:7, grpc_message:"Permission denied on resource project qwiklabs-gcp-04-53b3d52c8891 ."}"
The above exception was the direct cause of the following exception:
PermissionDenied Traceback (most recent call last)
Cell In[6], line 3
1 prompt = "What do you think could be a good name for a flower shop that specializes in selling bouquets of dried flowers more than fresh flowers? Thank you!"
----> 3 print(generation_model.predict(prompt=prompt, max_output_tokens=256).text)
File /opt/conda/lib/python3.10/site-packages/vertexai/language_models/_language_models.py:1417, in _TextGenerationModel.predict(self, prompt, max_output_tokens, temperature, top_k, top_p, stop_sequences, candidate_count, grounding_source, logprobs, presence_penalty, frequency_penalty, logit_bias, seed)
1360 """Gets model response for a single prompt.
1361
1362 Args:
(...)
1399 A MultiCandidateTextGenerationResponse object that contains the text produced by the model.
1400 """
1401 prediction_request = _create_text_generation_prediction_request(
1402 prompt=prompt,
1403 max_output_tokens=max_output_tokens,
(...)
1414 seed=seed,
1415 )
-> 1417 prediction_response = self._endpoint.predict(
1418 instances=[prediction_request.instance],
1419 parameters=prediction_request.parameters,
1420 )
1422 return _parse_text_generation_model_multi_candidate_response(
1423 prediction_response
1424 )
InactiveRpcError Traceback (most recent call last) File ~/.local/lib/python3.10/site-packages/google/api_core/grpc_helpers.py:50, in _wrap_unary_errors..error_remappedcallable(*args, **kwargs)
49 try:
---> 50 return callable(*args, **kwargs)
51 except grpc.RpcError as exc:
File /opt/conda/lib/python3.10/site-packages/grpc/_channel.py:1181, in _UnaryUnaryMultiCallable.call(self, request, timeout, metadata, credentials, wait_for_ready, compression) 1175 ( 1176 state, 1177 call, 1178 ) = self._blocking( 1179 request, timeout, metadata, credentials, wait_for_ready, compression 1180 ) -> 1181 return _end_unary_response_blocking(state, call, False, None)
File /opt/conda/lib/python3.10/site-packages/grpc/_channel.py:1006, in _end_unary_response_blocking(state, call, with_call, deadline) 1005 else: -> 1006 raise _InactiveRpcError(state)
_InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.PERMISSION_DENIED details = "Permission denied on resource project qwiklabs-gcp-04-53b3d52c8891 ." debug_error_string = "UNKNOWN:Error received from peer ipv4:173.194.195.95:443 {created_time:"2024-09-01T06:37:14.560709939+00:00", grpc_status:7, grpc_message:"Permission denied on resource project qwiklabs-gcp-04-53b3d52c8891 ."}"
The above exception was the direct cause of the following exception:
PermissionDenied Traceback (most recent call last) Cell In[6], line 3 1 prompt = "What do you think could be a good name for a flower shop that specializes in selling bouquets of dried flowers more than fresh flowers? Thank you!" ----> 3 print(generation_model.predict(prompt=prompt, max_output_tokens=256).text)
File /opt/conda/lib/python3.10/site-packages/vertexai/language_models/_language_models.py:1417, in _TextGenerationModel.predict(self, prompt, max_output_tokens, temperature, top_k, top_p, stop_sequences, candidate_count, grounding_source, logprobs, presence_penalty, frequency_penalty, logit_bias, seed) 1360 """Gets model response for a single prompt. 1361 1362 Args: (...) 1399 A
MultiCandidateTextGenerationResponse
object that contains the text produced by the model. 1400 """ 1401 prediction_request = _create_text_generation_prediction_request( 1402 prompt=prompt, 1403 max_output_tokens=max_output_tokens, (...) 1414 seed=seed, 1415 ) -> 1417 prediction_response = self._endpoint.predict( 1418 instances=[prediction_request.instance], 1419 parameters=prediction_request.parameters, 1420 ) 1422 return _parse_text_generation_model_multi_candidate_response( 1423 prediction_response 1424 )File /opt/conda/lib/python3.10/site-packages/google/cloud/aiplatform/models.py:2293, in Endpoint.predict(self, instances, parameters, timeout, use_raw_predict, use_dedicated_endpoint) 2284 return Prediction( 2285 predictions=prediction_response.get("predictions"), 2286 metadata=prediction_response.get("metadata"), (...) 2289 model_version_id=prediction_response.get("modelVersionId"), 2290 ) 2292 else: -> 2293 prediction_response = self._prediction_client.predict( 2294 endpoint=self._gca_resource.name, 2295 instances=instances, 2296 parameters=parameters, 2297 timeout=timeout, 2298 ) 2299 if prediction_response._pb.metadata: 2300 metadata = json_format.MessageToDict(prediction_response._pb.metadata)
File /opt/conda/lib/python3.10/site-packages/google/cloud/aiplatform_v1/services/prediction_service/client.py:848, in PredictionServiceClient.predict(self, request, endpoint, instances, parameters, retry, timeout, metadata) 845 self._validate_universe_domain() 847 # Send the request. --> 848 response = rpc( 849 request, 850 retry=retry, 851 timeout=timeout, 852 metadata=metadata, 853 ) 855 # Done; return the response. 856 return response
File ~/.local/lib/python3.10/site-packages/google/api_core/gapic_v1/method.py:154, in _GapicCallable.call(self, timeout, retry, *args, *kwargs) 151 metadata.extend(self._metadata) 152 kwargs["metadata"] = metadata --> 154 return wrapped_func(args, **kwargs)
File ~/.local/lib/python3.10/site-packages/google/api_core/grpc_helpers.py:52, in _wrap_unary_errors..error_remappedcallable(*args, **kwargs)
50 return callable(*args, **kwargs)
51 except grpc.RpcError as exc:
---> 52 raise exceptions.from_grpc_error(exc) from exc
PermissionDenied: 403 Permission denied on resource project qwiklabs-gcp-04-53b3d52c8891 . [links { description: "Google developers console" url: "https://console.developers.google.com/" } , reason: "CONSUMER_INVALID" domain: "googleapis.com" metadata { key: "consumer" value: "projects/qwiklabs-gcp-04-53b3d52c8891 " } metadata { key: "service" value: "aiplatform.googleapis.com" } ]