Skip to content

Return the hidden state vectors for the found spans (a new argument for inference API call) #381

Description

@mazurkin

Please return the hidden state vectors for all found spans when requested

Use case

Reusing GLiNER span embeddings as features for a downstream model: run zero-shot extraction, then feed the embedding of each detected span into a separate classifier/retrieval model, instead of re-encoding the span text with another encoder. The embeddings are already contextual and already aligned with the label space, so this is cheap and natural — if they were reachable.

for entity in entities:
    label: str = entity['label']
    text: str = entity['text']
    score: float = entity['score']

    # vector!
    vector: np.ndarray = entity['vector']

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions