Slide 15
Slide 15 text
LangChain (LLMChain) のモデルロギング
from langchain import PromptTemplate, HuggingFaceHub, LLMChain
template = """Translate everything you see after this into French:
{input}"""
prompt = PromptTemplate(template=template, input_variables=["input"])
llm_chain = LLMChain(
prompt=prompt,
llm=HuggingFaceHub(
repo_id="google/flan-t5-small",
model_kwargs={"temperature":0, "max_length":64}
),
)
mlflow.langchain.log_model(
lc_model=llm_chain,
artifact_path="model",
registered_model_name="english-to-french-chain-gpt-3.5-turbo-1")
LLMChainをロギングするので、 Model
+ Prompt Templateをまとめて管理が
出来る
※ 現時点ではHuggingFaceHubとOpenAIの
LLMChainのみ対応だが、今後に期待。