Skip to content

Inquiry on vLLM Inference for cogagent Model Compared to glm-4v-9b #25

@aptsunny

Description

@aptsunny

Feature request / 功能建议

Hello CogAgent Team,
I hope this message finds you well. I am currently working with the cogagent-9b-20241220 model and have noted that there is currently no support for inference with the vLLM framework, as mentioned in the README file.
I would like to inquire if the vLLM inference process for the cogagent model is similar to that of the glm-4v-9b model. If there are significant differences, could you please provide guidance on what modifications might be necessary to adapt the cogagent model for vLLM inference?
Specifically, I am interested in understanding:
The differences in model inputs and outputs between the two models.
Any changes required in the model architecture or configuration for vLLM compatibility.
Any known issues or limitations when adapting cogagent for vLLM inference.
Thank you in advance for your assistance. I look forward to your insights and any recommendations you might have for enabling vLLM inference with the cogagent model.

Motivation / 动机

from PIL import Image
from vllm import LLM, SamplingParams

model_name = "THUDM/glm-4v-9b"

llm = LLM(model=model_name,
          tensor_parallel_size=1,
          max_model_len=8192,
          trust_remote_code=True,
          enforce_eager=True)
stop_token_ids = [151329, 151336, 151338]
sampling_params = SamplingParams(temperature=0.2,
                                 max_tokens=1024,
                                 stop_token_ids=stop_token_ids)

prompt = "What's the content of the image?"
image = Image.open("your image").convert('RGB')
inputs = {
    "prompt": prompt,
    "multi_modal_data": {
        "image": image
        },
        }
outputs = llm.generate(inputs, sampling_params=sampling_params)

for o in outputs:
    generated_text = o.outputs[0].text
    print(generated_text)

Your contribution / 您的贡献

xx

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions