deepspeedai / deepspeedai/DeepSpeed

[REQUEST] add `initialize_inference` wrapper

Open
#1,744 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

Is your feature request related to a problem? Please describe.

For Deepspeed ZeRO Inference currently one has to do one of:

ds_engine = deepspeed.initialize(model=model, config_params=ds_config)[0]
ds_engine, _, _, _ = deepspeed.initialize(model=model, config_params=ds_config)

Describe the solution you'd like

I propose a simple wrapper that makes the API slightly more user-friendly for inference users:

# deepspeed/__init__.py
def initialize_inference(*args, **kwargs):
    return initialize(*args, **kwargs)[0]

and then use:

ds_engine = deepspeed.initialize_inference(model=model, config_params=ds_config)

Hmm, thinking more about it, perhaps someone will want the dataloader return value as well, in which case this proposal won't be good.

I have just never used the dataloader side of things in deepspeed, so I'm not sure if someone will want it for inference or not.

If someone may want it then let's close this request.

@jeffra, @tjruwase

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in deepspeed/init.py and inspect the existing initialize return values and inference usage. Determine whether inference callers need the dataloader return value before settling the wrapper's API. Done means the requested inference entry point has a clear, agreed return behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.