Different generation parameters in the same batch
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 536
- Avg merge
- 12h 12m
- Merged PRs (30d)
- 4
Description
Hello team,
Today, batch generation works like the HF generate() function: it accepts several input texts but generation parameters (like temperature, top k, etc.) apply to the whole batch, so it is not possible to use different parameters within the same batch.
Is it because using different parameters in the same batch would degrade performance so much that it would defeat the purpose of batch generation?
Ideally it would be awesome if one could do something like this:
generator.generate_batch([
{"input":input_1, "max_length":30, "sampling_topk":10},
{"input":input_2, "max_length":150, "sampling_topk":50},
{"input":input_3, "max_length":10, "sampling_topk":50},
...
])
For example this is something that can be achieved with NVIDIA Faster Transformers: https://github.com/NVIDIA/FasterTransformer/blob/main/examples/pytorch/gpt/gpt_example.py
Thank you!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the batch-generation entry point behind generator.generate_batch and compare its current parameter handling with the per-input example in the issue. Use the FasterTransformer reference to investigate whether per-item max_length and sampling parameters can be supported, and define completion around accepting the proposed input shape without unacceptable batch-performance degradation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- machine-learning, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100