deepspeedai / deepspeedai/DeepSpeed

[REQUEST] HF generate() enabling when training with pipeline

Open
#3,557 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.
Deepspeed is a very useful library and I'm now training LlamaForCausalLM in HF with pipeline parallel. I notice that when eval during training procedure, I should use engine.eval_batch(). But I want to generate texts using HF's powerful generate() which includes a variety of methods for sampling during generation.

Describe the solution you'd like
When eval HF's CausalLM during training with pipeline_engine, I hope to use generate().

Describe alternatives you've considered
Now, I inherits the GenerationMixin class in HF init with engine, and get logits in forward() by engine.eval_batch(return_logits=True). After obtaining the engine, it is not very elegant to require initializing a new class for generation during evaluation.

Thanks in advance.

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 by tracing how pipeline_engine handles eval_batch() and return_logits=True, then compare that path with Hugging Face CausalLM GenerationMixin and generate(). The issue names no files or tests; done would require an agreed integration that enables generate() during pipeline-parallel training evaluation without a separate generation class.

Written by the indexing model from the issue text.

Assessment

Tech stack
huggingface, python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.