From f34f893c504a2515823a9b1ff6cf5893ec9b1d7d Mon Sep 17 00:00:00 2001 From: Steven Troxler Date: Tue, 10 Dec 2024 08:21:30 -0800 Subject: [PATCH] =?UTF-8?q?sync=20torchx=20.pyre=5Fconfiguration.internal?= =?UTF-8?q?=20with=20external=20config=20and=20upg=E2=80=A6=20(#986)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: There are some issues with Pyre versions in github CI, and at the moment we aren't getting type errors. Making a PR to (a) bump to Ubuntu 24.04, because the root cause is a glibc issue (b) upgrade to the 2024-11-25 release (c) suppress errors I'm making a fresh PR because the original one doesn't seem to trigger github CI (maybe because it was exported from a diff) Test Plan: Ran github CI, the problem is fixed. Reviewed By: jesszzzz Differential Revision: D66994745 Pulled By: stroxler --- .github/workflows/pyre.yaml | 2 +- torchx/examples/apps/lightning/data.py | 6 +++--- torchx/examples/apps/tracker/main.py | 2 ++ torchx/pipelines/kfp/adapter.py | 4 +++- torchx/schedulers/aws_batch_scheduler.py | 2 ++ torchx/schedulers/aws_sagemaker_scheduler.py | 4 ++-- torchx/schedulers/ray/ray_driver.py | 2 +- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pyre.yaml b/.github/workflows/pyre.yaml index 9e6e1d519..583a2a96d 100644 --- a/.github/workflows/pyre.yaml +++ b/.github/workflows/pyre.yaml @@ -8,7 +8,7 @@ on: jobs: pyre: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Setup Python uses: actions/setup-python@v2 diff --git a/torchx/examples/apps/lightning/data.py b/torchx/examples/apps/lightning/data.py index cc8beb026..9ef437305 100644 --- a/torchx/examples/apps/lightning/data.py +++ b/torchx/examples/apps/lightning/data.py @@ -64,17 +64,17 @@ def __len__(self) -> int: # our trainer and other components that need to load data. -# pyre-fixme[13]: Attribute `test_ds` is never initialized. -# pyre-fixme[13]: Attribute `train_ds` is never initialized. -# pyre-fixme[13]: Attribute `val_ds` is never initialized. class TinyImageNetDataModule(pl.LightningDataModule): """ TinyImageNetDataModule is a pytorch LightningDataModule for the tiny imagenet dataset. """ + # pyre-fixme[13]: Attribute `test_ds` is never initialized. train_ds: ImageFolderSamplesDataset + # pyre-fixme[13]: Attribute `train_ds` is never initialized. val_ds: ImageFolderSamplesDataset + # pyre-fixme[13]: Attribute `val_ds` is never initialized. test_ds: ImageFolderSamplesDataset def __init__( diff --git a/torchx/examples/apps/tracker/main.py b/torchx/examples/apps/tracker/main.py index 86e160786..c9231730e 100644 --- a/torchx/examples/apps/tracker/main.py +++ b/torchx/examples/apps/tracker/main.py @@ -99,6 +99,8 @@ def test( for data, target in test_loader: data, target = data.to(device), target.to(device) output = model(data) + # pyre-fixme[58]: `+` is not supported for operand types `int` and + # `Union[bool, float, int]`. test_loss += F.nll_loss( output, target, reduction="sum" ).item() # sum up batch loss diff --git a/torchx/pipelines/kfp/adapter.py b/torchx/pipelines/kfp/adapter.py index 513c7b698..427f25f44 100644 --- a/torchx/pipelines/kfp/adapter.py +++ b/torchx/pipelines/kfp/adapter.py @@ -50,7 +50,9 @@ def component_spec_from_app(app: api.AppDef) -> Tuple[str, api.Role]: role = app.roles[0] assert ( - role.num_replicas == 1 + role.num_replicas + == 1 + # pyre-fixme[16]: `AppDef` has no attribute `num_replicas`. ), f"KFP adapter only supports one replica, got {app.num_replicas}" command = [role.entrypoint, *role.args] diff --git a/torchx/schedulers/aws_batch_scheduler.py b/torchx/schedulers/aws_batch_scheduler.py index a354c57bc..9577e90fb 100644 --- a/torchx/schedulers/aws_batch_scheduler.py +++ b/torchx/schedulers/aws_batch_scheduler.py @@ -809,6 +809,8 @@ def _stream_events( startFromHead=True, **args, ) + # pyre-fixme[66]: Exception handler type annotation `unknown` must + # extend BaseException. except self._log_client.exceptions.ResourceNotFoundException: return [] # noqa: B901 if response["nextForwardToken"] == next_token: diff --git a/torchx/schedulers/aws_sagemaker_scheduler.py b/torchx/schedulers/aws_sagemaker_scheduler.py index a8f190943..1b6e0cbe1 100644 --- a/torchx/schedulers/aws_sagemaker_scheduler.py +++ b/torchx/schedulers/aws_sagemaker_scheduler.py @@ -267,9 +267,9 @@ def _submit_dryrun( raise ValueError( f"{key} is controlled by aws_sagemaker_scheduler and is set to {job_def[key]}" ) - value = cfg.get(key) # pyre-ignore[26] + value = cfg.get(key) # type: ignore if value is not None: - job_def[key] = value + job_def[key] = value # type: ignore req = AWSSageMakerJob( job_name=job_name, diff --git a/torchx/schedulers/ray/ray_driver.py b/torchx/schedulers/ray/ray_driver.py index 8557cdf29..cd7d647c4 100644 --- a/torchx/schedulers/ray/ray_driver.py +++ b/torchx/schedulers/ray/ray_driver.py @@ -116,7 +116,7 @@ def load_actor_json(filename: str) -> List[RayActor]: return actors -def create_placement_group_async(replicas: List[RayActor]) -> PlacementGroup: +def create_placement_group_async(replicas: List[RayActor]) -> PlacementGroup: # type: ignore """return a placement group reference, the corresponding placement group could be scheduled or pending""" bundles = [] for replica in replicas: