Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLaMbda.cpp 🦙🔥

Overview

Learn how to run LLaMA.cpp at scale on AWS Lambda using function URLs and response streaming.

Prerequisites

Make sure the following tools are installed and properly configured:

Instructions

  1. Set up AWS credentials.

    💡 For more information on how to do this, please refer to the AWS Boto3 documentation (Developer Guide > Credentials).

    # Option 1: (recommended) AWS CLI
    aws configure
    
    # Option 2: environment variables
    export AWS_DEFAULT_REGION=
    export AWS_ACCESS_KEY_ID=...
    export AWS_SECRET_ACCESS_KEY=...
    export AWS_SESSION_TOKEN=...
  2. Build and deploy the application.

    # 🏗️ Build
    sam build --use-container
    
    # 🚀 Deploy
    sam deploy --guided
    
    # ❗ Don't forget to note down the function URL
    export FUNCTION_URL=`sam list stack-outputs --stack-name llambda-cpp --output json | jq -r '.[] | select(.OutputKey == "LLaMbdaCppFunctionUrl") | .OutputValue'`
  3. Test it out!

    SAM

    sam remote invoke --stack-name llambda-cpp --event '{"body": "{\"message\": \"Explain the theory of relativity.\"}"}'

    cURL

    curl --no-buffer \
         --silent \
         --aws-sigv4 "aws:amz:$AWS_DEFAULT_REGION:lambda" \
         --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \
         -H "x-amz-security-token: $AWS_SESSION_TOKEN" \
         -H "content-type: application/json" \
         -d '{"message": "Explain the theory of relativity."}' \
         $FUNCTION_URL

About

Run LLaMA.cpp at scale on AWS Lambda using function URLs and response streaming

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages