Skip to content

Conversation

n1hility
Copy link
Member

@n1hility n1hility commented Apr 27, 2024

Problem

The current cuda builds of instructlab are unaccelerated for serve/generate

Changes

Sync requirements.txt of llama_cpp_python with instructlab

The step which pip installs llama_cpp_python is overwritten by the instructlab install since the instructlab has a pinned version that is lesser than the preceding llama_cpp_python. Since the instructlab install does not specify the cuda CMAKE args it gets rebuilt without cuda support. By aligning requirements we ensure that llama_cpp_python will not be rebuilt.

Before this change:

>>> llama_cpp.llama_supports_gpu_offload()      
False

After:

>>> llama_cpp.llama_supports_gpu_offload()      
True

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
@mergify mergify bot merged commit 3ebaa26 into instructlab:main Apr 28, 2024
@tiran
Copy link
Contributor

tiran commented Apr 28, 2024

@n1hility @russellb
The workaround in this PR is problematic. It doesn't use the current requirements.txt but the version from the main branch. This is likely to cause issues when we create a stable branch and modify requirements in main. Also pip install -r ... will install all dependencies in the requirements file.

I'm using this approach in my container files, which I believe is better:

  1. copy requirements file from context into the container
  2. convert the requirements file to a constraints file by stripping off optional dependencies
  3. pip install with -c instead of -r
COPY requirements.txt /tmp
RUN sed 's/\[.*\]//' /tmp/requirements.txt >/tmp/constraints.txt
RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" python3.11 -m pip install -c /tmp/constraints.txt --force-reinstall --no-cache-dir llama-cpp-python

@russellb
Copy link
Member

russellb commented Apr 28, 2024

Thanks @tiran -- good feedback. you're right.

However, this Containerfile isn't building instructlab from the current source tree. It's explicitly pulling stable from git, so the added line also pulls requirements.txt from stable.

I do think this Containerfile should be enhanced to allow building from the current source tree, as well.

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.

3 participants