mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-09 04:50:17 +00:00
[misc] update pre-commit and run all files (#4752)
* [misc] update pre-commit * [misc] run pre-commit * [misc] remove useless configuration files * [misc] ignore cuda for clang-format
This commit is contained in:
@@ -5,7 +5,7 @@ from colossalai.testing import clear_cache_before_run, parameterize
|
||||
|
||||
|
||||
@clear_cache_before_run()
|
||||
@parameterize('device', ['cpu', 'cuda'])
|
||||
@parameterize("device", ["cpu", "cuda"])
|
||||
def test_accelerator(device):
|
||||
accelerator = Accelerator(device)
|
||||
model = nn.Linear(8, 8)
|
||||
|
@@ -9,11 +9,11 @@ from tests.kit.model_zoo import model_zoo
|
||||
|
||||
def run_torch_amp(rank, world_size, port):
|
||||
# init dist env
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host='localhost')
|
||||
sub_model_zoo = model_zoo.get_sub_registry('timm')
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host="localhost")
|
||||
sub_model_zoo = model_zoo.get_sub_registry("timm")
|
||||
for name, (model_fn, data_gen_fn, output_transform_fn, _, _) in sub_model_zoo.items():
|
||||
# dlrm_interactionarch has not parameters, so skip
|
||||
if name == 'dlrm_interactionarch':
|
||||
if name == "dlrm_interactionarch":
|
||||
continue
|
||||
|
||||
model = model_fn().cuda()
|
||||
@@ -21,7 +21,7 @@ def run_torch_amp(rank, world_size, port):
|
||||
criterion = lambda x: x.mean()
|
||||
data = data_gen_fn()
|
||||
data = {
|
||||
k: v.to('cuda') if torch.is_tensor(v) or 'Tensor' in v.__class__.__name__ else v for k, v in data.items()
|
||||
k: v.to("cuda") if torch.is_tensor(v) or "Tensor" in v.__class__.__name__ else v for k, v in data.items()
|
||||
}
|
||||
mixed_precision = FP16TorchMixedPrecision()
|
||||
model, optimizer, criterion = mixed_precision.configure(model, optimizer, criterion)
|
||||
|
@@ -16,11 +16,11 @@ from tests.kit.model_zoo import model_zoo
|
||||
|
||||
def run_fn(init_method, model_fn, data_gen_fn, output_transform_fn) -> Optional[str]:
|
||||
try:
|
||||
if init_method == 'lazy':
|
||||
if init_method == "lazy":
|
||||
ctx = LazyInitContext()
|
||||
else:
|
||||
ctx = nullcontext()
|
||||
plugin = HybridParallelPlugin(tp_size=2, pp_size=2, num_microbatches=4, precision='bf16')
|
||||
plugin = HybridParallelPlugin(tp_size=2, pp_size=2, num_microbatches=4, precision="bf16")
|
||||
booster = Booster(plugin=plugin)
|
||||
with ctx:
|
||||
model = model_fn()
|
||||
@@ -29,7 +29,7 @@ def run_fn(init_method, model_fn, data_gen_fn, output_transform_fn) -> Optional[
|
||||
data = data_gen_fn()
|
||||
|
||||
data = {
|
||||
k: v.to('cuda').repeat(4, 1) if torch.is_tensor(v) or 'Tensor' in v.__class__.__name__ else v
|
||||
k: v.to("cuda").repeat(4, 1) if torch.is_tensor(v) or "Tensor" in v.__class__.__name__ else v
|
||||
for k, v in data.items()
|
||||
}
|
||||
|
||||
@@ -50,23 +50,24 @@ def run_fn(init_method, model_fn, data_gen_fn, output_transform_fn) -> Optional[
|
||||
return repr(e)
|
||||
|
||||
|
||||
@parameterize('init_method', ['none', 'lazy'])
|
||||
def check_3d_plugin(init_method: str = 'none', early_stop: bool = True):
|
||||
@parameterize("init_method", ["none", "lazy"])
|
||||
def check_3d_plugin(init_method: str = "none", early_stop: bool = True):
|
||||
"""check gemini plugin over model zoo
|
||||
|
||||
Args:
|
||||
early_stop (bool, optional): Whether to stop when getting the first error. Defaults to True.
|
||||
"""
|
||||
is_support_meta = is_compatible_with_meta()
|
||||
if not is_support_meta and init_method == 'lazy':
|
||||
if not is_support_meta and init_method == "lazy":
|
||||
return
|
||||
|
||||
passed_models = []
|
||||
failed_info = {} # (model_name, error) pair
|
||||
failed_info = {} # (model_name, error) pair
|
||||
|
||||
# TODO(ver217): add more models
|
||||
for name, (model_fn, data_gen_fn, output_transform_fn, _,
|
||||
_) in model_zoo.get_sub_registry('transformers_llama_for_casual_lm').items():
|
||||
for name, (model_fn, data_gen_fn, output_transform_fn, _, _) in model_zoo.get_sub_registry(
|
||||
"transformers_llama_for_casual_lm"
|
||||
).items():
|
||||
err = run_fn(init_method, model_fn, data_gen_fn, output_transform_fn)
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
@@ -78,15 +79,15 @@ def check_3d_plugin(init_method: str = 'none', early_stop: bool = True):
|
||||
break
|
||||
|
||||
if dist.get_rank() == 0:
|
||||
print(f'Init method: {init_method}')
|
||||
print(f'Passed models({len(passed_models)}): {passed_models}\n\n')
|
||||
print(f'Failed models({len(failed_info)}): {list(failed_info.keys())}\n\n')
|
||||
assert len(failed_info) == 0, '\n'.join([f'{k}: {v}' for k, v in failed_info.items()])
|
||||
print(f"Init method: {init_method}")
|
||||
print(f"Passed models({len(passed_models)}): {passed_models}\n\n")
|
||||
print(f"Failed models({len(failed_info)}): {list(failed_info.keys())}\n\n")
|
||||
assert len(failed_info) == 0, "\n".join([f"{k}: {v}" for k, v in failed_info.items()])
|
||||
|
||||
|
||||
def run_dist(rank, world_size, port, early_stop: bool = True):
|
||||
# init dist env
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host='localhost')
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host="localhost")
|
||||
check_3d_plugin(early_stop=early_stop)
|
||||
|
||||
|
||||
@@ -95,5 +96,5 @@ def test_gemini_plugin(early_stop: bool = True):
|
||||
spawn(run_dist, 4, early_stop=early_stop)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
test_gemini_plugin(early_stop=False)
|
||||
|
@@ -15,8 +15,7 @@ from colossalai.testing import rerun_if_address_is_in_use, spawn
|
||||
|
||||
|
||||
class DPPluginWrapper(DPPluginBase):
|
||||
"""This is a wrapper class for testing DP plugin initialization and dataloader creation.
|
||||
"""
|
||||
"""This is a wrapper class for testing DP plugin initialization and dataloader creation."""
|
||||
|
||||
def configure(
|
||||
self,
|
||||
@@ -73,13 +72,14 @@ def check_dataloader_sharding():
|
||||
|
||||
# compare on rank 0
|
||||
if is_rank_0:
|
||||
assert not torch.equal(batch,
|
||||
batch_to_compare), 'Same number was found across ranks but expected it to be different'
|
||||
assert not torch.equal(
|
||||
batch, batch_to_compare
|
||||
), "Same number was found across ranks but expected it to be different"
|
||||
|
||||
|
||||
def run_dist(rank, world_size, port):
|
||||
# init dist env
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host='localhost')
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host="localhost")
|
||||
check_dataloader_sharding()
|
||||
|
||||
|
||||
|
@@ -17,7 +17,7 @@ from tests.kit.model_zoo import model_zoo
|
||||
|
||||
def run_fn(init_method, model_fn, data_gen_fn, output_transform_fn) -> Optional[str]:
|
||||
try:
|
||||
if init_method == 'lazy':
|
||||
if init_method == "lazy":
|
||||
ctx = LazyInitContext()
|
||||
else:
|
||||
ctx = nullcontext()
|
||||
@@ -30,13 +30,13 @@ def run_fn(init_method, model_fn, data_gen_fn, output_transform_fn) -> Optional[
|
||||
data = data_gen_fn()
|
||||
|
||||
data = {
|
||||
k: v.to('cuda') if torch.is_tensor(v) or 'Tensor' in v.__class__.__name__ else v for k, v in data.items()
|
||||
k: v.to("cuda") if torch.is_tensor(v) or "Tensor" in v.__class__.__name__ else v for k, v in data.items()
|
||||
}
|
||||
|
||||
model, optimizer, criterion, _, _ = booster.boost(model, optimizer, criterion)
|
||||
|
||||
for n, p in model.named_parameters():
|
||||
assert isinstance(p, ColoParameter), f'{n} is not a ColoParameter'
|
||||
assert isinstance(p, ColoParameter), f"{n} is not a ColoParameter"
|
||||
|
||||
output = model(**data)
|
||||
output = output_transform_fn(output)
|
||||
@@ -55,47 +55,65 @@ def run_fn(init_method, model_fn, data_gen_fn, output_transform_fn) -> Optional[
|
||||
# @parameterize('init_method', ['lazy', 'none', 'colo'])
|
||||
|
||||
|
||||
@parameterize('subset', ['torchvision', 'transformers', 'diffusers'])
|
||||
@parameterize('init_method', ['none'])
|
||||
def check_gemini_plugin(subset: str, init_method: str = 'none', early_stop: bool = True):
|
||||
@parameterize("subset", ["torchvision", "transformers", "diffusers"])
|
||||
@parameterize("init_method", ["none"])
|
||||
def check_gemini_plugin(subset: str, init_method: str = "none", early_stop: bool = True):
|
||||
"""check gemini plugin over model zoo
|
||||
|
||||
Args:
|
||||
early_stop (bool, optional): Whether to stop when getting the first error. Defaults to True.
|
||||
"""
|
||||
is_support_meta = is_compatible_with_meta()
|
||||
if not is_support_meta and init_method == 'lazy':
|
||||
if not is_support_meta and init_method == "lazy":
|
||||
return
|
||||
|
||||
passed_models = []
|
||||
failed_info = {} # (model_name, error) pair
|
||||
failed_info = {} # (model_name, error) pair
|
||||
|
||||
for name, (model_fn, data_gen_fn, output_transform_fn, _, _) in model_zoo.get_sub_registry(subset).items():
|
||||
# These models lead to CUDA error
|
||||
if name in ('diffusers_auto_encoder_kl', 'diffusers_vq_model', 'diffusers_unet2d_model', 'timm_resmlp',
|
||||
'timm_gmixer_12_224', 'timm_gmlp_b16_224', 'timm_mixer_b16_224', 'timm_convnext',
|
||||
'torchvision_convnext_base'):
|
||||
if name in (
|
||||
"diffusers_auto_encoder_kl",
|
||||
"diffusers_vq_model",
|
||||
"diffusers_unet2d_model",
|
||||
"timm_resmlp",
|
||||
"timm_gmixer_12_224",
|
||||
"timm_gmlp_b16_224",
|
||||
"timm_mixer_b16_224",
|
||||
"timm_convnext",
|
||||
"torchvision_convnext_base",
|
||||
):
|
||||
continue
|
||||
# These models are not compatible with gemini
|
||||
if name in [
|
||||
'timm_convit',
|
||||
'timm_dm_nfnet',
|
||||
'torchvision_vit_b_16',
|
||||
'transformers_t5',
|
||||
'transformers_t5_for_conditional_generation',
|
||||
'transformers_t5_encoder_model', # does not support apex rmsnorm
|
||||
'transformers_chatglm',
|
||||
'transformers_sam',
|
||||
'transformers_vit',
|
||||
'transformers_gpt_double_heads', # TODO check why does the model fail to run using Gemini
|
||||
"timm_convit",
|
||||
"timm_dm_nfnet",
|
||||
"torchvision_vit_b_16",
|
||||
"transformers_t5",
|
||||
"transformers_t5_for_conditional_generation",
|
||||
"transformers_t5_encoder_model", # does not support apex rmsnorm
|
||||
"transformers_chatglm",
|
||||
"transformers_sam",
|
||||
"transformers_vit",
|
||||
"transformers_gpt_double_heads", # TODO check why does the model fail to run using Gemini
|
||||
]:
|
||||
continue
|
||||
|
||||
if init_method == 'lazy' and name in [
|
||||
'timm_convmixer', 'timm_vision_transformer', 'timm_deit', 'timm_deit3', 'timm_inception_v3',
|
||||
'timm_tnt_b_patch16_224', 'timm_rexnet', 'torchvision_densenet121', 'torchvision_efficientnet_b0',
|
||||
'torchvision_mobilenet_v2', 'torchvision_mnasnet0_5', 'torchvision_regnet_x_16gf',
|
||||
'torchvision_shufflenet_v2_x0_5', 'torchvision_efficientnet_v2_s'
|
||||
if init_method == "lazy" and name in [
|
||||
"timm_convmixer",
|
||||
"timm_vision_transformer",
|
||||
"timm_deit",
|
||||
"timm_deit3",
|
||||
"timm_inception_v3",
|
||||
"timm_tnt_b_patch16_224",
|
||||
"timm_rexnet",
|
||||
"torchvision_densenet121",
|
||||
"torchvision_efficientnet_b0",
|
||||
"torchvision_mobilenet_v2",
|
||||
"torchvision_mnasnet0_5",
|
||||
"torchvision_regnet_x_16gf",
|
||||
"torchvision_shufflenet_v2_x0_5",
|
||||
"torchvision_efficientnet_v2_s",
|
||||
]:
|
||||
continue
|
||||
err = run_fn(init_method, model_fn, data_gen_fn, output_transform_fn)
|
||||
@@ -108,15 +126,15 @@ def check_gemini_plugin(subset: str, init_method: str = 'none', early_stop: bool
|
||||
break
|
||||
|
||||
if dist.get_rank() == 0:
|
||||
print(f'Init method: {init_method}')
|
||||
print(f'Passed models({len(passed_models)}): {passed_models}\n\n')
|
||||
print(f'Failed models({len(failed_info)}): {list(failed_info.keys())}\n\n')
|
||||
assert len(failed_info) == 0, '\n'.join([f'{k}: {v}' for k, v in failed_info.items()])
|
||||
print(f"Init method: {init_method}")
|
||||
print(f"Passed models({len(passed_models)}): {passed_models}\n\n")
|
||||
print(f"Failed models({len(failed_info)}): {list(failed_info.keys())}\n\n")
|
||||
assert len(failed_info) == 0, "\n".join([f"{k}: {v}" for k, v in failed_info.items()])
|
||||
|
||||
|
||||
def run_dist(rank, world_size, port, early_stop: bool = True):
|
||||
# init dist env
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host='localhost')
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host="localhost")
|
||||
check_gemini_plugin(early_stop=early_stop)
|
||||
|
||||
|
||||
@@ -125,5 +143,5 @@ def test_gemini_plugin(early_stop: bool = True):
|
||||
spawn(run_dist, 4, early_stop=early_stop)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
test_gemini_plugin(early_stop=False)
|
||||
|
@@ -11,9 +11,9 @@ from colossalai.testing import parameterize, rerun_if_address_is_in_use, spawn
|
||||
from tests.kit.model_zoo import model_zoo
|
||||
|
||||
# These models are not compatible with AMP
|
||||
_AMP_ERR_MODELS = ['timm_convit', 'deepfm_interactionarch']
|
||||
_AMP_ERR_MODELS = ["timm_convit", "deepfm_interactionarch"]
|
||||
# These models have no parameters
|
||||
_LOW_LEVEL_ZERO_ERR_MODELS = ['dlrm_interactionarch']
|
||||
_LOW_LEVEL_ZERO_ERR_MODELS = ["dlrm_interactionarch"]
|
||||
|
||||
|
||||
def run_fn(stage, model_fn, data_gen_fn, output_transform_fn) -> Optional[str]:
|
||||
@@ -26,7 +26,7 @@ def run_fn(stage, model_fn, data_gen_fn, output_transform_fn) -> Optional[str]:
|
||||
data = data_gen_fn()
|
||||
|
||||
data = {
|
||||
k: v.to('cuda') if torch.is_tensor(v) or 'Tensor' in v.__class__.__name__ else v for k, v in data.items()
|
||||
k: v.to("cuda") if torch.is_tensor(v) or "Tensor" in v.__class__.__name__ else v for k, v in data.items()
|
||||
}
|
||||
|
||||
model, optimizer, criterion, _, _ = booster.boost(model, optimizer, criterion)
|
||||
@@ -43,7 +43,7 @@ def run_fn(stage, model_fn, data_gen_fn, output_transform_fn) -> Optional[str]:
|
||||
return repr(e)
|
||||
|
||||
|
||||
@parameterize('stage', [2])
|
||||
@parameterize("stage", [2])
|
||||
def check_low_level_zero_plugin(stage: int, early_stop: bool = True):
|
||||
"""check low level zero plugin over model zoo
|
||||
|
||||
@@ -52,7 +52,7 @@ def check_low_level_zero_plugin(stage: int, early_stop: bool = True):
|
||||
early_stop (bool, optional): Whether to stop when getting the first error. Defaults to True.
|
||||
"""
|
||||
passed_models = []
|
||||
failed_info = {} # (model_name, error) pair
|
||||
failed_info = {} # (model_name, error) pair
|
||||
ignore_models = _AMP_ERR_MODELS + _LOW_LEVEL_ZERO_ERR_MODELS
|
||||
skipped_models = []
|
||||
|
||||
@@ -73,15 +73,15 @@ def check_low_level_zero_plugin(stage: int, early_stop: bool = True):
|
||||
break
|
||||
|
||||
if dist.get_rank() == 0:
|
||||
print(f'Passed models({len(passed_models)}): {passed_models}\n\n')
|
||||
print(f'Failed models({len(failed_info)}): {list(failed_info.keys())}\n\n')
|
||||
print(f'Skipped models({len(skipped_models)}): {skipped_models}\n\n')
|
||||
assert len(failed_info) == 0, '\n'.join([f'{k}: {v}' for k, v in failed_info.items()])
|
||||
print(f"Passed models({len(passed_models)}): {passed_models}\n\n")
|
||||
print(f"Failed models({len(failed_info)}): {list(failed_info.keys())}\n\n")
|
||||
print(f"Skipped models({len(skipped_models)}): {skipped_models}\n\n")
|
||||
assert len(failed_info) == 0, "\n".join([f"{k}: {v}" for k, v in failed_info.items()])
|
||||
|
||||
|
||||
def run_dist(rank, world_size, port, early_stop: bool = True):
|
||||
# init dist env
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host='localhost')
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host="localhost")
|
||||
check_low_level_zero_plugin(early_stop=early_stop)
|
||||
|
||||
|
||||
@@ -90,5 +90,5 @@ def test_low_level_zero_plugin(early_stop: bool = True):
|
||||
spawn(run_dist, 4, early_stop=early_stop)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
test_low_level_zero_plugin(early_stop=False)
|
||||
|
@@ -22,7 +22,7 @@ def run_fn(model_fn, data_gen_fn, output_transform_fn):
|
||||
criterion = lambda x: x.mean()
|
||||
data = data_gen_fn()
|
||||
|
||||
data = {k: v.to('cuda') if torch.is_tensor(v) or 'Tensor' in v.__class__.__name__ else v for k, v in data.items()}
|
||||
data = {k: v.to("cuda") if torch.is_tensor(v) or "Tensor" in v.__class__.__name__ else v for k, v in data.items()}
|
||||
|
||||
model, optimizer, criterion, _, _ = booster.boost(model, optimizer, criterion)
|
||||
|
||||
@@ -41,14 +41,13 @@ def run_fn(model_fn, data_gen_fn, output_transform_fn):
|
||||
|
||||
def check_torch_ddp_plugin():
|
||||
for name, (model_fn, data_gen_fn, output_transform_fn, _, _) in model_zoo.items():
|
||||
if name == 'dlrm_interactionarch':
|
||||
if name == "dlrm_interactionarch":
|
||||
continue
|
||||
run_fn(model_fn, data_gen_fn, output_transform_fn)
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
|
||||
class DummyModel(nn.Module):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.weight = nn.Parameter(torch.rand(1))
|
||||
@@ -67,10 +66,9 @@ def check_torch_ddp_no_sync():
|
||||
# create a custom dataset with 0 to 10
|
||||
dataset = torch.arange(0, 10)
|
||||
train_dataloader = plugin.prepare_dataloader(dataset, batch_size=2)
|
||||
model, optimizer, criterion, train_dataloader, _ = booster.boost(model,
|
||||
optimizer,
|
||||
criterion,
|
||||
dataloader=train_dataloader)
|
||||
model, optimizer, criterion, train_dataloader, _ = booster.boost(
|
||||
model, optimizer, criterion, dataloader=train_dataloader
|
||||
)
|
||||
|
||||
def fwd_bwd():
|
||||
output = model(batch.cuda())
|
||||
@@ -105,7 +103,7 @@ def check_torch_ddp_no_sync():
|
||||
|
||||
def run_dist(rank, world_size, port):
|
||||
# init dist env
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host='localhost')
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host="localhost")
|
||||
check_torch_ddp_plugin()
|
||||
check_torch_ddp_no_sync()
|
||||
|
||||
|
@@ -6,7 +6,7 @@ from torch.optim import SGD
|
||||
import colossalai
|
||||
from colossalai.booster import Booster
|
||||
|
||||
if version.parse(torch.__version__) >= version.parse('1.12.0'):
|
||||
if version.parse(torch.__version__) >= version.parse("1.12.0"):
|
||||
from torch.distributed.fsdp import FullyShardedDataParallel as FSDP
|
||||
from colossalai.booster.plugin import TorchFSDPPlugin
|
||||
|
||||
@@ -24,7 +24,7 @@ def run_fn(model_fn, data_gen_fn, output_transform_fn):
|
||||
criterion = lambda x: x.mean()
|
||||
data = data_gen_fn()
|
||||
|
||||
data = {k: v.to('cuda') if torch.is_tensor(v) or 'Tensor' in v.__class__.__name__ else v for k, v in data.items()}
|
||||
data = {k: v.to("cuda") if torch.is_tensor(v) or "Tensor" in v.__class__.__name__ else v for k, v in data.items()}
|
||||
|
||||
model, optimizer, criterion, _, _ = booster.boost(model, optimizer, criterion)
|
||||
|
||||
@@ -43,10 +43,16 @@ def run_fn(model_fn, data_gen_fn, output_transform_fn):
|
||||
|
||||
def check_torch_fsdp_plugin():
|
||||
for name, (model_fn, data_gen_fn, output_transform_fn, _, _) in model_zoo.items():
|
||||
if any(element in name for element in [
|
||||
'diffusers', 'deepfm_sparsearch', 'dlrm_interactionarch', 'torchvision_googlenet',
|
||||
'torchvision_inception_v3'
|
||||
]):
|
||||
if any(
|
||||
element in name
|
||||
for element in [
|
||||
"diffusers",
|
||||
"deepfm_sparsearch",
|
||||
"dlrm_interactionarch",
|
||||
"torchvision_googlenet",
|
||||
"torchvision_inception_v3",
|
||||
]
|
||||
):
|
||||
continue
|
||||
run_fn(model_fn, data_gen_fn, output_transform_fn)
|
||||
torch.cuda.empty_cache()
|
||||
@@ -54,11 +60,11 @@ def check_torch_fsdp_plugin():
|
||||
|
||||
def run_dist(rank, world_size, port):
|
||||
# init dist env
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host='localhost')
|
||||
colossalai.launch(config=dict(), rank=rank, world_size=world_size, port=port, host="localhost")
|
||||
check_torch_fsdp_plugin()
|
||||
|
||||
|
||||
@pytest.mark.skipif(version.parse(torch.__version__) < version.parse('1.12.0'), reason="requires torch1.12 or higher")
|
||||
@pytest.mark.skipif(version.parse(torch.__version__) < version.parse("1.12.0"), reason="requires torch1.12 or higher")
|
||||
@rerun_if_address_is_in_use()
|
||||
def test_torch_fsdp_plugin():
|
||||
spawn(run_dist, 2)
|
||||
|
Reference in New Issue
Block a user