Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for pytest picking up wrong deepspeed #2299

Merged
merged 1 commit into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed tests/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/unit/autotuning/test_autotuning.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import pytest
from tests.unit.simple_model import create_config_from_dict
from unit.simple_model import create_config_from_dict
from deepspeed.launcher import runner as dsrun
from deepspeed.autotuning.autotuner import Autotuner
from deepspeed.autotuning.scheduler import ResourceManager
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/checkpoint/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from deepspeed.runtime.fp16.unfused_optimizer import FP16_UnfusedOptimizer
from deepspeed.runtime.zero.stage3 import DeepSpeedZeroOptimizer_Stage3

from tests.unit.simple_model import *
from unit.simple_model import *


def compare_deepspeed_states(saved_model, loaded_model):
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/checkpoint/test_latest_checkpoint.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import deepspeed

from tests.unit.common import DistributedTest
from tests.unit.simple_model import *
from unit.common import DistributedTest
from unit.simple_model import *

from tests.unit.checkpoint.common import checkpoint_correctness_verification
from unit.checkpoint.common import checkpoint_correctness_verification


class TestLatestCheckpoint(DistributedTest):
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/checkpoint/test_lr_scheduler.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import deepspeed
from deepspeed.ops.op_builder import CPUAdamBuilder

from tests.unit.common import DistributedTest
from tests.unit.simple_model import *
from unit.common import DistributedTest
from unit.simple_model import *

from tests.unit.checkpoint.common import checkpoint_correctness_verification
from unit.checkpoint.common import checkpoint_correctness_verification

import pytest

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/checkpoint/test_moe.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from deepspeed.moe.utils import split_params_into_different_moe_groups_for_optimizer

from tests.unit.common import DistributedTest
from tests.unit.simple_model import *
from tests.unit.util import required_torch_version
from unit.common import DistributedTest
from unit.simple_model import *
from unit.util import required_torch_version

from tests.unit.checkpoint.common import checkpoint_correctness_verification
from unit.checkpoint.common import checkpoint_correctness_verification

import pytest

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/checkpoint/test_other_optimizer.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import deepspeed
from deepspeed.ops.op_builder import FusedLambBuilder

from tests.unit.common import DistributedTest
from tests.unit.simple_model import *
from unit.common import DistributedTest
from unit.simple_model import *

from tests.unit.checkpoint.common import checkpoint_correctness_verification
from unit.checkpoint.common import checkpoint_correctness_verification

import pytest

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/checkpoint/test_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from deepspeed.runtime.checkpoint_engine.torch_checkpoint_engine import TorchCheckpointEngine
from tests.unit.common import DistributedTest
from tests.unit.simple_model import *
from unit.common import DistributedTest
from unit.simple_model import *

from tests.unit.checkpoint.common import checkpoint_correctness_verification
from unit.checkpoint.common import checkpoint_correctness_verification

import pytest

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/checkpoint/test_sparse.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import deepspeed

from tests.unit.common import DistributedTest
from tests.unit.simple_model import *
from unit.common import DistributedTest
from unit.simple_model import *

import pytest

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/checkpoint/test_tag_validation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import deepspeed

from tests.unit.common import DistributedTest
from tests.unit.simple_model import *
from unit.common import DistributedTest
from unit.simple_model import *

import pytest

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/checkpoint/test_zero_optimizer.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import deepspeed
from deepspeed.ops.op_builder import CPUAdamBuilder

from tests.unit.common import DistributedTest
from tests.unit.simple_model import *
from tests.unit.util import required_minimum_torch_version
from unit.common import DistributedTest
from unit.simple_model import *
from unit.util import required_minimum_torch_version

from tests.unit.checkpoint.common import *
from unit.checkpoint.common import *

import itertools
import pytest
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/comm/test_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import deepspeed.comm as dist
import deepspeed

from tests.unit.common import DistributedTest, get_master_port
from tests.unit.simple_model import SimpleModel
from unit.common import DistributedTest, get_master_port
from unit.simple_model import SimpleModel

import pytest

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/compression/test_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import pytest
import random
import numpy as np
from tests.unit.megatron_model import get_gpt2_model
from unit.megatron_model import get_gpt2_model
from deepspeed.compression.compress import init_compression
from tests.unit.modeling import BertConfig
from tests.unit.modelingpreln import BertEncoder as BertEncoderPreln
from unit.modeling import BertConfig
from unit.modelingpreln import BertEncoder as BertEncoderPreln
from deepspeed.compression.basic_layer import LinearLayer_Compress, ColumnParallelLinear_Compress, RowParallelLinear_Compress
from deepspeed.compression.helper import convert_conv1d_to_linear

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/elasticity/test_elastic.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pytest
import deepspeed
from tests.unit.common import DistributedTest
from unit.common import DistributedTest
from deepspeed.git_version_info import version as ds_version
import os
from tests.unit.simple_model import SimpleModel
from unit.simple_model import SimpleModel


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/inference/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import itertools
import deepspeed
from deepspeed.git_version_info import torch_info
from tests.unit.common import DistributedTest
from unit.common import DistributedTest
from packaging import version as pkg_version
from deepspeed.ops.op_builder import OpBuilder
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/monitor/test_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from deepspeed.monitor.wandb import WandbMonitor
from deepspeed.monitor.csv_monitor import csvMonitor

from tests.unit.common import DistributedTest
from unit.common import DistributedTest
from deepspeed.runtime.config import DeepSpeedConfig


Expand Down
4 changes: 2 additions & 2 deletions tests/unit/ops/adam/test_adamw.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from deepspeed.ops.adam import FusedAdam
from deepspeed.ops.adam import DeepSpeedCPUAdam
from tests.unit.common import DistributedTest
from tests.unit.simple_model import SimpleModel
from unit.common import DistributedTest
from unit.simple_model import SimpleModel

# yapf: disable
#'optimizer, zero_offload, torch_adam, adam_w_mode, resulting_optimizer
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/pipe/test_pipe_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from deepspeed.pipe import PipelineModule
from deepspeed.utils import RepeatingLoader

from tests.unit.common import DistributedTest
from unit.common import DistributedTest

HIDDEN_DIM = 32
LAYERS = 8
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/profiling/flops_profiler/test_flops_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import pytest
import deepspeed
from deepspeed.profiling.flops_profiler import get_model_profile
from tests.unit.simple_model import SimpleModel, random_dataloader
from tests.unit.common import DistributedTest
from unit.simple_model import SimpleModel, random_dataloader
from unit.common import DistributedTest

TORCH_MAJOR = int(torch.__version__.split('.')[0])
TORCH_MINOR = int(torch.__version__.split('.')[1])
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/runtime/fp16/onebit/test_onebit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from deepspeed.runtime.pipe.topology import PipeDataParallelTopology
from deepspeed.ops.op_builder import OpBuilder
from deepspeed.runtime.pipe.module import PipelineModule
from tests.unit.common import DistributedTest
from tests.unit.simple_model import SimpleModel, random_dataloader
from tests.unit.alexnet_model import AlexNetPipe, train_cifar
from unit.common import DistributedTest
from unit.simple_model import SimpleModel, random_dataloader
from unit.alexnet_model import AlexNetPipe, train_cifar

PipeTopo = PipeDataParallelTopology

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/runtime/pipe/test_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import deepspeed.comm as dist
from deepspeed.runtime.pipe.topology import PipeDataParallelTopology
from deepspeed.runtime.pipe.module import PipelineModule
from tests.unit.alexnet_model import AlexNetPipe, train_cifar
from tests.unit.common import DistributedTest
from unit.alexnet_model import AlexNetPipe, train_cifar
from unit.common import DistributedTest

PipeTopo = PipeDataParallelTopology

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/runtime/pipe/test_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from deepspeed.runtime.pipe.topology import ProcessTopology as Topo
from deepspeed.runtime.pipe.topology import _prime_factors

from tests.unit.common import DistributedTest
from unit.common import DistributedTest


def test_topology_2d():
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/runtime/test_bf16.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import deepspeed
import pytest
from deepspeed.ops.adam import FusedAdam
from tests.unit.common import DistributedTest
from unit.common import DistributedTest
from deepspeed.ops.op_builder import CPUAdamBuilder
from tests.unit.simple_model import SimpleModel, SimpleOptimizer, random_dataloader
from tests.unit.util import bf16_required_version_check
from unit.simple_model import SimpleModel, SimpleOptimizer, random_dataloader
from unit.util import bf16_required_version_check
from deepspeed import comm as dist


Expand Down
4 changes: 2 additions & 2 deletions tests/unit/runtime/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import torch
import pytest
import deepspeed
from tests.unit.common import DistributedTest
from tests.unit.simple_model import SimpleModel, random_dataset
from unit.common import DistributedTest
from unit.simple_model import SimpleModel, random_dataset


def test_repeating_loader():
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/runtime/test_pld.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import pytest
from deepspeed.runtime.progressive_layer_drop import ProgressiveLayerDrop

from tests.unit.common import DistributedTest
from tests.unit.simple_model import SimpleModel, PLD_SimpleModel, random_dataloader
from unit.common import DistributedTest
from unit.simple_model import SimpleModel, PLD_SimpleModel, random_dataloader


@pytest.mark.parametrize('theta', [0, 0.1, 0.9, 1.0])
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/runtime/test_runtime_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import deepspeed.runtime.utils as ds_utils
import deepspeed.utils.groups as groups

from tests.unit.common import DistributedTest
from unit.common import DistributedTest


def test_call_to_str():
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_sparse_grads.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import torch
import deepspeed
from tests.unit.common import DistributedTest
from unit.common import DistributedTest

import deepspeed.utils.groups as groups

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/utils/test_init_on_device.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import torch
import pytest
from tests.unit.simple_model import SimpleModel
from unit.simple_model import SimpleModel
from deepspeed import OnDevice
from packaging import version as pkg_version

Expand Down