VertexAI now allows to tune codey models (#10367)

Description: VertexAI now supports to tune codey models, I adapted the
Vertex AI LLM wrapper accordingly
https://cloud.google.com/vertex-ai/docs/generative-ai/models/tune-code-models
pull/10381/head
Christoph Grotz 1 year ago committed by GitHub
parent 1b0eebe1e3
commit 5a4ce9ef2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -169,7 +169,7 @@ class VertexAI(_VertexAICommon, LLM):
tuned_model_name = values.get("tuned_model_name")
model_name = values["model_name"]
try:
if tuned_model_name or not is_codey_model(model_name):
if not is_codey_model(model_name):
from vertexai.preview.language_models import TextGenerationModel
if tuned_model_name:
@ -181,7 +181,12 @@ class VertexAI(_VertexAICommon, LLM):
else:
from vertexai.preview.language_models import CodeGenerationModel
values["client"] = CodeGenerationModel.from_pretrained(model_name)
if tuned_model_name:
values["client"] = CodeGenerationModel.get_tuned_model(
tuned_model_name
)
else:
values["client"] = CodeGenerationModel.from_pretrained(model_name)
except ImportError:
raise_vertex_import_error()
return values

Loading…
Cancel
Save