Skip to content

Commit

Permalink
lint whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
lessw2020 committed Feb 27, 2024
1 parent d31fe31 commit 95a50a9
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions torchtrain/utils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# 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 dataclasses import dataclass
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
from dataclasses import dataclass


def dist_max(x: Union[int, float], mesh: DeviceMesh) -> float:
Expand All @@ -19,33 +19,36 @@ 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)


@dataclass
class Color:
black = '\033[30m'
red = '\033[31m'
green = '\033[32m'
yellow = '\033[33m'
blue = '\033[34m'
magenta = '\033[35m'
cyan = '\033[36m'
white = '\033[37m'
reset = '\033[39m'
black = "\033[30m"
red = "\033[31m"
green = "\033[32m"
yellow = "\033[33m"
blue = "\033[34m"
magenta = "\033[35m"
cyan = "\033[36m"
white = "\033[37m"
reset = "\033[39m"


@dataclass
class Background:
black = '\033[40m'
red = '\033[41m'
green = '\033[42m'
yellow = '\033[43m'
blue = '\033[44m'
magenta = '\033[45m'
cyan = '\033[46m'
white = '\033[47m'
reset = '\033[49m'
black = "\033[40m"
red = "\033[41m"
green = "\033[42m"
yellow = "\033[43m"
blue = "\033[44m"
magenta = "\033[45m"
cyan = "\033[46m"
white = "\033[47m"
reset = "\033[49m"


@dataclass
class Style:
bright = '\033[1m'
dim = '\033[2m'
normal = '\033[22m'
reset = '\033[0m'
bright = "\033[1m"
dim = "\033[2m"
normal = "\033[22m"
reset = "\033[0m"

0 comments on commit 95a50a9

Please sign in to comment.