sgl-project/sglang

[Feature] Support `return_hidden_states` in async engine

Chiusa

#6528 aperta il 22 mag 2025

 (1 commento) (0 reazioni) (0 assegnatari)Python (6216 fork)auto 404
good first issue

Metriche repository

Star
 (28.442 stelle)
Metriche merge PR
 (Merge medio 2g 1h) (1000 PR mergiate in 30 g)

Descrizione

Checklist

Motivation

Currently, it is possible to get hidden states using the offline interface, i.e. Engine.generate, but Engine.async_generate doesn't support this function.

result = await model.async_generate(
        ["hello", "how are you doing?"],
        sampling_params={"temperature": 0, "max_new_tokens": 1},
        return_hidden_states=True)
TypeError: Engine.async_generate() got an unexpected keyword argument 'return_hidden_states'

This can be useful when developing web services where some additional hidden states postprocess logics is done.

Related resources

No response

Guida contributor