Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin process of packaging PRAGmatic #597

Merged
merged 1 commit into from
Feb 5, 2025
Merged

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Jan 16, 2025

Building Pragmatic into a container image is fairly easy.

podman build --build-arg IMAGE=quay.io/ramalama/rocm -t quay.io/ramalama/rocm-rag container-images/pragmatic

Summary by Sourcery

Build:

  • Install Python and the PRAGmatic package.

Copy link
Contributor

sourcery-ai bot commented Jan 16, 2025

Reviewer's Guide by Sourcery

This pull request adds the initial setup for packaging the PRAGmatic library. It clones the PRAGmatic repository, installs its dependencies, and installs the library itself. It also adds python as an install dependency.

Sequence diagram for PRAGmatic build and installation process

sequenceDiagram
    participant S as Script
    participant DNF as Package Manager
    participant Git as Git
    participant Pip as Pip
    S->>DNF: Install Python
    S->>Git: Clone PRAGmatic repository
    S->>Git: Initialize submodules
    S->>Pip: Install requirements
    S->>Pip: Install PRAGmatic package
    S->>S: Cleanup
Loading

Flow diagram for build script modifications

flowchart TD
    A[Start] --> B[DNF Install]
    B --> C[Install Python]
    C --> D[Clone PRAGmatic]
    D --> E[Update Submodules]
    E --> F[Install Requirements]
    F --> G[Install PRAGmatic]
    G --> H[Build Whisper.cpp]
    H --> I[Build Llama.cpp]
    I --> J[Cleanup]
    J --> K[End]
Loading

File-Level Changes

Change Details Files
Added steps to clone, build, and install the PRAGmatic library.
  • Cloned the PRAGmatic repository.
  • Installed the Python dependencies of PRAGmatic.
  • Installed the PRAGmatic library.
  • Added python to the list of installed dependencies
  • Removed the PRAGmatic directory in the cleanup phase of the script to avoid leaving unnecessary files in the image.
container-images/scripts/build_llama_and_whisper.sh
Updated the cleanup phase to remove the PRAGmatic directory.
  • Removed the PRAGmatic directory after the build process is complete to ensure a clean image.
container-images/scripts/build_llama_and_whisper.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@rhatdan
Copy link
Member Author

rhatdan commented Jan 16, 2025

This could get painful:
$ podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
quay.io/ramalama/ramalama latest 4c2e061e2975 7 minutes ago 10.5 GB

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @rhatdan - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Since this is marked as WIP, please clarify in the PR description what work is still pending and what the current limitations are.
  • Consider using a virtual environment for pip installations instead of installing directly to /usr, or document why this specific approach is necessary.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -94,6 +95,18 @@ clone_and_build_llama_cpp() {
cd ..
}

clone_and_build_pragmatic() {
local llama_cpp_sha="924518e2e5726e81f3aeb2518fb85963a500e93a"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused stuff could be cleaned up here

@rhatdan rhatdan force-pushed the pragmatic branch 10 times, most recently from 2fe8b8e to b04281b Compare January 23, 2025 17:56
@rhatdan rhatdan changed the title [WIP] Begin process of packaging PRAGmatic Begin process of packaging PRAGmatic Jan 23, 2025
@@ -0,0 +1,22 @@
#!/bin/bash

clone_and_build_pragmatic() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add

set -exu -o pipefail

We want the build to fail if these commands fail.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I am still working on making the install smaller. Gotten CPU cut in 1/3 but little change in ROCM and CUDA.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the same flag to build_llama_and_whisper.sh?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set -ex is there, it's just in the main function (we could add, -o pipefail, etc. if it suits). I tend to create main functions in shell scripts to encourage using scope and less global variable.

set -e alone covers a lot to be fair sometimes it's sufficient.

I do like to add -x at times also, makes CI easy to debug.

But set -e at least is a good idea.


export PYTHON_VERSION="python3 -m"
if [ "$(python3 --version)" \< "Python 3.11" ]; then
dnf install -y python3.11 python3.11-pip
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question, python3.12 and python3.13 are not supported? Still learning these bits.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are supported, this is just checking for RHEL 9 systems with python 3.9. Basically ramalama requires 3.11 or later.

@rhatdan
Copy link
Member Author

rhatdan commented Feb 5, 2025

@ericcurtin @bmahabirbu this is ready to go in. It does not build anything yet, just allows people to build RAG Models layers on top of our images. Once this is in, we can start experimenting with using RAG with RamaLama.

Building Pragmatic into a container image is fairly easy.

podman build --build-arg IMAGE=quay.io/ramalama/rocm -t quay.io/ramalama/rocm-rag container-images/pragmatic

Signed-off-by: Daniel J Walsh <[email protected]>
@ericcurtin
Copy link
Collaborator

@bmahabirbu feel free to review and merge, I'll probably be offline soon (if the builds pass of course).

Fedora 42 build can be ignored, would love to turn that off as it's unstable (Fedora 42 isn't even released).

@rhatdan rhatdan merged commit 032efae into containers:main Feb 5, 2025
16 of 17 checks passed
@bmahabirbu
Copy link
Collaborator

bmahabirbu commented Feb 5, 2025

@rhatdan thanks for merging! Will play around with this this week!

@rhatdan
Copy link
Member Author

rhatdan commented Feb 8, 2025

Here is the lastest stuff I am working on for creation of the vector.db

#501

@rhatdan
Copy link
Member Author

rhatdan commented Feb 8, 2025

I also just got this merged: redhat-et/PRAGmatic#39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants