lm-sys / lm-sys/FastChat

Load model as bf16

Open
#2,677 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.5k
Forks
4.8k
PR merge metrics
No merged PRs in 30d

Description

Hi! In order to finetune 70B llama-2, under deepspeed zero-3 offload, without CPU memory OOM, maybe loading bf16 model is a better choice?
https://github.com/lm-sys/FastChat/blob/a19866bff04f5252fdc0e3f585bec4f143a2ccc2/fastchat/train/train.py#L268-L272

For example,
```
torch_dtype=torch.bfloat16 if args.bf16 else torch.float16
```
In https://github.com/pacman100/DHS-LLM-Workshop/blob/973b4482806cd735ccc4ff4032a52b4d9dc76544/chat_assistant/training/utils.py#L192

Or
```
if training_args.bf16:
torch_dtype = torch.bfloat16
elif training_args.fp16:
torch_dtype = torch.float16
else:
torch_dtype = torch.float32
```

Contributor guide

No contributing guide indexed for this repository

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 fastchat/train/train.py at the model-loading code around lines 268-272, then compare the linked training utility examples. Verify how bf16, fp16, and the fallback dtype should be selected from the training arguments. Done means the requested dtype is used during model loading without changing the other precision paths.

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
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.