Skip to content

Commit

Permalink
Add type error suppressions for upcoming upgrade (#3504)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebookresearch/FBGEMM#584

Pull Request resolved: #3504

Reviewed By: Solumin

Differential Revision: D67162164

fbshipit-source-id: 6a781090bbec3ef502a574d456cc6eddc3a260be
  • Loading branch information
generatedunixname89002005307016 authored and facebook-github-bot committed Dec 13, 2024
1 parent e4650b4 commit d70a19e
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions fbgemm_gpu/test/quantize/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import torch

# pyre-fixme[16]: Module `fbgemm_gpu` has no attribute `open_source`.
# pyre-fixme[35]: Target cannot be annotated.
open_source: bool = getattr(fbgemm_gpu, "open_source", False)

try:
Expand Down
1 change: 1 addition & 0 deletions fbgemm_gpu/test/quantize/fp8_rowwise_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# `deeplearning.fbgemm.fbgemm_gpu.test.quantize.common`.
from .common import open_source

# pyre-fixme[16]: Module `common` has no attribute `open_source`.
if open_source:
# pyre-ignore[21]
from test_utils import gpu_unavailable, optests, symint_vector_unsupported
Expand Down
1 change: 1 addition & 0 deletions fbgemm_gpu/test/quantize/fused_8bit_rowwise_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
open_source,
)

# pyre-fixme[16]: Module `common` has no attribute `open_source`.
if open_source:
# pyre-ignore[21]
from test_utils import gpu_available
Expand Down
1 change: 1 addition & 0 deletions fbgemm_gpu/test/quantize/fused_nbit_rowwise_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
open_source,
)

# pyre-fixme[16]: Module `common` has no attribute `open_source`.
if open_source:
# pyre-ignore[21]
from test_utils import gpu_available, optests
Expand Down
1 change: 1 addition & 0 deletions fbgemm_gpu/test/quantize/mixed_dim_int8_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# `deeplearning.fbgemm.fbgemm_gpu.test.quantize.common`.
from .common import open_source

# pyre-fixme[16]: Module `common` has no attribute `open_source`.
if open_source:
# pyre-ignore[21]
from test_utils import gpu_unavailable
Expand Down
1 change: 1 addition & 0 deletions fbgemm_gpu/test/quantize/msfp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# `deeplearning.fbgemm.fbgemm_gpu.test.quantize.common`.
from .common import open_source

# pyre-fixme[16]: Module `common` has no attribute `open_source`.
if open_source:
# pyre-ignore[21]
from test_utils import gpu_unavailable
Expand Down
3 changes: 3 additions & 0 deletions fbgemm_gpu/test/quantize/mx/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def check_diff_quantize(
# Convert to numpy
# pyre-fixme[9]: x has type `Tensor`; used as `Union[ndarray, Tensor]`.
x = np.array(x) if type(x) is list else x
# pyre-fixme[9]: x has type `Tensor`; used as `Union[ndarray[Any, Any], Tensor]`.
x = x.cpu().numpy() if type(x) is torch.Tensor else x
y1 = y1.detach().cpu().numpy()
y2 = y2.detach().cpu().numpy()
Expand All @@ -334,11 +335,13 @@ def check_diff_quantize(
where_diff = (diff != 0) | (torch_infs != cuda_infs)
print("%d/%d mismatches" % (np.count_nonzero(where_diff), where_diff.size))
print("First and last mismatch:")
# pyre-fixme[6]: For 1st argument expected `float` but got `Tensor`.
print("Orig:", x[where_diff][0], get_s_e_m(x[where_diff][0]))
print("y1: ", y1[where_diff][0], get_s_e_m(y1[where_diff][0]))
print("y2: ", y2[where_diff][0], get_s_e_m(y2[where_diff][0]))
if np.count_nonzero(where_diff) > 1:
print("--------------------")
# pyre-fixme[6]: For 1st argument expected `float` but got `Tensor`.
print("Orig:", x[where_diff][-1], get_s_e_m(x[where_diff][-1]))
print("y1: ", y1[where_diff][-1], get_s_e_m(y1[where_diff][-1]))
print("y2: ", y2[where_diff][-1], get_s_e_m(y2[where_diff][-1]))
Expand Down
1 change: 1 addition & 0 deletions fbgemm_gpu/test/quantize/mx4_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
check_diff_quantize,
)

# pyre-fixme[16]: Module `common` has no attribute `open_source`.
if open_source:
# pyre-ignore[21]
from test_utils import gpu_unavailable
Expand Down
2 changes: 2 additions & 0 deletions fbgemm_gpu/test/tbe/cache/lxu_cache_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def test_unique_lxu_cache_lookup(
use_cpu=False,
).long()

# pyre-fixme[53]: Captured variable `lxu_cache_state` is not annotated.
def unique_lookup(
indices: Tensor,
offsets: Tensor,
Expand All @@ -197,6 +198,7 @@ def unique_lookup(

return uniq_lxu_cache_locations, uniq_indices_length

# pyre-fixme[53]: Captured variable `lxu_cache_state` is not annotated.
def duplicate_lookup(
indices: Tensor,
offsets: Tensor,
Expand Down

0 comments on commit d70a19e

Please sign in to comment.