Skip to content

Commit 3c2a85a

Browse files
bowiechenmeta-codesync[bot]
authored andcommitted
apply Black 25.11.0 style in fbcode (70/92)
Summary: Formats the covered files with pyfmt. paintitblack Reviewed By: itamaro Differential Revision: D90476295 fbshipit-source-id: 5101d4aae980a9f8955a4cb10bae23997c48837f
1 parent 6569fcc commit 3c2a85a

File tree

112 files changed

+107
-223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+107
-223
lines changed

examples/albef/data/transforms.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from typing import List, Tuple, Union
99

1010
import torch
11-
1211
from torchtext.transforms import PadTransform, Sequential, ToTensor, Truncate
1312
from torchvision import transforms
1413
from transformers.models.bert.tokenization_bert import BertTokenizer

examples/albef/data/vqa_dataset.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from typing import Callable, List, Tuple, Union
1010

1111
import torch
12-
1312
from PIL import Image
1413
from torch import Tensor
1514
from torch.utils.data import Dataset

examples/albef/finetune_vqa.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from model import albef_model_for_vqa
1919
from torch.optim import AdamW
2020
from torch.optim.lr_scheduler import CosineAnnealingWarmRestarts
21-
2221
from utils import (
2322
add_weight_decay,
2423
get_rank,

examples/albef/model.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,15 +572,15 @@ def _eval_forward(
572572
return self._encode_image(image)
573573

574574
elif input_type == "text":
575-
assert (
576-
text is not None and text_atts is not None
577-
), "text and text attention mask cannot be None"
575+
assert text is not None and text_atts is not None, (
576+
"text and text attention mask cannot be None"
577+
)
578578
return self._encode_text(text, text_atts)
579579

580580
elif input_type == "multimodal":
581-
assert (
582-
image is not None and text is not None and text_atts is not None
583-
), "image embeddings, text embeddings, and text attention mask cannot be None"
581+
assert image is not None and text is not None and text_atts is not None, (
582+
"image embeddings, text embeddings, and text attention mask cannot be None"
583+
)
584584
return self._image_text_matching_score(image, text, text_atts)
585585

586586
else:

examples/cnn_lstm/cnn_encoder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ def __init__(
3636
assert len(input_dims) == len(output_dims) and len(output_dims) == len(
3737
kernel_sizes
3838
), "input_dims, output_dims, and kernel_sizes should all have the same length"
39-
assert (
40-
input_dims[1:] == output_dims[:-1]
41-
), "output_dims should match input_dims offset by one"
39+
assert input_dims[1:] == output_dims[:-1], (
40+
"output_dims should match input_dims offset by one"
41+
)
4242
for in_channels, out_channels, kernel_size in zip(
4343
input_dims,
4444
output_dims,

examples/cnn_lstm/cnn_lstm.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from examples.cnn_lstm.cnn_encoder import CNNEncoder
1010
from examples.cnn_lstm.lstm_encoder import LSTMEncoder
11-
1211
from torch import nn
1312
from torchmultimodal.models.late_fusion import LateFusion
1413
from torchmultimodal.modules.fusions.concat_fusion import ConcatFusionModule

examples/cnn_lstm/tests/test_cnn_encoder.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# LICENSE file in the root directory of this source tree.
66

77
import pytest
8-
98
import torch
109
from examples.cnn_lstm.cnn_encoder import CNNEncoder
1110
from tests.test_utils import assert_expected, set_rng_seed

examples/cnn_lstm/tests/test_cnn_lstm.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# LICENSE file in the root directory of this source tree.
66

77
import pytest
8-
98
import torch
109
from examples.cnn_lstm.cnn_lstm import cnn_lstm_classifier
1110
from tests.test_utils import assert_expected, set_rng_seed

examples/cnn_lstm/tests/test_lstm_encoder.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# LICENSE file in the root directory of this source tree.
66

77
import pytest
8-
98
import torch
109
from examples.cnn_lstm.lstm_encoder import LSTMEncoder
1110
from tests.test_utils import assert_expected

examples/flava/data/datamodules.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,9 @@ def __init__(
467467
def _parse_info(
468468
self, info: TorchVisionDatasetInfo, dataset_root: Optional[str] = None
469469
):
470-
assert hasattr(
471-
torchvision.datasets, info.key
472-
), f"No dataset named {info.key} present in torchvision.datasets"
470+
assert hasattr(torchvision.datasets, info.key), (
471+
f"No dataset named {info.key} present in torchvision.datasets"
472+
)
473473
class_ptr = getattr(torchvision.datasets, info.key)
474474
if dataset_root is None:
475475
dataset_root = os.path.join(TRANSFORMERS_CACHE, "datasets", "torchvision")

0 commit comments

Comments
 (0)