Direct image input via PIL instead of Base64

Open
#2,078 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api, backend

Research direction

Look at the image input handling code in the codebase, likely around the model inference or API layer. Find where Base64 encoding/decoding is currently done. Research how PIL images can be passed directly to the underlying llama.cpp C++ bindings. Check existing tests for image processing to understand the interface. 'Done' means the API accepts a PIL Image object or a file path and processes it without the Base64 memory overhead.

Written by the indexing model from the issue text.

Description

Describe the solution you'd like

Support for PIL library image input (path) instead of Base64 encoding.
For example, when using models with transformers library, I provide images this way img = Image.open(path).convert("RGB") which isn't an additional 33% increase of memory overhead like it is with Base64.

Describe alternatives you've considered

I am currently using llama.cpp CLI version to process images in batch using GGUF models but I'd rather prefer this functionality here as well.

Dominant language
Python
Stars
10.7k
Forks
1.5k
Avg merge
1h 40m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from abetlen/llama-cpp-python

All issues in abetlen/llama-cpp-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.