Skip to content

Commit 8830e58

Browse files
cyyeverS1ro1
andauthored
Fix typos (#3753)
* Fix typos Signed-off-by: cyy <cyyever@outlook.com> * Fix: style --------- Signed-off-by: cyy <cyyever@outlook.com> Co-authored-by: S1ro1 <matej.sirovatka@gmail.com>
1 parent 40ebb4b commit 8830e58

File tree

15 files changed

+47
-47
lines changed

15 files changed

+47
-47
lines changed

src/accelerate/accelerator.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@ def join_uneven_inputs(self, joinables, even_batches=None):
13271327
13281328
<Tip warning={true}>
13291329
1330-
Overidding `even_batches` will not affect iterable-style data loaders.
1330+
Overriding `even_batches` will not affect iterable-style data loaders.
13311331
13321332
</Tip>
13331333
@@ -1363,7 +1363,7 @@ def join_uneven_inputs(self, joinables, even_batches=None):
13631363

13641364
if iterable_dl_seen:
13651365
warnings.warn(
1366-
"Overridding even_batches is only supported for map-style datasets, yet some dataloaders given were iterable"
1366+
"Overriding even_batches is only supported for map-style datasets, yet some dataloaders given were iterable"
13671367
)
13681368
else:
13691369
even_batches = self.even_batches
@@ -1542,7 +1542,7 @@ def prepare(self, *args, device_placement=None):
15421542
and self.state.use_ipex
15431543
):
15441544
logger.warning(
1545-
"You are using lower version of PyTorch(< 2.7.0) with ipex acceleration on Intel CPU or XPU, Intel has upstreamed most of the optimizations into stock PyTorch from 2.7.0, we enourage you to install the latest stock PyTorch and enjoy the out-of-experience on Intel CPU/XPU."
1545+
"You are using lower version of PyTorch(< 2.7.0) with ipex acceleration on Intel CPU or XPU, Intel has upstreamed most of the optimizations into stock PyTorch from 2.7.0, we encourage you to install the latest stock PyTorch and enjoy the out-of-experience on Intel CPU/XPU."
15461546
)
15471547
args = self._prepare_ipex(*args)
15481548
if self.parallelism_config and self.parallelism_config.tp_enabled:
@@ -1672,7 +1672,7 @@ def _prepare_fsdp2(self, *args):
16721672
else:
16731673
model = torch.compile(model, **self.state.dynamo_plugin.to_kwargs())
16741674

1675-
# Get old params and canonicalize - we cannonicalize to have the mapping easy
1675+
# Get old params and canonicalize - we canonicalize to have the mapping easy
16761676
old_named_params = fsdp2_canonicalize_names(self._get_named_parameters(*tuple(result), drop_refs=True))
16771677

