Skip to content

Commit 37e9668

Browse files
bowiechenmeta-codesync[bot]
authored andcommitted
apply Black 25.11.0 style in fbcode (78/92)
Summary: Formats the covered files with pyfmt. paintitblack Reviewed By: itamaro Differential Revision: D90476272 fbshipit-source-id: ff198a4bc3502fa9914722a1c9e2b3d16b8b951c
1 parent 9492f8d commit 37e9668

552 files changed

Lines changed: 725 additions & 1424 deletions

File tree

Some content is hidden

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

examples/01_resnet-50/benchmark_ait.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717
import os
1818

1919
import click
20-
2120
import torch
2221
from aitemplate.compiler import compile_model, Model
23-
2422
from aitemplate.frontend import Tensor
2523
from aitemplate.testing import detect_target
2624
from modeling.resnet import build_resnet_backbone

examples/01_resnet-50/infer_with_torch.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import numpy as np
1818
import torch
1919
from aitemplate.compiler import compile_model, Model
20-
2120
from aitemplate.frontend import Tensor
2221
from aitemplate.testing import detect_target
2322
from modeling.resnet import build_resnet_backbone

examples/01_resnet-50/modeling/resnet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ def make_stage(block_class, num_blocks, *, in_channels, out_channels, **kwargs):
323323
f"same length as num_blocks={num_blocks}."
324324
)
325325
newk = k[: -len("_per_block")]
326-
assert (
327-
newk not in kwargs
328-
), f"Cannot call make_stage with both {k} and {newk}!"
326+
assert newk not in kwargs, (
327+
f"Cannot call make_stage with both {k} and {newk}!"
328+
)
329329
curr_kwargs[newk] = v[i]
330330
else:
331331
curr_kwargs[k] = v

examples/01_resnet-50/test_correctness.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
import unittest
1616

1717
import torch
18-
1918
from aitemplate.compiler import compile_model
20-
2119
from aitemplate.compiler.base import Tensor
2220
from aitemplate.testing import detect_target
2321

examples/02_detectron2/compile_model.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616
import os
1717

1818
import click
19-
2019
import numpy as np
2120
import torch
2221
from aitemplate.compiler import compile_model, Model
23-
2422
from aitemplate.frontend import Tensor
2523
from aitemplate.testing import detect_target
2624
from configs import get_cfg_defaults

examples/02_detectron2/demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ def run_model(
7070
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = confidence_threshold
7171
cfg.freeze()
7272

73-
assert (
74-
weight != ""
75-
), "export model first: python convert_pt2ait.py model_d2.pkl params_ait.pkl \
73+
assert weight != "", (
74+
"export model first: python convert_pt2ait.py model_d2.pkl params_ait.pkl \
7675
--config configs/faster_rcnn_R_50_DC5.yaml"
76+
)
7777

7878
demo = Predictor(cfg)
7979
print("run {} end2end".format(cfg.MODEL.NAME))

examples/02_detectron2/modeling/backbone/fpn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ def _assert_strides_are_log2_contiguous(strides):
186186
Assert that each stride is 2x times its preceding stride, i.e. "contiguous in log2".
187187
"""
188188
for i, stride in enumerate(strides[1:], 1):
189-
assert (
190-
stride == 2 * strides[i - 1]
191-
), "Strides {} {} are not log2 contiguous".format(stride, strides[i - 1])
189+
assert stride == 2 * strides[i - 1], (
190+
"Strides {} {} are not log2 contiguous".format(stride, strides[i - 1])
191+
)
192192

193193

194194
class LastLevelMaxPool(nn.Module):

examples/02_detectron2/modeling/backbone/resnet.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ def make_stage(block_class, num_blocks, *, in_channels, out_channels, **kwargs):
310310
f"same length as num_blocks={num_blocks}."
311311
)
312312
newk = k[: -len("_per_block")]
313-
assert (
314-
newk not in kwargs
315-
), f"Cannot call make_stage with both {k} and {newk}!"
313+
assert newk not in kwargs, (
314+
f"Cannot call make_stage with both {k} and {newk}!"
315+
)
316316
curr_kwargs[newk] = v[i]
317317
else:
318318
curr_kwargs[k] = v
@@ -421,12 +421,12 @@ def build_resnet_backbone(cfg):
421421
}[depth]
422422

423423
if depth in [18, 34]:
424-
assert (
425-
out_channels == 64
426-
), "Must set MODEL.RESNETS.RES2_OUT_CHANNELS = 64 for R18/R34"
427-
assert (
428-
res5_dilation == 1
429-
), "Must set MODEL.RESNETS.RES5_DILATION = 1 for R18/R34"
424+
assert out_channels == 64, (
425+
"Must set MODEL.RESNETS.RES2_OUT_CHANNELS = 64 for R18/R34"
426+
)
427+
assert res5_dilation == 1, (
428+
"Must set MODEL.RESNETS.RES5_DILATION = 1 for R18/R34"
429+
)
430430
assert num_groups == 1, "Must set MODEL.RESNETS.NUM_GROUPS = 1 for R18/R34"
431431

432432
stages = []

examples/02_detectron2/modeling/roi_heads/roi_heads.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from typing import Dict
1616

1717
from aitemplate.compiler import ops
18-
1918
from aitemplate.frontend import nn, Tensor
2019

2120
from .box_head import build_box_head, FastRCNNConvFCHead

examples/02_detectron2/predictor/predictor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import cv2
2020
import numpy as np
2121
import torch
22-
2322
from aitemplate.compiler import Model
2423
from modeling.meta_arch import GeneralizedRCNN
2524
from PIL import Image

0 commit comments

Comments
 (0)