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

[Feature]: Multi-Modality Support for Loading Local Files (Images & Videos) #8730

Open
1 task done
whyiug opened this issue Sep 23, 2024 · 14 comments · May be fixed by #9915
Open
1 task done

[Feature]: Multi-Modality Support for Loading Local Files (Images & Videos) #8730

whyiug opened this issue Sep 23, 2024 · 14 comments · May be fixed by #9915
Labels

Comments

@whyiug
Copy link
Contributor

whyiug commented Sep 23, 2024

Your current environment

PyTorch version: 2.4.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: CentOS Linux release 7.9.2009 (Core) (x86_64)
GCC version: (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Clang version: Could not collect
CMake version: version 3.30.1
Libc version: glibc-2.17

Python version: 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-3.10.0-1160.105.1.el7.x86_64-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: 12.0.140
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA A100-SXM4-40GB
Nvidia driver version: 545.23.08
cuDNN version: Probably one of the following:
/usr/local/cuda-12.0/targets/x86_64-linux/lib/libcudnn.so.8.9.1
/usr/local/cuda-12.0/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.9.1
/usr/local/cuda-12.0/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.9.1
/usr/local/cuda-12.0/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.9.1
/usr/local/cuda-12.0/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.9.1
/usr/local/cuda-12.0/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.9.1
/usr/local/cuda-12.0/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.9.1
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 12
On-line CPU(s) list: 0-11
Thread(s) per core: 2
Core(s) per socket: 6
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz
Stepping: 7
CPU MHz: 2499.976
BogoMIPS: 4999.95
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 1024K
L3 cache: 36608K
NUMA node0 CPU(s): 0-11
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc eagerfpu pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single rsb_ctxsw fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 arat avx512_vnni

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.1.3.1
[pip3] nvidia-cuda-cupti-cu12==12.1.105
[pip3] nvidia-cuda-nvrtc-cu12==12.1.105
[pip3] nvidia-cuda-runtime-cu12==12.1.105
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu12==11.0.2.54
[pip3] nvidia-curand-cu12==10.3.2.106
[pip3] nvidia-cusolver-cu12==11.4.5.107
[pip3] nvidia-cusparse-cu12==12.1.0.106
[pip3] nvidia-ml-py==12.555.43
[pip3] nvidia-nccl-cu12==2.20.5
[pip3] nvidia-nvjitlink-cu12==12.5.82
[pip3] nvidia-nvtx-cu12==12.1.105
[pip3] optree==0.12.1
[pip3] pyzmq==26.0.3
[pip3] torch==2.4.0
[pip3] torchvision==0.19.0
[pip3] transformers==4.43.3
[pip3] triton==3.0.0
[conda] numpy 1.26.4 pypi_0 pypi
[conda] nvidia-cublas-cu12 12.1.3.1 pypi_0 pypi
[conda] nvidia-cuda-cupti-cu12 12.1.105 pypi_0 pypi
[conda] nvidia-cuda-nvrtc-cu12 12.1.105 pypi_0 pypi
[conda] nvidia-cuda-runtime-cu12 12.1.105 pypi_0 pypi
[conda] nvidia-cudnn-cu12 9.1.0.70 pypi_0 pypi
[conda] nvidia-cufft-cu12 11.0.2.54 pypi_0 pypi
[conda] nvidia-curand-cu12 10.3.2.106 pypi_0 pypi
[conda] nvidia-cusolver-cu12 11.4.5.107 pypi_0 pypi
[conda] nvidia-cusparse-cu12 12.1.0.106 pypi_0 pypi
[conda] nvidia-ml-py 12.555.43 pypi_0 pypi
[conda] nvidia-nccl-cu12 2.20.5 pypi_0 pypi
[conda] nvidia-nvjitlink-cu12 12.5.82 pypi_0 pypi
[conda] nvidia-nvtx-cu12 12.1.105 pypi_0 pypi
[conda] optree 0.12.1 pypi_0 pypi
[conda] pyzmq 26.0.3 pypi_0 pypi
[conda] torch 2.4.0 pypi_0 pypi
[conda] torchvision 0.19.0 pypi_0 pypi
[conda] transformers 4.43.3 pypi_0 pypi
[conda] triton 3.0.0 pypi_0 pypi
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.6.1.post2@9ba0817ff1eb514f51cc6de9cb8e16c98d6ee44f
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0 CPU Affinity NUMA Affinity GPU NUMA ID
GPU0 X 0-11 0 N/A

Legend:

X = Self
SYS = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
PHB = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
PXB = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
PIX = Connection traversing at most a single PCIe bridge
NV# = Connection traversing a bonded set of # NVLinks

How would you like to use vllm

I have deployed multimodal large models via vllm docker containers and my images are on object storage and have been mounted in the container. To load the image faster, I want to read the image mounted locally.
But I found that only http and bast64 encoded input images are supported here.

def fetch_image(image_url: str, *, image_mode: str = "RGB") -> Image.Image:

Will you support local image files? the code looks like this

elif os.path.isfile(image_url):
    with open(image_url, 'rb') as f:
        image = Image.open(f).convert(image_mode)

if not, how do I rebuild my mirror with minimal changes?

Thanks.

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.
@whyiug whyiug added the usage How to use vllm label Sep 23, 2024
@DarkLight1337
Copy link
Member

DarkLight1337 commented Sep 23, 2024

I suggest that you use offline inference so you don't even have to send the images over HTTP requests in the first place. In offline inference, you can load the images using your own code and then pass them to LLM.generate.

@whyiug
Copy link
Contributor Author

whyiug commented Sep 23, 2024

I suggest that you use offline inference so you don't even have to send the images over HTTP requests in the first place. In offline inference, you can load the images using your own code and then pass them to LLM.generate.

But it need to be an OpenAI Compatible Server.
Actually, I built a separate image service to download images. It takes an image url, downloads the image, and then uploads it to an object store in the cloud. The final inference is then openai compatible service (same picture, more than 10 times multiple inference). This way I can avoid downloading images repeatedly in every pod.

Could you give some tips. how do I rebuild my own docker image with minimal changes for suporting local images? thanks.

@DarkLight1337
Copy link
Member

I see. In that case I suggest that you fork the repo and edit multimodal utils to support loading the image in the way you want. Afterwards, you can edit the Dockerfile to install your fork instead of the official vllm package.

@whyiug
Copy link
Contributor Author

whyiug commented Sep 23, 2024

I see. In that case I suggest that you fork the repo and edit multimodal utils to support loading the image in the way you want. Afterwards, you can edit the Dockerfile to install your fork instead of the official vllm package.

Could you give me a little more detail? at which stage do I start building the image, modify or add in Dockerfile after i fork the repo?

@DarkLight1337
Copy link
Member

You find where in the Dockerfile is vLLM being installed, and replace it with your fork. Then you can build a new image using the modified Dockerfile.

@whyiug
Copy link
Contributor Author

whyiug commented Sep 23, 2024

You find where in the Dockerfile is vLLM being installed, and replace it with your fork. Then you can build a new image using the modified Dockerfile.

Thanks for your help.

@DarkLight1337
Copy link
Member

Feel free to close this issue once it's been solved.

@whyiug whyiug closed this as completed Sep 23, 2024
@jingcheng88
Copy link

jingcheng88 commented Oct 10, 2024

@DarkLight1337 Can vllm support local image by default? Just like lmdeploy.

else:
       # Load image from local path
       image = Image.open(image_url)

@DarkLight1337
Copy link
Member

@DarkLight1337 Can vllm support local image by default? Just like lmdeploy.

else:
       # Load image from local path
       image = Image.open(image_url)

You can use local image in LLM.generate.

@whyiug
Copy link
Contributor Author

whyiug commented Oct 10, 2024

I think he wants online openai service.
If there are still some people who want this feature, maybe we can add this logic.

    elif image_url.startswith("file://"):
        image= Image.open(image_url[7:])

@DarkLight1337
Copy link
Member

DarkLight1337 commented Oct 10, 2024

I think he wants online openai service. If there are still some people who want this feature, maybe we can add this logic.

    elif image_url.startswith("file://"):
        image= Image.open(image_url[7:])

I think this can pose a security risk and should be gated behind a flag at the very least.

In any case, can you open a new issue with [Feature] tag asking for this feature specifically? Or convert this one and reopen it.

@whyiug
Copy link
Contributor Author

whyiug commented Oct 10, 2024

I think he wants online openai service. If there are still some people who want this feature, maybe we can add this logic.

    elif image_url.startswith("file://"):
        image= Image.open(image_url[7:])

I think this can pose a security risk and should be gated behind a flag at the very least.

In any case, can you open a new issue with [Feature] tag asking for this feature specifically? Or convert this one and reopen it.

Sure, although it's no longer what I need.

@whyiug whyiug reopened this Oct 10, 2024
@whyiug whyiug changed the title [Usage]: multimodal large models load local image files [Feature]: multimodal large models load local image files Oct 10, 2024
@whyiug whyiug changed the title [Feature]: multimodal large models load local image files [Feature]: Multi-Modality Support for Loading Local Files (Images & Videos) Oct 10, 2024
@DarkLight1337 DarkLight1337 added feature request good first issue Good for newcomers and removed usage How to use vllm labels Oct 28, 2024
@chaunceyjiang
Copy link

@DarkLight1337 Hi, Can i pick up this issue?

I'm really into vllm and I'm learning how to use it.

@DarkLight1337
Copy link
Member

Sure, I don't think anyone else is working on this atm.

chaunceyjiang added a commit to chaunceyjiang/vllm that referenced this issue Nov 1, 2024
FIX vllm-project#8730

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants