Skip to content

How to retrieve the LLM hidden state? #1857

@ChenShuwei1001

Description

@ChenShuwei1001

Hi, I'm using ChatGLM3 as an encoder to encode sentences, and vllm is deployed to speed up the process.

ChatGLM3 contains a transformer encoder to generate hidden state (with shape L x D where L is #.tokens and D is the dimensionality), and a linear 'decoder' to generate next token. I want to use the hidden state of the final input token to represent the sentence. I have carefully read the source code of vllm, but I can't find a clear solution for my requirement, unless drastically revise the code.

Is there any api or configuration that can meet my requirement? Or do you have any suggestion for implementing my requirement?

Best regards.

Metadata

Metadata

Assignees

No one assigned

    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