How To Export a Large Language Model (LLM)#
Introduction#
In this guide you will learn how to export a Large Language Model (LLM) and register it in the Model Registry.
Code#
Step 1: Connect to Hopsworks#
Step 2: Download the LLM#
Download your base or fine-tuned LLM. LLMs can typically be downloaded using the official frameworks provided by their creators (e.g., HuggingFace, Ollama, ...)
Step 3: (Optional) Fine-tune LLM#
If necessary, fine-tune your LLM with an instruction set. A LLM can be fine-tuned fully or using Parameter Efficient Fine Tuning (PEFT) methods such as LoRA or QLoRA.
Step 4: Register model in registry#
Use the ModelRegistry.llm.create_model(..) function to register a model as LLM. Define a name, and attach optional metrics for your model, then invoke the save() function with the parameter being the path to the local directory where the model was exported to.
Going Further#
You can attach an Input Example and a Model Schema to your model to document the shape and type of the data the model was trained on.