Skip to content

Optionally return past key values from generate #17016

@dblakely

Description

@dblakely

Feature request

The idea would be to optionally return past_key_values inside the generation objects (SampleEncoderDecoderOutput, etc). This could be controlled by a flag called output_past_key_values that's passed to generate and then forwarded to sample, etc.

Motivation

Perhaps this is niche, but my team and I need often need to obtain the past keys and values when generating in order to manipulate them a bit and then feed them back in for subsequent calls to generate. We currently do this with a custom version of sample, but this results in us having to copy and paste a lot of code. Would it be possible to allow past_key_values to be optionally returned by generate?

Your contribution

If you all approve of the feature idea, I'd be able to implement it and submit a PR.

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