mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-04 02:26:51 +00:00
[test] refactor tests with spawn (#3452)
* [test] added spawn decorator * polish code * polish code * polish code * polish code * polish code * polish code
This commit is contained in:
@@ -2,11 +2,14 @@ import pytest
|
||||
import timm.models as tmm
|
||||
import torch
|
||||
import torchvision.models as tm
|
||||
|
||||
from colossalai.fx._compatibility import is_compatible_with_meta
|
||||
|
||||
if is_compatible_with_meta():
|
||||
from colossalai.fx.profiler import MetaTensor
|
||||
|
||||
from colossalai.testing import clear_cache_before_run
|
||||
|
||||
tm_models = [
|
||||
tm.vgg11,
|
||||
tm.resnet18,
|
||||
@@ -28,6 +31,7 @@ tmm_models = [
|
||||
|
||||
|
||||
@pytest.mark.skipif(not is_compatible_with_meta(), reason='torch version is lower than 1.12.0')
|
||||
@clear_cache_before_run()
|
||||
def test_torchvision_models():
|
||||
for m in tm_models:
|
||||
model = m()
|
||||
@@ -36,6 +40,7 @@ def test_torchvision_models():
|
||||
|
||||
|
||||
@pytest.mark.skipif(not is_compatible_with_meta(), reason='torch version is lower than 1.12.0')
|
||||
@clear_cache_before_run()
|
||||
def test_timm_models():
|
||||
for m in tmm_models:
|
||||
model = m()
|
||||
|
Reference in New Issue
Block a user