[CI] fix some spelling errors (#3707)

* fix spelling error with examples/comminity/

* fix spelling error with tests/

* fix some spelling error with tests/ colossalai/ etc.
This commit is contained in:
digger-yu
2023-05-10 17:12:03 +08:00
committed by GitHub
parent f7361ee1bd
commit b7141c36dd
17 changed files with 51 additions and 51 deletions

View File

@@ -28,7 +28,7 @@ def get_training_components():
print('building AlbertForSequenceClassification model')
# adapting huggingface BertForSequenceClassification for single unitest calling interface
class ModelAaptor(AlbertForSequenceClassification):
class ModelAdaptor(AlbertForSequenceClassification):
def forward(self, input_ids, labels):
"""
@@ -37,23 +37,23 @@ def get_training_components():
"""
return super().forward(input_ids=input_ids, labels=labels)[0]
model = ModelAaptor(config)
model = ModelAdaptor(config)
# if checkpoint and version.parse(transformers.__version__) >= version.parse("4.11.0"):
# model.gradient_checkpointing_enable()
return model
is_distrbuted = torch.distributed.is_initialized()
is_distributed = torch.distributed.is_initialized()
trainloader = get_bert_data_loader(n_class=vocab_size,
batch_size=2,
total_samples=10000,
sequence_length=sequence_length,
is_distrbuted=is_distrbuted)
is_distributed=is_distributed)
testloader = get_bert_data_loader(n_class=vocab_size,
batch_size=2,
total_samples=10000,
sequence_length=sequence_length,
is_distrbuted=is_distrbuted)
is_distributed=is_distributed)
criterion = None
return bert_model_builder, trainloader, testloader, torch.optim.Adam, criterion

View File

@@ -27,7 +27,7 @@ class DummyDataLoader(DummyDataGenerator):
@non_distributed_component_funcs.register(name='beit')
def get_training_components():
def model_buider(checkpoint=False):
def model_builder(checkpoint=False):
model = Beit(img_size=DummyDataLoader.img_size,
num_classes=DummyDataLoader.num_class,
embed_dim=32,
@@ -39,4 +39,4 @@ def get_training_components():
testloader = DummyDataLoader()
criterion = torch.nn.CrossEntropyLoss()
return model_buider, trainloader, testloader, torch.optim.Adam, criterion
return model_builder, trainloader, testloader, torch.optim.Adam, criterion

View File

@@ -13,7 +13,7 @@ def get_bert_data_loader(
total_samples,
sequence_length,
device=torch.device('cpu:0'),
is_distrbuted=False,
is_distributed=False,
):
train_data = torch.randint(
low=0,
@@ -24,7 +24,7 @@ def get_bert_data_loader(
)
train_label = torch.randint(low=0, high=2, size=(total_samples,), device=device, dtype=torch.long)
train_dataset = torch.utils.data.TensorDataset(train_data, train_label)
if is_distrbuted:
if is_distributed:
sampler = torch.utils.data.distributed.DistributedSampler(train_dataset)
else:
sampler = SequentialSampler(train_dataset)
@@ -52,8 +52,8 @@ def get_training_components():
attention_probs_dropout_prob=0.)
print('building BertForSequenceClassification model')
# adapting huggingface BertForSequenceClassification for single unitest calling interface
class ModelAaptor(BertForSequenceClassification):
# adapting huggingface BertForSequenceClassification for single unittest calling interface
class ModelAdaptor(BertForSequenceClassification):
def forward(self, input_ids, labels):
"""
@@ -62,23 +62,23 @@ def get_training_components():
"""
return super().forward(input_ids=input_ids, labels=labels)[0]
model = ModelAaptor(config)
model = ModelAdaptor(config)
if checkpoint and version.parse(transformers.__version__) >= version.parse("4.11.0"):
model.gradient_checkpointing_enable()
return model
is_distrbuted = torch.distributed.is_initialized()
is_distributed = torch.distributed.is_initialized()
trainloader = get_bert_data_loader(n_class=vocab_size,
batch_size=2,
total_samples=10000,
sequence_length=sequence_length,
is_distrbuted=is_distrbuted)
is_distributed=is_distributed)
testloader = get_bert_data_loader(n_class=vocab_size,
batch_size=2,
total_samples=10000,
sequence_length=sequence_length,
is_distrbuted=is_distrbuted)
is_distributed=is_distributed)
criterion = None
return bert_model_builder, trainloader, testloader, torch.optim.Adam, criterion

View File

@@ -9,10 +9,10 @@ class Registry:
def register(self, name):
assert name not in self._registry
def _regsiter(callable_):
def _register(callable_):
self._registry[name] = callable_
return _regsiter
return _register
def get_callable(self, name: str):
return self._registry[name]
@@ -34,6 +34,6 @@ class Registry:
non_distributed_component_funcs = Registry()
model_paralle_component_funcs = Registry()
model_parallel_component_funcs = Registry()
__all__ = ['non_distributed_component_funcs', 'model_paralle_component_funcs']
__all__ = ['non_distributed_component_funcs', 'model_parallel_component_funcs']