Flip default value for mypy disallow_untyped_defs [5/11] (#127842)

See #127836 for details.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/127842
Approved by: https://github.com/oulgen
This commit is contained in:
Aaron Orenstein
2024-06-08 11:41:11 -07:00
committed by PyTorch MergeBot
parent 62bcdc0ac9
commit 3a0d088517
128 changed files with 128 additions and 0 deletions

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import uuid
from collections import OrderedDict
from functools import wraps

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from dataclasses import dataclass
from typing import Optional

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import math
import traceback

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import itertools
from dataclasses import dataclass, field
from enum import auto, Enum

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import contextlib
from typing import Any, cast, Dict, List, NamedTuple, Optional, Set, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
from typing import Any, Dict, List, Optional, Tuple, TYPE_CHECKING

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
from typing import Any, cast, NoReturn, Optional, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import weakref
from typing import Any, cast, Dict, Iterable, List, NoReturn, Optional, Set, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import defaultdict
from contextlib import contextmanager

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import sys
import warnings
from typing import cast, List, Optional, Tuple, TYPE_CHECKING, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import List, Optional
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from contextlib import contextmanager
from typing import Optional
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.utils import _pytree as pytree
from typing import Optional

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from dataclasses import dataclass
from typing import List, Union, Optional
from functools import reduce

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
from inspect import signature
from .common_op_utils import _basic_validation

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import List, Union, Mapping, Dict, Any
import torch.optim as optim

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
from typing import List, TYPE_CHECKING

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
from torch.distributed._shard.sharded_tensor import (
_sharded_op_impl,

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.distributed as dist
import torch.distributed.distributed_c10d as distributed_c10d

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.distributed._shard.sharded_tensor as sharded_tensor
from torch.distributed._shard.sharded_tensor import (

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
from torch.distributed._shard.sharded_tensor import (
_sharded_op_impl,

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
import torch
from torch.distributed._shard.sharded_tensor import (

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from __future__ import annotations # type: ignore[attr-defined]
from dataclasses import dataclass
from typing import (

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from dataclasses import dataclass, field
from enum import Enum
from typing import List

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
from typing import List, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from dataclasses import dataclass
from typing import List

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import collections.abc
import copy
from typing import Optional, List, Sequence, TYPE_CHECKING

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import List, Optional, Tuple
from torch.distributed._shard.metadata import ShardMetadata

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from abc import ABC, abstractmethod
from dataclasses import dataclass
import functools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from dataclasses import dataclass
import torch
import torch.distributed._shard.sharded_tensor.metadata as sharded_tensor_meta

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.distributed as dist

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.distributed as dist

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import cast, List

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from abc import ABC, abstractmethod
from contextlib import contextmanager, nullcontext
from copy import copy

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Callable, Dict, List, Set
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from dataclasses import dataclass
from functools import partial
from typing import Any, List, Optional, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import logging
import sys
from types import ModuleType

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import operator
from contextlib import contextmanager
from enum import Enum

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import logging
import operator
from dataclasses import dataclass

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
from typing import cast, List, Optional, Sequence, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Owner(s): ["oncall: distributed"]
import collections
import itertools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
import inspect
import logging

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
import io
import math

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
from typing import Optional, Sequence

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import logging
import math
from dataclasses import dataclass

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from dataclasses import dataclass
from functools import cached_property
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
from functools import lru_cache
from typing import cast, Dict, List, NamedTuple, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from functools import lru_cache
from itertools import chain
from typing import Callable, cast, Dict, List, Optional, Sequence, Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
# implement matrix related ops for distributed tensor
from typing import cast, Dict, List, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import inspect
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from torch.distributed._tensor.api import DTensor
from torch.distributed._tensor.debug.comm_mode import CommDebugMode

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from operator import itemgetter
from typing import List

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import defaultdict
from typing import Any, Dict

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import List, Sequence, Tuple
import numpy as np

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
The following example contains a simple MLP model that uses
different DTensor layouts, and use the checkpointing API to

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
The following example demonstrates how to train a ConvNeXt model
with intermediate activations sharded across mutliple GPUs via DTensor

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
"""
The following example demonstrates how to represent torchrec's embedding
sharding with the DTensor API.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
from contextlib import contextmanager

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
from typing import Callable, Optional, Sequence, Tuple, Union

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import copy
import operator
from typing import Any, cast, Dict, List, Optional, Sequence, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
# implement matrix related ops for distributed tensor
from dataclasses import dataclass, field

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import math
from dataclasses import dataclass

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
from typing import cast, List, Optional, Sequence, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import functools
import itertools

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
from dataclasses import dataclass
from typing import (

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
from dataclasses import dataclass

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import contextlib
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import defaultdict
from itertools import chain

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import warnings
from enum import auto, Enum
from functools import partial

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
import torch
import torch.distributed as dist

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from abc import ABC, abstractmethod
import inspect
from typing import Dict, Type

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
import torch
import torch.distributed as dist

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from enum import Enum
from functools import partial

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import weakref
from typing import Any, Callable, List, Optional

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Any, Callable, cast, Tuple
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Any, Callable, List, no_type_check
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import logging
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from collections import defaultdict
import logging
import math

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import torch
import torch.distributed as dist
from torch import nn

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import warnings
from abc import ABC, abstractmethod
from types import TracebackType

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import warnings
from abc import ABC, abstractmethod
from typing import Union, Iterable, Dict

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright 2022 Cruise LLC
import logging
import warnings

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# flake8: noqa C101
import itertools
from typing import Union, Iterable, Dict, Iterator

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# mypy: allow-untyped-defs
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import sys
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import argparse
import io
import os

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# mypy: allow-untyped-defs
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import traceback as tb
from typing import Any, Dict, Tuple

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
import dataclasses

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Owner(s): ["oncall: distributed"]
import os

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Copyright (c) Meta Platforms, Inc. and affiliates
"""

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
# Owner(s): ["oncall: distributed"]

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import collections
import dataclasses
import io

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import argparse
import os
from enum import Enum

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import functools
import time
from typing import Any, Callable, Dict, List, TypeVar

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import os
from dataclasses import dataclass, field
from enum import Enum

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import Any, cast, List
import torch

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
from typing import List, Tuple
from torch.distributed.checkpoint.metadata import ChunkStorageMetadata

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import contextlib
import functools
import gc

View File

@ -1,3 +1,4 @@
# mypy: allow-untyped-defs
import os
import warnings
from typing import Any, cast, Dict, Optional, Set, Union

Some files were not shown because too many files have changed in this diff Show More