forked from pytorch/torchtitan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add TensorBoard logging with loss and wps
ghstack-source-id: d0828f16c06747a5af2586630e5205bf786de1c4 Pull Request resolved: pytorch#57
- Loading branch information
Showing
7 changed files
with
135 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ torch >= 2.2.0.dev | |
sentencepiece | ||
datasets | ||
tomli >= 1.1.0 ; python_version < "3.11" | ||
tensorboard |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# This software may be used and distributed according to the terms of the Llama 2 Community License Agreement. | ||
|
||
from typing import Union | ||
|
||
import torch | ||
import torch.distributed._functional_collectives as funcol | ||
import torch.distributed.distributed_c10d as c10d | ||
from torch.distributed.device_mesh import DeviceMesh | ||
|
||
|
||
def dist_max(x: Union[int, float], mesh: DeviceMesh) -> float: | ||
tensor = torch.tensor(x).cuda() | ||
return funcol.all_reduce(tensor, reduceOp=c10d.ReduceOp.MAX.name, group=mesh) | ||
|
||
|
||
def dist_mean(x: Union[int, float], mesh: DeviceMesh) -> float: | ||
tensor = torch.tensor(x).cuda() | ||
return funcol.all_reduce(tensor, reduceOp=c10d.ReduceOp.AVG.name, group=mesh) |
This file contains 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