mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-19 19:11:33 +00:00
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
This commit is contained in:
parent
1b0eebe1e3
commit
5a4ce9ef2b
@ -169,7 +169,7 @@ class VertexAI(_VertexAICommon, LLM):
|
|||||||
tuned_model_name = values.get("tuned_model_name")
|
tuned_model_name = values.get("tuned_model_name")
|
||||||
model_name = values["model_name"]
|
model_name = values["model_name"]
|
||||||
try:
|
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
|
from vertexai.preview.language_models import TextGenerationModel
|
||||||
|
|
||||||
if tuned_model_name:
|
if tuned_model_name:
|
||||||
@ -181,6 +181,11 @@ class VertexAI(_VertexAICommon, LLM):
|
|||||||
else:
|
else:
|
||||||
from vertexai.preview.language_models import CodeGenerationModel
|
from vertexai.preview.language_models import CodeGenerationModel
|
||||||
|
|
||||||
|
if tuned_model_name:
|
||||||
|
values["client"] = CodeGenerationModel.get_tuned_model(
|
||||||
|
tuned_model_name
|
||||||
|
)
|
||||||
|
else:
|
||||||
values["client"] = CodeGenerationModel.from_pretrained(model_name)
|
values["client"] = CodeGenerationModel.from_pretrained(model_name)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise_vertex_import_error()
|
raise_vertex_import_error()
|
||||||
|
Loading…
Reference in New Issue
Block a user