Repository navigation
Fix the CI loss issue - #2315
Conversation
[ghstack-poisoned]
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: 4e6258e Pull-Request: #2315
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: d94772d Pull-Request: #2315
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: aba91dc Pull-Request: #2315
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: de6d6b4 Pull-Request: #2315
| 7 4.3239 | ||
| 8 4.0675 | ||
| 9 3.9687 | ||
| 10 3.7249 |
There was a problem hiding this comment.
hmm, why the change is so drastic -- does it mean previously there are bugs?
cc @pianpwk
There was a problem hiding this comment.
Not sure if it is unrealistic but the first couple steps we have big learning rate, so some minor difference in the gradient can result in big change?
There was a problem hiding this comment.
No if we use the same seed, it's absolutely not nondeterminism -- there must be something going on.
There was a problem hiding this comment.
Can i ask why the first 4 steps remain unchanged?
There was a problem hiding this comment.
No if we use the same seed, it's absolutely not nondeterminism -- there must be something going on.
I don't understand the nondeterminism statement. The loss change is from pytorch/pytorch#173569 removing allreduce, according @pianpwk. So the loss change is expected. The loss is deterministic after pytorch/pytorch#173569. But the loss is different from what we have previously, pytorch/pytorch#173569.
I thought your concern is the degree of the change, why nondeterminism?
Can i ask why the first 4 steps remain unchanged?
Only the first step doesn't change, but we only compare the 4 digits. We can print out more digits if this confuses people.
There was a problem hiding this comment.
Ah also, that PR is reverted for now... the same issue showed up internally (doesn't match numerics before)
There was a problem hiding this comment.
ok do I understand correctly that, with the PR reverted, the current PR should fail?
Also, if the change is caused by that PR, why the change is so drastic?
There was a problem hiding this comment.
ok do I understand correctly that, with the PR reverted, the current PR should fail?
Yes
And since the PR cause more than one training framework numeric changes, I would suggest that @pianpwk verifies both frameworks before relanding the PR.
| 7 4.3239 | ||
| 8 4.0675 | ||
| 9 3.9687 | ||
| 10 3.7249 |
There was a problem hiding this comment.
No if we use the same seed, it's absolutely not nondeterminism -- there must be something going on.
| python3 scripts/loss_compare.py . . --baseline-options="${baseline_options}" --test-options="${test_options}" --job-dump-folder="${RUNNER_TEMP}/artifacts-to-be-uploaded/accuracy_comparison_outputs" --assert-equal --steps=1 | ||
| rm -rf $RUNNER_TEMP/artifacts-to-be-uploaded/* | ||
|
|
||
| python3 scripts/loss_compare.py . . --baseline-options="${baseline_options}" --job-dump-folder="${RUNNER_TEMP}/artifacts-to-be-uploaded/accuracy_comparison_outputs" --import-result="${LOSS_FILE}" --assert-equal --job-dump-folder="${RUNNER_TEMP}/artifacts-to-be-uploaded/accuracy_comparison_outputs/loss.txt" --steps=100 |
There was a problem hiding this comment.
Why we only compare step=1 with the LOSS_FILE in previous comparison, but run again with 100 steps, why don't we merge these comparision?
There was a problem hiding this comment.
We cannot compare FSDP and HSDP for 100 steps anymore. These are essentially two different comparisons. For one step, that is to ensure that FSDP and HSDP first forward loss is on par. After the first step, we couldn't guarantee the same loss anymore.
There was a problem hiding this comment.
Thanks, so here's my understanding of the code:
llama3_cuda/rocm.txthas loss from FSDP (dp_shard=8) experiments- This line we are comparing a new FSDP run (baseline_options = "dp_replicate=1", so FSDP degree = 8), with the result in
llama3_cuda/rocm.txt
| python3 scripts/loss_compare.py . . --baseline-options="${baseline_options}" --test-options="${test_options}" --job-dump-folder="${RUNNER_TEMP}/artifacts-to-be-uploaded/accuracy_comparison_outputs" --assert-equal --steps=1 | ||
| rm -rf $RUNNER_TEMP/artifacts-to-be-uploaded/* | ||
|
|
||
| python3 scripts/loss_compare.py . . --baseline-options="${baseline_options}" --job-dump-folder="${RUNNER_TEMP}/artifacts-to-be-uploaded/accuracy_comparison_outputs" --import-result="${LOSS_FILE}" --assert-equal --job-dump-folder="${RUNNER_TEMP}/artifacts-to-be-uploaded/accuracy_comparison_outputs/loss.txt" --steps=100 |
There was a problem hiding this comment.
Thanks, so here's my understanding of the code:
llama3_cuda/rocm.txthas loss from FSDP (dp_shard=8) experiments- This line we are comparing a new FSDP run (baseline_options = "dp_replicate=1", so FSDP degree = 8), with the result in
llama3_cuda/rocm.txt
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: c5ee918 Pull-Request: #2315
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: d7ed318 Pull-Request: #2315
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: 0202ff0 Pull-Request: #2315
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: 182c594 Pull-Request: #2315
[ghstack-poisoned]
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: 5e3ec64 Pull-Request: #2315
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: 3245f3e Pull-Request: #2315
[ghstack-poisoned]
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: b1b0b06 Pull-Request: #2315
| logger.info( | ||
| f"{color.red}step: {step:2} " | ||
| f"{color.green}loss: {global_avg_loss:7.4f} " | ||
| f"{color.green}loss: {global_avg_loss:8.5f} " |
There was a problem hiding this comment.
not sure if this format change would break anything in your internal loss check script
There was a problem hiding this comment.
We used space to separate the metrics, so this should be okay. Will fix it if this does break something.
[ghstack-poisoned]
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP). ghstack-source-id: ad87608 Pull-Request: #2315
Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.14.0) (oldest at bottom): * __->__ pytorch#2315 pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP).
Stack from [ghstack](https://github.com/ezyang/ghstack/tree/0.14.0) (oldest at bottom): * __->__ pytorch#2315 pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss. This PR changes 1. Only compare FSDP and HSDP for one step. 2. Have a seperate run to compare the loss of FSDP after 100 steps with previous result (also FSDP).
Stack from ghstack (oldest at bottom):
pytorch/pytorch#173569 changes how NormPartial works and potentially change the loss.
This PR changes