Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] Adds built-in DeepSpeed handler #292

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

frankfliu
Copy link
Contributor

Description

Brief description of what this PR is about

  • If this change is a backward incompatible change, why must this change be made?
  • Interesting edge cases to note here

Copy link
Contributor

@lanking520 lanking520 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest we look back on DeepSpeed config to make it more generic. This solution may only applies to small and simple model. For large model requires CPU memory load saving, DeepSpeed checkpoint loading may not work

model = deepspeed.init_inference(model,
mp_size=mp_size,
dtype=model.dtype,
replace_method='auto',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not always used. Sometimes loading checkpoint will need to remove this line

option.entryPoint=djl_python.deepspeed
option.parallel_loading=true
option.tensor_parallel_degree=2
option.model_loading_timeout=600
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This time is too short?

model = AutoModelForCausalLM.from_pretrained(model_id)
tokenizer = AutoTokenizer.from_pretrained(model_id)
if data_type == "fp16":
model.half()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be more efficient to allow HuggingFace do the FP16 conversion during loading

@lanking520 lanking520 merged commit 440c2fa into deepjavalibrary:master Oct 18, 2022
@frankfliu frankfliu deleted the gpt2 branch October 18, 2022 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants