Enable Pyrefly in fbcode/vision/fair

Summary:
Automated migration to enable Pyrefly type checking for `fbcode/vision/fair`.

- Added `python.set_pyrefly(True)` to PACKAGE file
- Suppressed pre-existing type errors

Pyrefly is Meta's next-generation Python type checker, replacing Pyre.

If you encounter issues, you can revert the PACKAGE change by removing
the `python.set_pyrefly(True)` line.
#pyreupgrade

Differential Revision: D107142434

fbshipit-source-id: 25929bb3d5a310d00dab11a46c5395df94357feb
This commit is contained in:
generatedunixname89002005307016
2026-06-02 06:18:19 -07:00
committed by meta-codesync[bot]
parent b73d735ecf
commit 05025bf005
78 changed files with 336 additions and 12 deletions

View File

@@ -173,6 +173,7 @@ class ImplicitronOptimizerFactory(OptimizerFactoryBase):
scheduler = torch.optim.lr_scheduler.LambdaLR(
optimizer,
lambda epoch: self.gamma ** (epoch / self.exponential_lr_step_size),
# pyrefly: ignore [unexpected-keyword]
verbose=False,
)
elif self.lr_policy.casefold() == "LinearExponential".casefold():
@@ -191,7 +192,11 @@ class ImplicitronOptimizerFactory(OptimizerFactoryBase):
# pyre-fixme[28]: Unexpected keyword argument `verbose`.
scheduler = torch.optim.lr_scheduler.LambdaLR(
optimizer, _get_lr, verbose=False
# pyrefly: ignore [unexpected-keyword]
optimizer,
_get_lr,
# pyrefly: ignore [unexpected-keyword]
verbose=False,
)
else:
raise ValueError("no such lr policy %s" % self.lr_policy)

View File

@@ -199,6 +199,7 @@ class ImplicitronTrainingLoop(TrainingLoopBase):
and self.test_interval > 0
and epoch % self.test_interval == 0
):
# pyrefly: ignore [missing-attribute]
self.evaluator.run(
device=device,
dataloader=test_loader,
@@ -215,6 +216,7 @@ class ImplicitronTrainingLoop(TrainingLoopBase):
if self.test_when_finished:
if test_loader is not None:
# pyrefly: ignore [missing-attribute]
self.evaluator.run(
device=device,
dump_to_json=True,

View File

@@ -14,6 +14,7 @@ import torch
def seed_all_random_engines(seed: int) -> None:
# pyrefly: ignore [bad-argument-type]
np.random.seed(seed)
torch.manual_seed(seed)
random.seed(seed)