Code Monkey home page Code Monkey logo

rafaelvp-db / databricks-llm-prompt-engineering Goto Github PK

View Code? Open in Web Editor NEW
14.0 3.0 1.0 1.13 MB

Examples of Prompt Engineering, Zero Shot Learning, Few Shot Learning and Retrieval Augmented Generation (RAG) using Hugging Face, Databricks and MLflow

License: MIT License

Python 99.85% Shell 0.15%
databricks few-shot-learning hugging-face llmops mlflow mlops prompt-engineering retrieval-augmented-generation retrieval-augmented-qa transformers zero-shot-learning large-language-models llm llms mpt mosaicml llama2 gradio mosaic-ml

databricks-llm-prompt-engineering's Introduction

Large Language Models (LLMs) & Prompt Engineering with Hugging Face, Databricks and MLflow

hf hf pt db mlflow

Contents

  • The repo covers different use cases related to Prompt Engineering and Large Language Models (LLMs).
  • Exploration & Exploitation: the repo contains notebooks for LLM experimentation with different Prompt Engineering techniques. It also showcases LLM deployment using Databricks Model Serving with GPU Support.
  • This repo also ships with a demo frontend application developed using Gradio

As of 29/08/2023, you will find the following examples in the notebooks folder:

๐Ÿ™‹๐Ÿปโ€โ™‚๏ธ customer_service

Artifact Description
hf_mlflow_crash_course ๐Ÿค“ Provides a basic example using Hugging Face for training an intent classification model using distilbert-qa. Also showcases foundational concepts of MLflow, such as experiment tracking, artifact logging and model registration.
primer ๐ŸŽฌ Mostly conceptual notebook. Contains explanations around Prompt Engineering, and foundational concepts such as Top K sampling, Top p sampling and Temperature.
basic_prompt_evaluation ๐Ÿงช Demonstrates basic Prompt Engineeering with lightweight LLM models. In addition to this, showcases MLflow's newest LLM features, such as mlflow.evaluate().
few_shot_learning ๐Ÿ’‰ Here we explore Few Shot Learning with an Instruction Based LLM (mpt-7b-instruct).
active_prompting ๐Ÿƒ๐Ÿปโ€โ™‚๏ธ In this notebook, we explore active prompting techniques. Additionally, we demonstrate how to leverage VLLM in order to achieve 7X - 10X inference latency improvements.
llama2_mlflow_logging_inference ๐Ÿš€ Here we show how to log, register and deploy a LLaMA V2 model into MLflow
mpt_mlflow_logging_inference ๐Ÿš€ Here we show how to log, register and deploy an MPT-Instruct model into MLflow. Differently from the LLaMA V2 example, here we load model weights directly into the model serving endpoint when the endpoint is initialized, without uploading the artifacts into MLflow Model Registry.
frontend ๐ŸŽจ End-to-end example of a frontend demo app which connects to one of the Model Serving Endpoints deployed in the previous notebook using Gradio

Getting Started

To start using this repo on Databricks, there are a few pre-requirements:

  1. Create a GPU Cluster, minimally with Databricks Machine Learning Runtime 13.2 GPU and an NVIDIA T4 GPU (either A10 or A100 is required for the steps involving VLLM).
  2. (only if using Databricks MLR < 13.2) Install CUDA additional dependencies
  3. (only if using MPT models) Install the following Python packages in your cluster:
accelerate==0.21.0
einops==0.6.1
flash-attn==v1.0.5
ninja
tokenizers==0.13.3
transformers==4.30.2
xformers==0.0.20
  1. Once all dependencies finish installing and your cluster has successfully started, you should be good to go.

Roadmap

๐ŸŽจ Frontend Web App Using Gradio
๐Ÿš€ Model Deployment and Real Time Inference
๐Ÿ”Ž Retrieval Augmented Generation (RAG)
๐Ÿ›ฃ๏ธ MLflow AI Gateway

Credits & Reference

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.