mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-03 18:19:58 +00:00
[fx/meta/rpc] move _meta_registration.py to fx folder / register fx functions with compatibility checks / remove color debug (#1710)
* [fx] move meta registration * [fx] fix tests. * [fx] fix test. * [fx] fix. * [meta] refactor meta registration.py. * [fx] add compatibility descriptions. * [fx] polish import. * [fx] add a decorator. * [fx] fix tests. * [fx] remove print. * [fx] edit raise error. * [fx] edit raise error. * [fx] add type hint. * [fx] fix import in experimental. * [rpc] remove color debug. * [meta] fix naming.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import torchvision.models as tm
|
||||
import pytest
|
||||
import timm.models as tmm
|
||||
import torch
|
||||
from colossalai import META_COMPATIBILITY
|
||||
import pytest
|
||||
import torchvision.models as tm
|
||||
from colossalai.fx._compatibility import is_compatible_with_meta
|
||||
|
||||
if META_COMPATIBILITY:
|
||||
if is_compatible_with_meta():
|
||||
from colossalai.fx.profiler import MetaTensor
|
||||
|
||||
tm_models = [
|
||||
@@ -27,7 +27,7 @@ tmm_models = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.skipif(not META_COMPATIBILITY, reason='torch version is lower than 1.12.0')
|
||||
@pytest.mark.skipif(not is_compatible_with_meta(), reason='torch version is lower than 1.12.0')
|
||||
def test_torchvision_models():
|
||||
for m in tm_models:
|
||||
model = m()
|
||||
@@ -35,7 +35,7 @@ def test_torchvision_models():
|
||||
model(MetaTensor(data, fake_device=torch.device('cpu'))).sum().backward()
|
||||
|
||||
|
||||
@pytest.mark.skipif(not META_COMPATIBILITY, reason='torch version is lower than 1.12.0')
|
||||
@pytest.mark.skipif(not is_compatible_with_meta(), reason='torch version is lower than 1.12.0')
|
||||
def test_timm_models():
|
||||
for m in tmm_models:
|
||||
model = m()
|
||||
|
Reference in New Issue
Block a user