Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to use Gemma in vertex AI?

I am using Gemma in vertex AI. But I meet the following problems:

1) About the format of instance in python, according to the official documentation(https://cloud.google.com/vertex-ai/generative-ai/docs/text/test-text-prompts#generative-ai-test-text...), it should look like the following, however, it will return:"google.api_core.exceptions.FailedPrecondition: 400 Failed to deserialize the JSON body into the target type: instances[0]: missing field `inputs` at line 1 column 41"

instances =  {
"prompts": "What is a car?",
}
parameters_dict = {
"temperature": 0.0,
"max_output_tokens":5,
"top_p": 1,
"top_k": 1,
}

Therefore, I use "inputs" instead of "prompt". Is this normal?

2) my second question is the returned results keep changing even if I set the temperature as 0.0. Additionally, the max_out_tokens doesn't work, it always outputs a lot which obviously exceed the number I set.

3) Is it possible to set a stop_string as a hyperparameter to use this gemma model, e.g.

parameters_dict = {
"temperature": 0.0,
"max_output_tokens":5,
"top_p": 1,
"top_k": 1,
"stop_string": "Result:"
}

 4) I realized the gemma model is very slow, it even takes  several nearly 1 minute for a simple question(I test ). It there any way to improve it?

Can anyone help me? Thanks !

 

2 2 2,564
2 REPLIES 2