Repository navigation
Fix replicated parameter dtypes during tensor-parallel loading - #15147
yzhautouskay wants to merge 2 commits into
Conversation
|
@sayakpaul Could you please review, based on #15137 (comment) |
|
Hi @yzhautouskay, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice. Once the PR links an issue (or gets the |
| class TestModelUtils: | ||
| @pytest.mark.parametrize("dtype", [torch.float16, torch.bfloat16]) | ||
| @pytest.mark.parametrize("keep_in_fp32_modules", [None, ["keep"]]) | ||
| def test_tensor_parallel_loading_preserves_dtype(self, tmp_path, dtype, keep_in_fp32_modules): |
There was a problem hiding this comment.
Can this go to tests/models/testing_utils/parallelism.py in a separate class please?
sayakpaul
left a comment
There was a problem hiding this comment.
I don't see any problem with the PR. It mimics what we do in the non TP path. So it should really be safe. Cc: @JingyaHuang
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
What does this PR do?
Preserve the loader’s chosen dtype for replicated TP parameters by passing
dtype=param.dtypeto Accelerate. Previously, Accelerate recast weights intended to stay in FP32 to the destination meta parameter’s FP16/BF16 dtype.Adds CPU regression tests using real safetensors loading and Accelerate.
dtype0is FP16;dtype1is BF16.Before:
After:
make style fix-copiespassed.Before submitting
self-reviewskill on the diff?documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.