Repository navigation
Move output .float() to loss fn and compile it if compiling - #642
Merged
Merged
Conversation
[ghstack-poisoned]
…ing" [ghstack-poisoned]
…ing" cc: tianyu-l I checked that TP=2, DP=4 with compile looks okay: ``` ``` [ghstack-poisoned]
This was referenced Oct 22, 2024
awgu
marked this pull request as ready for review
October 22, 2024 15:38
Contributor
Author
|
not sure who else to tag to review |
tianyu-l
approved these changes
Oct 22, 2024
tianyu-l
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me. Do you think it's worth adding a short note in docs/composability.md to document this "model change"?
…ing" cc: tianyu-l I checked that TP=2, DP=4 with compile looks okay: ``` [rank0]:2024-10-22 08:04:37,873 - root - INFO - Training starts at step 1, with local batch size 1, global batch size 4, sequence length 8192, total steps 1000 (warmup 200) [rank0]:/data/users/andgu/pytorch/torch/_inductor/lowering.py:1759: UserWarning: Torchinductor does not support code generation for complex operators. Performance may be worse than eager. [rank0]: warnings.warn( [rank0]:/data/users/andgu/pytorch/torch/autograd/graph.py:825: UserWarning: cuDNN SDPA backward got grad_output.strides() != output.strides(), attempting to materialize a grad_output with matching strides... (Triggered internally at /data/users/andgu/pytorch/aten/src/ATen/native/cudnn/MHA.cpp:674.) [rank0]: return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass [rank0]:2024-10-22 08:04:53,798 - root - INFO - step: 1 loss: 12.2442 memory: 36.95GiB(38.89%) wps: 257 mfu: 1.51% [rank0]:2024-10-22 08:04:53,799 - root - INFO - Synchronizing and adjusting timeout for all ProcessGroups to 0:01:40 [rank0]:[rank0]:[W1022 08:04:53.745741040 ProcessGroupNCCL.cpp:4268] [PG ID 0 PG GUID 0 Rank 0] using GPU 0 to perform barrier as devices used by this process are currently unknown. This can potentially cause a hang if this rank to GPU mapping is incorrect. Specify device_ids in barrier() to force use of a particular device, or call init_process_group() with a device_id. [rank0]:2024-10-22 08:05:01,119 - root - INFO - step: 2 loss: 12.0802 memory: 44.53GiB(46.87%) wps: 560 mfu: 3.28% [rank0]:2024-10-22 08:05:01,824 - root - INFO - step: 3 loss: 11.7657 memory: 44.53GiB(46.87%) wps: 5,807 mfu: 34.01% [rank0]:2024-10-22 08:05:02,529 - root - INFO - step: 4 loss: 11.2496 memory: 44.53GiB(46.87%) wps: 5,822 mfu: 34.09% [rank0]:2024-10-22 08:05:03,237 - root - INFO - step: 5 loss: 10.8570 memory: 44.53GiB(46.87%) wps: 5,788 mfu: 33.89% [rank0]:2024-10-22 08:05:03,943 - root - INFO - step: 6 loss: 10.6067 memory: 44.53GiB(46.87%) wps: 5,804 mfu: 33.99% [rank0]:2024-10-22 08:05:04,648 - root - INFO - step: 7 loss: 10.2545 memory: 44.53GiB(46.87%) wps: 5,811 mfu: 34.03% [rank0]:2024-10-22 08:05:05,357 - root - INFO - step: 8 loss: 10.4116 memory: 44.53GiB(46.87%) wps: 5,785 mfu: 33.88% [rank0]:2024-10-22 08:05:06,063 - root - INFO - step: 9 loss: 10.0731 memory: 44.53GiB(46.87%) wps: 5,807 mfu: 34.01% [rank0]:2024-10-22 08:05:06,770 - root - INFO - step: 10 loss: 9.9586 memory: 44.53GiB(46.87%) wps: 5,795 mfu: 33.94% [rank0]:2024-10-22 08:05:07,477 - root - INFO - step: 11 loss: 9.8314 memory: 44.53GiB(46.87%) wps: 5,803 mfu: 33.98% [rank0]:2024-10-22 08:05:08,184 - root - INFO - step: 12 loss: 9.4902 memory: 44.53GiB(46.87%) wps: 5,794 mfu: 33.93% [rank0]:2024-10-22 08:05:08,894 - root - INFO - step: 13 loss: 9.2467 memory: 44.53GiB(46.87%) wps: 5,772 mfu: 33.80% [rank0]:2024-10-22 08:05:09,599 - root - INFO - step: 14 loss: 9.0352 memory: 44.53GiB(46.87%) wps: 5,818 mfu: 34.07% [rank0]:2024-10-22 08:05:10,311 - root - INFO - step: 15 loss: 9.0176 memory: 44.53GiB(46.87%) wps: 5,754 mfu: 33.69% [rank0]:2024-10-22 08:05:11,017 - root - INFO - step: 16 loss: 8.9939 memory: 44.53GiB(46.87%) wps: 5,807 mfu: 34.00% [rank0]:2024-10-22 08:05:11,724 - root - INFO - step: 17 loss: 8.7929 memory: 44.53GiB(46.87%) wps: 5,805 mfu: 33.99% [rank0]:2024-10-22 08:05:12,432 - root - INFO - step: 18 loss: 8.7480 memory: 44.53GiB(46.87%) wps: 5,786 mfu: 33.88% [rank0]:2024-10-22 08:05:13,139 - root - INFO - step: 19 loss: 8.7208 memory: 44.53GiB(46.87%) wps: 5,799 mfu: 33.96% [rank0]:2024-10-22 08:05:13,845 - root - INFO - step: 20 loss: 8.5405 memory: 44.53GiB(46.87%) wps: 5,806 mfu: 34.00% [rank0]:2024-10-22 08:05:14,550 - root - INFO - step: 21 loss: 8.5574 memory: 44.53GiB(46.87%) wps: 5,810 mfu: 34.02% [rank0]:2024-10-22 08:05:15,256 - root - INFO - step: 22 loss: 8.2595 memory: 44.53GiB(46.87%) wps: 5,809 mfu: 34.02% [rank0]:2024-10-22 08:05:15,965 - root - INFO - step: 23 loss: 8.5042 memory: 44.53GiB(46.87%) wps: 5,784 mfu: 33.87% [rank0]:2024-10-22 08:05:16,670 - root - INFO - step: 24 loss: 8.0777 memory: 44.53GiB(46.87%) wps: 5,818 mfu: 34.07% [rank0]:2024-10-22 08:05:17,378 - root - INFO - step: 25 loss: 8.0765 memory: 44.53GiB(46.87%) wps: 5,787 mfu: 33.89% [rank0]:2024-10-22 08:05:18,086 - root - INFO - step: 26 loss: 7.9639 memory: 44.53GiB(46.87%) wps: 5,790 mfu: 33.90% [rank0]:2024-10-22 08:05:18,791 - root - INFO - step: 27 loss: 8.0070 memory: 44.53GiB(46.87%) wps: 5,816 mfu: 34.06% [rank0]:2024-10-22 08:05:19,497 - root - INFO - step: 28 loss: 7.9313 memory: 44.53GiB(46.87%) wps: 5,807 mfu: 34.01% [rank0]:2024-10-22 08:05:20,202 - root - INFO - step: 29 loss: 7.6236 memory: 44.53GiB(46.87%) wps: 5,807 mfu: 34.01% [rank0]:2024-10-22 08:05:20,207 - root - WARNING - Dataset c4_test is being re-looped ``` [ghstack-poisoned]
Contributor
Author
|
@tianyu-l added a short blurb in |
fegin
approved these changes
Oct 22, 2024
carmocca
reviewed
Oct 28, 2024
carmocca
left a comment
Contributor
There was a problem hiding this comment.
Shouldn't estimation.py get the loss change too?
Contributor
Author
|
@carmocca yea we should |
carmocca
added a commit
to carmocca/torchtitan
that referenced
this pull request
Oct 28, 2024
awgu
pushed a commit
that referenced
this pull request
Oct 28, 2024
mori360
pushed a commit
to mori360/torchtitan
that referenced
this pull request
Nov 26, 2024
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 13, 2026
ghstack-source-id: 3c96c27 Pull Request resolved: pytorch#642
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 13, 2026
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 25, 2026
ghstack-source-id: 3c96c27 Pull Request resolved: pytorch#642
xrsrke
pushed a commit
to NousResearch/torchtitan
that referenced
this pull request
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
run_llama_train.sh#643.float()to loss fn and compile it if compiling #642cc: @tianyu-l I checked that TP=2, DP=4 with compile looks okay: