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

tests: move init_models to setUpModule #3715

Merged
merged 5 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
9 changes: 6 additions & 3 deletions source/tests/pt/test_multitask.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
model_se_e2_a,
)

multitask_template_json = str(Path(__file__).parent / "water/multitask.json")
with open(multitask_template_json) as f:
multitask_template = json.load(f)

def setUpModule():
global multitask_template
multitask_template_json = str(Path(__file__).parent / "water/multitask.json")
with open(multitask_template_json) as f:
multitask_template = json.load(f)


class MultiTaskTrainTest:
Expand Down
12 changes: 10 additions & 2 deletions source/tests/tf/test_model_compression_se_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,16 @@ def _init_models_exclude_types():
return INPUT, frozen_model, compressed_model


INPUT, FROZEN_MODEL, COMPRESSED_MODEL = _init_models()
INPUT_ET, FROZEN_MODEL_ET, COMPRESSED_MODEL_ET = _init_models_exclude_types()
def setUpModule():
global \
INPUT, \
FROZEN_MODEL, \
COMPRESSED_MODEL, \
INPUT_ET, \
FROZEN_MODEL_ET, \
COMPRESSED_MODEL_ET
INPUT, FROZEN_MODEL, COMPRESSED_MODEL = _init_models()
INPUT_ET, FROZEN_MODEL_ET, COMPRESSED_MODEL_ET = _init_models_exclude_types()


class TestDeepPotAPBC(unittest.TestCase):
Expand Down
12 changes: 10 additions & 2 deletions source/tests/tf/test_model_compression_se_a_ebd.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,16 @@ def _init_models_exclude_types():
return INPUT, frozen_model, compressed_model


INPUT, FROZEN_MODEL, COMPRESSED_MODEL = _init_models()
INPUT_ET, FROZEN_MODEL_ET, COMPRESSED_MODEL_ET = _init_models_exclude_types()
def setUpModule():
global \
INPUT, \
FROZEN_MODEL, \
COMPRESSED_MODEL, \
INPUT_ET, \
FROZEN_MODEL_ET, \
COMPRESSED_MODEL_ET
INPUT, FROZEN_MODEL, COMPRESSED_MODEL = _init_models()
INPUT_ET, FROZEN_MODEL_ET, COMPRESSED_MODEL_ET = _init_models_exclude_types()


class TestDeepPotAPBC(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def _init_models_exclude_types():
return INPUT, frozen_model, compressed_model


INPUT, FROZEN_MODEL, COMPRESSED_MODEL = _init_models()
def setUpModule():
global INPUT, FROZEN_MODEL, COMPRESSED_MODEL
INPUT, FROZEN_MODEL, COMPRESSED_MODEL = _init_models()


class TestDeepPotAPBC(unittest.TestCase):
Expand Down
12 changes: 10 additions & 2 deletions source/tests/tf/test_model_compression_se_atten.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,16 @@ def _init_models_exclude_types():
return inputs, frozen_models, compressed_models


INPUTS, FROZEN_MODELS, COMPRESSED_MODELS = _init_models()
INPUTS_ET, FROZEN_MODELS_ET, COMPRESSED_MODELS_ET = _init_models_exclude_types()
def setUpModule():
global \
INPUTS, \
FROZEN_MODELS, \
COMPRESSED_MODELS, \
INPUTS_ET, \
FROZEN_MODELS_ET, \
COMPRESSED_MODELS_ET
INPUTS, FROZEN_MODELS, COMPRESSED_MODELS = _init_models()
INPUTS_ET, FROZEN_MODELS_ET, COMPRESSED_MODELS_ET = _init_models_exclude_types()


@unittest.skipIf(
Expand Down
4 changes: 3 additions & 1 deletion source/tests/tf/test_model_compression_se_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def _init_models():
return INPUT, frozen_model, compressed_model


INPUT, FROZEN_MODEL, COMPRESSED_MODEL = _init_models()
def setUpModule():
global INPUT, FROZEN_MODEL, COMPRESSED_MODEL
INPUT, FROZEN_MODEL, COMPRESSED_MODEL = _init_models()


class TestDeepPotAPBC(unittest.TestCase):
Expand Down
4 changes: 3 additions & 1 deletion source/tests/tf/test_model_compression_se_t.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def _init_models():
return INPUT, frozen_model, compressed_model


INPUT, FROZEN_MODEL, COMPRESSED_MODEL = _init_models()
def setUpModule():
global INPUT, FROZEN_MODEL, COMPRESSED_MODEL
INPUT, FROZEN_MODEL, COMPRESSED_MODEL = _init_models()


def tearDownModule():
Expand Down
Loading