apply Black 25.11.0 style in fbcode/deeplearning/projects (21/92)

Summary:
Formats the covered files with pyfmt.

paintitblack

Reviewed By: itamaro

Differential Revision: D90476315

fbshipit-source-id: ee94c471788b8e7d067813d8b3e0311214d17f3f
This commit is contained in:
Bowie Chen
2026-01-11 23:16:49 -08:00
committed by meta-codesync[bot]
parent 7b89b8fc3f
commit 11dec2936d
69 changed files with 445 additions and 522 deletions

View File

@@ -36,9 +36,9 @@ def unix_pattern_to_parameter_names(
parameter_names = []
for param_name in constraints:
matching_parameters = set(fnmatch.filter(all_parameter_names, param_name))
assert (
len(matching_parameters) > 0
), f"param_names {param_name} don't match any param in the given names."
assert len(matching_parameters) > 0, (
f"param_names {param_name} don't match any param in the given names."
)
parameter_names.append(matching_parameters)
return set.union(*parameter_names)

View File

@@ -10,10 +10,8 @@ import uuid
from typing import Any, Dict, Optional, Union
from hydra.utils import instantiate
from iopath.common.file_io import g_pathmgr
from numpy import ndarray
from sam3.train.utils.train_utils import get_machine_local_and_dist_rank, makedir
from torch import Tensor
from torch.utils.tensorboard import SummaryWriter

View File

@@ -11,7 +11,6 @@ from datetime import timedelta
from typing import Optional
import hydra
import numpy as np
import omegaconf
import torch
@@ -83,9 +82,9 @@ def get_machine_local_and_dist_rank():
"""
local_rank = int(os.environ.get("LOCAL_RANK", None))
distributed_rank = int(os.environ.get("RANK", None))
assert (
local_rank is not None and distributed_rank is not None
), "Please the set the RANK and LOCAL_RANK environment variables."
assert local_rank is not None and distributed_rank is not None, (
"Please the set the RANK and LOCAL_RANK environment variables."
)
return local_rank, distributed_rank