Closed adesso-dominik-chodounsky closed 2 months ago
@adesso-dominik-chodounsky
Just confirming: Are you using the Vertex AI SDK or Google AI SDK to tune the model?
@Gunand3043 I am using the Google AI SDK (import google.generativeai as genai).
@adesso-dominik-chodounsky
Currently, Google AI SDK support gemini-1.0-pro-001
and gemini-1.5-flash-001-tuning
for tuning. You can use the following code to check the available models for tuning:
for m in genai.list_models():
if "createTunedModel" in m.supported_generation_methods:
print(m.name)
Once you have tuned the model, you can call it by replacing the model name with the name used during tuning, for example: model = genai.GenerativeModel(model_name=f'tunedModels/{name}')
Below code is to check list of models that support generateContent
:
for m in genai.list_models():
if "generateContent" in m.supported_generation_methods:
print(m.name)
Use the generate_content
method to get the response.
You can find the detailed tuning notebook here.
@Gunand3043 I see, the tuning code seemed to work for other models up until the point of content generation with the tuned model, so I did not explore the base compatibility further, thank you for the correction.
Description of the bug:
When tuning one of the generative models in google.generativeai.list_models(), you are unable to directly call some of the supported generation methods (or at least it is not quite clear how to call them).
For example, if we take the
models/text-bison-001
model and train it usinggenai.create_tuned_model()
, let the operation finish and load the model withgenai.GenerativeModel(model_name=result.name)
as suggested by all documentation, we are only able to call the method forgenerate_content
which is however not supported by this model type.Actual vs expected behavior:
I would expect the GenerativeModel class to support calling the supposedly supported methods of each of the possible generative models.
i.e. for the text-bison model, something like: GenerativeModel(model_name="models/text-bison").generate_text("Hello world").
This currently ends with:
AttributeError: 'GenerativeModel' object has no attribute 'generate_text'
The method that is implemented for generating content results in the following:
Any other information you'd like to share?
No response