16781678
# Swap the optimizer parameters with empty, so `fully_shard` after will not allocate too much memory
@@ -2888,7 +2888,7 @@ def clip_grad_norm_(self, parameters, max_norm, norm_type=2):
28882888
while isinstance(opt, AcceleratedOptimizer):
28892889
opt = opt.optimizer
28902890
gradients = xm._fetch_gradients(opt)
2891-
# Use xm.all_reduce to perform an in-place all-reduce. Recusrsive all-reduce each tensor
2891+
# Use xm.all_reduce to perform an in-place all-reduce. Recursive all-reduce each tensor
28922892
# one by one in self.reduce is non-inplace.
28932893
xm.all_reduce("sum", gradients, scale=1.0 / self.num_processes)
28942894
# Set is_xla_gradients_synced to True to avoid all-reduce twice in the AcceleratedOptimizer step.
@@ -3047,7 +3047,7 @@ def reduce(self, tensor, reduction="sum", scale=1.0):
30473047
reduction (`str`, *optional*, defaults to "sum"):
30483048
A reduction type, can be one of 'sum', 'mean', or 'none'. If 'none', will not perform any operation.
30493049
scale (`float`, *optional*, defaults to 1.0):
3050-
A default scaling value to be applied after the reduce, only valied on XLA.
3050+
A default scaling value to be applied after the reduce, only valid on XLA.
30513051
30523052
Returns:
30533053
`torch.Tensor`, or a nested tuple/list/dictionary of `torch.Tensor`:
@@ -3339,7 +3339,7 @@ def save_model(
33393339
33403340
Arguments:
33413341
model: (`torch.nn.Module`):
3342-
Model to be saved. The model can be wrapped or unwraped.
3342+
Model to be saved. The model can be wrapped or unwrapped.
33433343
save_directory (`str` or `os.PathLike`):
33443344
Directory to which to save. Will be created if it doesn't exist.
33453345
max_shard_size (`int` or `str`, *optional*, defaults to `"10GB"`):
@@ -3450,7 +3450,7 @@ def register_save_state_pre_hook(self, hook: Callable[..., None]) -> hooks.Remov
34503450
34513451
`hook(models: list[torch.nn.Module], weights: list[dict[str, torch.Tensor]], input_dir: str) -> None`
34523452
3453-
The `models` argument are the models as saved in the accelerator state under `accelerator._models`, `weigths`
3453+
The `models` argument are the models as saved in the accelerator state under `accelerator._models`, `weights`
34543454
argument are the state dicts of the `models`, and the `input_dir` argument is the `input_dir` argument passed
34553455
to [`Accelerator.load_state`].
34563456

src/accelerate/commands/config/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ def update_command_parser(parser, parents):
6060

6161
def update_config_command(args):
6262
config_file = update_config(args)
63-
print(f"Sucessfully updated the configuration file at {config_file}.")
63+
print(f"Successfully updated the configuration file at {config_file}.")

src/accelerate/commands/launch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,13 @@ def launch_command_parser(subparsers=None):
493493
"--deepspeed_exclusion_filter",
494494
default=None,
495495
type=str,
496-
help="DeepSpeed exclusion filter string when using mutli-node setup.",
496+
help="DeepSpeed exclusion filter string when using multi-node setup.",
497497
)
498498
deepspeed_args.add_argument(
499499
"--deepspeed_inclusion_filter",
500500
default=None,
501501
type=str,
502-
help="DeepSpeed inclusion filter string when using mutli-node setup.",
502+
help="DeepSpeed inclusion filter string when using multi-node setup.",
503503
)
504504
deepspeed_args.add_argument(
505505
"--deepspeed_multinode_launcher",
@@ -585,7 +585,7 @@ def launch_command_parser(subparsers=None):
585585
"--fsdp_use_orig_params",
586586
default="true",
587587
type=str,
588-
help="If True, allows non-uniform `requires_grad` during init, which means support for interspersed frozen and trainable paramteres."
588+
help="If True, allows non-uniform `requires_grad` during init, which means support for interspersed frozen and trainable parameters."
589589
" (useful only when `use_fsdp` flag is passed).",
590590
)
591591
fsdp_args.add_argument(

src/accelerate/commands/to_fsdp2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def convert_config_to_fsdp2(config: dict) -> dict:
8989
new_fsdp_config = {}
9090

9191
if fsdp_config.get("fsdp_version", 1) == 2:
92-
logger.warning("Config already specfies FSDP2, skipping conversion...")
92+
logger.warning("Config already specifies FSDP2, skipping conversion...")
9393
logger.warning(
9494
"If the config doesn't use new argument names, change `fsdp_version` to `1` and rerun the command."
9595
)

src/accelerate/data_loader.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class SeedableRandomSampler(RandomSampler):
7575
Same as a random sampler, except that in `__iter__` a seed can be used.
7676
7777
Needed specifically in distributed cases, when the random generator for each GPU needs to start from the same seed
78-
and be fully reproducable on multiple iterations.
78+
and be fully reproducible on multiple iterations.
7979
8080
If a custom `generator` is passed, it will rely on its initial seed as well as the current iteration it is on
8181
(stored in `self.epoch`).
@@ -408,7 +408,7 @@ def end(self):
408408
class DataLoaderAdapter:
409409
"""
410410
A class which wraps around a PyTorch `DataLoader` (or variants of it) to be used with the `Accelerator`. For
411-
compatability reasons, this class inherits from the class it wraps around, so it can be used as a drop-in.
411+
compatibility reasons, this class inherits from the class it wraps around, so it can be used as a drop-in.
412412
"""
413413

414414
def __init__(self, dataset, use_stateful_dataloader=False, batch_sampler=None, **kwargs):
@@ -451,8 +451,8 @@ def load_state_dict(self, state_dict):
451451
@property
452452
def __class__(self):
453453
"""
454-
In order to maintain backwards compatability with other code, we need to ensure `isinstance(obj, DataLoader)`
455-
returs true. This is because some downstream code assumes that the `DataLoader` is the base class of the
454+
In order to maintain backwards compatibility with other code, we need to ensure `isinstance(obj, DataLoader)`
455+
returns true. This is because some downstream code assumes that the `DataLoader` is the base class of the
456456
object.
457457
"""
458458
return self.base_dataloader.__class__
@@ -763,12 +763,12 @@ def __init__(
763763

764764
# if a device mesh is provided extract each dimension (dp, fsdp, tp)
765765
# device mesh may hold any number of dimensions, however,
766-
# below code is for targetted support for dp, fsdp and tp
766+
# below code is for targeted support for dp, fsdp and tp
767767

768768
# device mesh will be used only if there is tp involved
769769
# or any multi-dimensional parallelism involving tp
770770
# (dp, tp) (fsdp, tp) (dp, fsdp, tp)
771-
# otherwise the default behavour not using device mesh should be sufficient
771+
# otherwise the default behaviour not using device mesh should be sufficient
772772
# since multi dimensional parallelism devoid of tp would anyway need
773773
# different batches for each process irrespective of dp or fsdp
774774
self.submesh_tp = None
@@ -1063,7 +1063,7 @@ def prepare_data_loader(
10631063
ignored otherwise.
10641064
use_seedable_sampler (`bool`, *optional*, defaults to `False`):
10651065
Whether to use the [`~data_loader.SeedableRandomSampler`] instead of a `RandomSampler` for better
1066-
reproducability. Comes at a cost of potentially different performances due to different shuffling
1066+
reproducibility. Comes at a cost of potentially different performances due to different shuffling
10671067
algorithms but ensures results will be the *exact* same. Should be paired with `set_seed()` at every
10681068
`self.set_epoch`
10691069
data_seed (`int`, *optional*, defaults to `None`):

src/accelerate/state.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def __init__(self, cpu: bool = False, **kwargs):
195195
original_backend = kwargs.pop("backend", None)
196196
backend, distributed_type = self._prepare_backend(cpu, use_sagemaker_dp, original_backend)
197197
if original_backend is not None and backend != original_backend:
198-
raise ValueError(f"Your assigned backend {original_backend} is not avaliable, please use {backend}")
198+
raise ValueError(f"Your assigned backend {original_backend} is not available, please use {backend}")
199199
self.backend = backend
200200
self.distributed_type = distributed_type
201201
use_deepspeed = False
@@ -1084,7 +1084,7 @@ def destroy_process_group(self, group=None):
10841084
"""
10851085
Destroys the process group. If one is not specified, the default process group is destroyed.
10861086
1087-
If `self.fork_lauched` is `True` and `group` is `None`, nothing happens.
1087+
If `self.fork_launched` is `True` and `group` is `None`, nothing happens.
10881088
"""
10891089
PartialState().destroy_process_group(group)
10901090

src/accelerate/test_utils/scripts/test_ops.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_gather_object(state):
5050
assert gathered_obj == list(range(state.num_processes)), f"{gathered_obj} != {list(range(state.num_processes))}"
5151

5252

53-
def test_gather_non_contigous(state):
53+
def test_gather_non_contiguous(state):
5454
# Skip this test because the 'is_contiguous' function of XLA tensor always returns True.
5555
if state.distributed_type == DistributedType.XLA:
5656
return
@@ -160,8 +160,8 @@ def main():
160160
test_gather(state)
161161
state.print("testing gather_object")
162162
test_gather_object(state)
163-
state.print("testing gather non-contigous")
164-
test_gather_non_contigous(state)
163+
state.print("testing gather non-contiguous")
164+
test_gather_non_contiguous(state)
165165
state.print("testing broadcast")
166166
test_broadcast(state)
167167
state.print("testing pad_across_processes")

src/accelerate/test_utils/testing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def require_torchdata_stateful_dataloader(test_case):
598598
def run_first(test_case):
599599
"""
600600
Decorator marking a test with order(1). When pytest-order plugin is installed, tests marked with this decorator are
601-
garanteed to run first.
601+
guaranteed to run first.
602602
603603
This is especially useful in some test settings like on a Gaudi instance where a Gaudi device can only be used by a
604604
single process at a time. So we make sure all tests that run in a subprocess are launched first, to avoid device
@@ -617,7 +617,7 @@ def run_first(test_case):
617617
class TempDirTestCase(unittest.TestCase):
618618
"""
619619
A TestCase class that keeps a single `tempfile.TemporaryDirectory` open for the duration of the class, wipes its
620-
data at the start of a test, and then destroyes it at the end of the TestCase.
620+
data at the start of a test, and then destroys it at the end of the TestCase.
621621
622622
Useful for when a class or API requires a single constant folder throughout it's use, such as Weights and Biases
623623

src/accelerate/tracking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class GeneralTracker:
111111
(`bool`): Whether the logger requires a directory to store their logs. `tracker` (`object`): Should return internal
112112
tracking mechanism used by a tracker class (such as the `run` for wandb)
113113
114-
Implementations can also include a `main_process_only` (`bool`) attribute to toggle if relevent logging, init, and
114+
Implementations can also include a `main_process_only` (`bool`) attribute to toggle if relevant logging, init, and
115115
other functions should occur on the main process or across all processes (by default will use `True`)
116116
"""
117117

src/accelerate/utils/bnb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def _replace_with_bnb_layers(
314314
"""
315315
Private method that wraps the recursion for module replacement.
316316
317-
Returns the converted model and a boolean that indicates if the conversion has been successfull or not.
317+
Returns the converted model and a boolean that indicates if the conversion has been successful or not.
318318
"""
319319
# bitsandbytes will initialize CUDA on import, so it needs to be imported lazily
320320
import bitsandbytes as bnb

0 commit comments

Comments
 (0)