deepspeedai / deepspeedai/DeepSpeed
[Question] Why is the call to allocate_workspace() using only the first input as size parameters?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 43.1k
- Forks
- 5k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 112
Description
In DeepSpeedTransformerInference, the function self.allocate_workspace() is called only once per instance, on the first forward() pass call.
This call is made using the batch size (input.size()[0]) and the sequence size (input.size()[1]) of the first forward() pass:
https://github.com/microsoft/DeepSpeed/blob/901d80701258f59fc951c273f4c488ca04b10867/deepspeed/model_implementations/transformers/ds_transformer.py#L140-L147
My question is why? Either:
- The
DeepSpeedTransformerInferenceinstance is meant to be reused with only inputs up to these sizes, otherwise risking to exceed the workspace memory. If this is the case, I haven't see this documented anywhere DeepSpeedTransformerInferenceinstances are meant to be used only once, and in that case I have not seen that documented anywhere either
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 in deepspeed/model_implementations/transformers/ds_transformer.py at the allocate_workspace() call around lines 140-147, and trace how the first forward() inputs determine workspace sizing. Check whether reuse and larger subsequent inputs are documented elsewhere; done means documenting the confirmed instance-reuse and size behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100