with_nccl_blocking_wait,
)
from torch.testing._internal.common_utils import (
- IS_WINDOWS,
TestCase,
run_tests,
retry_on_connect_failures,
from torch.utils.checkpoint import checkpoint
from torch.distributed.optim import functional_optim_map
-if not IS_WINDOWS:
- from torch.distributed.optim.functional_sgd import _FunctionalSGD
- from torch.distributed.optim.functional_adam import _FunctionalAdam
- from torch.distributed.optim.functional_adamw import _FunctionalAdamW
+from torch.distributed.optim.functional_sgd import _FunctionalSGD
+from torch.distributed.optim.functional_adam import _FunctionalAdam
+from torch.distributed.optim.functional_adamw import _FunctionalAdamW
if TEST_WITH_DEV_DBG_ASAN:
print(
-import unittest
-
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import SGD, Adam, AdamW
-from torch.testing._internal.common_utils import TestCase, run_tests, IS_WINDOWS
+from torch.testing._internal.common_utils import TestCase, run_tests
from torch.distributed.optim import functional_optim_map
class MyModule(torch.nn.Module):
self.assertNotEqual(old_module_optim_params[i], optim_param)
self.assertNotEqual(old_module_functional_params[i], functional_param)
- @unittest.skipIf(
- IS_WINDOWS,
- "Functional optimizer not support on windows, see https://github.com/pytorch/pytorch/issues/62137",
- )
def test_functional_optim_parity_sgd(self):
self._test_functional_optim_parity(SGD, 1e-2, momentum=0.9, weight_decay=0.01)
- @unittest.skipIf(
- IS_WINDOWS,
- "Functional optimizer not support on windows, see https://github.com/pytorch/pytorch/issues/62137",
- )
def test_functional_optim_parity_adam(self):
self._test_functional_optim_parity(Adam, 1e-2, betas=(0.9, 0.999), eps=1e-6)
- @unittest.skipIf(
- IS_WINDOWS,
- "Functional optimizer not support on windows, see https://github.com/pytorch/pytorch/issues/62137",
- )
def test_functional_optim_parity_adam_w(self):
self._test_functional_optim_parity(AdamW, 1e-2, betas=(0.9, 0.999), eps=1e-6)
from torch.distributed.optim import functional_optim_map
+from torch.distributed.optim.functional_sgd import _FunctionalSGD
+from torch.distributed.optim.functional_adam import _FunctionalAdam
+from torch.distributed.optim.functional_adamw import _FunctionalAdamW
+
if not IS_WINDOWS:
import torch.distributed.optim.post_localSGD_optimizer as post_localSGD_optimizer
- from torch.distributed.optim.functional_sgd import _FunctionalSGD
- from torch.distributed.optim.functional_adam import _FunctionalAdam
- from torch.distributed.optim.functional_adamw import _FunctionalAdamW
from torch.utils.data.distributed import DistributedSampler
BACKEND != "nccl" and BACKEND != "gloo",
"Only Nccl & Gloo backend support DistributedDataParallel",
)
- @sandcastle_skip_if(
- IS_WINDOWS,
- "FunctionalAdam not yet supported with Windows, see https://github.com/pytorch/pytorch/issues/62137"
- )
@skip_if_lt_x_gpu(2)
@skip_if_rocm
def test_ddp_hook_with_optimizer_parity_adamw(self):
BACKEND != "nccl" and BACKEND != "gloo",
"Only Nccl & Gloo backend support DistributedDataParallel",
)
- @sandcastle_skip_if(
- IS_WINDOWS,
- "FunctionalAdam not yet supported with Windows, see https://github.com/pytorch/pytorch/issues/62137"
- )
@skip_if_lt_x_gpu(2)
@skip_if_rocm
def test_ddp_hook_with_optimizer_parity_adam(self):
BACKEND != "nccl" and BACKEND != "gloo",
"Only Nccl & Gloo backend support DistributedDataParallel",
)
- @sandcastle_skip_if(
- IS_WINDOWS,
- "FunctionalSGD not yet supported with Windows, see https://github.com/pytorch/pytorch/issues/62137"
- )
@skip_if_lt_x_gpu(2)
@skip_if_rocm
def test_ddp_hook_with_optimizer_parity_sgd(self):