Skip to content

Commit 66f29aa

Browse files
authored
chore: enhance messages in docstrings (#36525)
chore: enhance the message in docstrings
1 parent 89d27fa commit 66f29aa

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/transformers/cache_utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ class QuantizedCacheConfig(CacheConfig):
212212
Size of the quantization group, should be a divisor of the model's hidden dimension.
213213
Defaults to 64.
214214
residual_length (`Optional[int]`, *optional*, defaults to 128):
215-
Length of the residual cache which will always be stored in original presicion.
215+
Length of the residual cache which will always be stored in original precision.
216216
Defaults to 128.
217217
compute_dtype (`torch.dtype`, *optional*, defaults to `torch.float16`):
218-
The defualt dtype used for computations in the model. Keys and Values will be cast to this dtype after dequantization.
218+
The default dtype used for computations in the model. Keys and Values will be cast to this dtype after dequantization.
219219
device (`str`, *optional*, defaults to `"cpu"`):
220220
Device on which to perform computations, should be same as the model's device.
221221
"""
@@ -1074,7 +1074,7 @@ class StaticCache(Cache):
10741074
dtype (`torch.dtype`, *optional*, defaults to `torch.float32`):
10751075
The default `dtype` to use when initializing the layer.
10761076
layer_device_map(`Dict[int, Union[str, torch.device, int]]]`, `optional`):
1077-
Mapping between the layers and its device. This is required when you are manually initializing the cache and the model is splitted between differents gpus.
1077+
Mapping between the layers and its device. This is required when you are manually initializing the cache and the model is splitted between different gpus.
10781078
You can know which layers mapped to which device by checking the associated device_map: `model.hf_device_map`.
10791079
10801080
@@ -1267,7 +1267,7 @@ class SlidingWindowCache(StaticCache):
12671267
dtype (`torch.dtype`, *optional*, defaults to `torch.float32`):
12681268
The default `dtype` to use when initializing the layer.
12691269
layer_device_map(`Dict[int, Union[str, torch.device, int]]]`, `optional`):
1270-
Mapping between the layers and its device. This is required when you are manually initializing the cache and the model is splitted between differents gpus.
1270+
Mapping between the layers and its device. This is required when you are manually initializing the cache and the model is splitted between different gpus.
12711271
You can know which layers mapped to which device by checking the associated device_map: `model.hf_device_map`.
12721272
12731273
Example:
@@ -1579,7 +1579,7 @@ class HybridCache(Cache):
15791579
dtype (torch.dtype, *optional*, defaults to `torch.float32`):
15801580
The default `dtype` to use when initializing the layer.
15811581
layer_device_map(`Dict[int, Union[str, torch.device, int]]]`, `optional`):
1582-
Mapping between the layers and its device. This is required when you are manually initializing the cache and the model is splitted between differents gpus.
1582+
Mapping between the layers and its device. This is required when you are manually initializing the cache and the model is splitted between different gpus.
15831583
You can know which layers mapped to which device by checking the associated device_map: `model.hf_device_map`.
15841584
15851585
Example:
@@ -1929,7 +1929,7 @@ class OffloadedStaticCache(StaticCache):
19291929
offload_device (`Union[str, torch.device]`, *optional*, defaults to `cpu`):
19301930
The device to offload to. Defaults to CPU.
19311931
layer_device_map (`Dict[int, Union[str, torch.device, int]]`, *optional*):
1932-
Mapping between the layers and its device. This is required when you are manually initializing the cache and the model is splitted between differents gpus.
1932+
Mapping between the layers and its device. This is required when you are manually initializing the cache and the model is splitted between different gpus.
19331933
You can know which layers mapped to which device by checking the associated device_map: `model.hf_device_map`.
19341934
19351935
Attributes:

src/transformers/tokenization_utils_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ def _set_model_specific_special_tokens(self, special_tokens: List[str]):
11841184
"""
11851185
Adds new special tokens to the "SPECIAL_TOKENS_ATTRIBUTES" list which will be part
11861186
of "self.special_tokens" and saved as a special token in tokenizer's config.
1187-
This allows us to dynamically add new model-type specific tokens after initilizing the tokenizer.
1187+
This allows us to dynamically add new model-type specific tokens after initializing the tokenizer.
11881188
For example: if the model tokenizers is multimodal, we can support special image or audio tokens.
11891189
"""
11901190
self.SPECIAL_TOKENS_ATTRIBUTES = self.SPECIAL_TOKENS_ATTRIBUTES + list(special_tokens.keys())
@@ -1199,7 +1199,7 @@ def _set_model_specific_special_tokens(self, special_tokens: List[str]):
11991199
add_special_tokens (`bool`, *optional*, defaults to `True`):
12001200
Whether or not to add special tokens when encoding the sequences. This will use the underlying
12011201
`PretrainedTokenizerBase.build_inputs_with_special_tokens` function, which defines which tokens are
1202-
automatically added to the input ids. This is usefull if you want to add `bos` or `eos` tokens
1202+
automatically added to the input ids. This is useful if you want to add `bos` or `eos` tokens
12031203
automatically.
12041204
padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `False`):
12051205
Activates and controls padding. Accepts the following values:
@@ -2474,7 +2474,7 @@ def save_pretrained(
24742474
# no typefields, this way old fast and slow can load it
24752475
tokenizer_config = self.convert_added_tokens(tokenizer_config, add_type_field=True, save=True)
24762476

2477-
# Process added tokens seperatly: allows previous versions to ignore it!
2477+
# Process added tokens separately: allows previous versions to ignore it!
24782478
added_tokens = {}
24792479
for key, value in self.added_tokens_decoder.items():
24802480
added_tokens[key] = value.__getstate__()

0 commit comments

Comments
 (0)