Skip to content

Commit

Permalink
build: add tool to compute model memory size
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff MAURY <[email protected]>
  • Loading branch information
jeffmaury committed Mar 23, 2024
1 parent f300c31 commit cb2170c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/compute-model-sizes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This is a basic workflow that is manually triggered

name: Compute model sizes

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
compute:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
# Runs a single command using the runners shell
- name: Compute model size
run: ./tools/compute-model-sizes.sh
7 changes: 7 additions & 0 deletions tools/compute-model-sizes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
echo 'FROM registry.access.redhat.com/ubi9-minimal:9.3' >Containerfile
echo 'RUN microdnf install -y git make g++' >>Containerfile
echo 'RUN git clone https://github.com/ggerganov/llama.cpp' >>Containerfile
echo 'RUN cd llama.cpp && make simple' >>Containerfile
echo 'RUN pwd' >>Containerfile
podman build . -t get-model-size
cat packages/backend/src/assets/ai.json | jq -r .models[].url | while read i; do echo $i; curl -s -L -o model $i; podman run --rm -t --security-opt 'label=disable' -v `pwd`/model:/model get-model-size llama.cpp/simple /model a | grep 'model size'; rm model; done

0 comments on commit cb2170c

Please sign in to comment.