Load model as bf16
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
- 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 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