Skip to content

Commit 39b0c94

Browse files
authored
Remove unused function patameters (#41358)
Remove unused arguments Signed-off-by: Yuanyuan Chen <cyyever@outlook.com>
1 parent 11e4b5e commit 39b0c94

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/transformers/convert_slow_tokenizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ def converted(self) -> Tokenizer:
14131413
class MoshiConverter(SpmConverter):
14141414
handle_byte_fallback = True
14151415

1416-
def __init__(self, vocab_file, model_max_length=None, **kwargs):
1416+
def __init__(self, vocab_file, **kwargs):
14171417
requires_backends(self, "protobuf")
14181418

14191419
Converter.__init__(self, vocab_file)

src/transformers/generation/continuous_batching/cache.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
from collections import deque
1616
from math import floor, gcd, sqrt
17-
from typing import Optional, Union
17+
from typing import Optional
1818

1919
import torch
2020

@@ -123,7 +123,6 @@ def __init__(
123123
generation_config: GenerationConfig,
124124
device: torch.device,
125125
dtype: torch.dtype = torch.float16,
126-
layer_device_map: Optional[dict[int, Union[str, torch.device, int]]] = None,
127126
tp_size: Optional[int] = None,
128127
) -> None:
129128
"""Initialize a paged attention cache for efficient memory usage.
@@ -133,7 +132,6 @@ def __init__(
133132
generation_config: Generation configuration containing cache parameters
134133
device: Device for the cache tensors
135134
dtype: Data type of the cache
136-
layer_device_map: Optional mapping of layer indices to devices
137135
tp_size: Tensor parallelism size
138136
"""
139137
self.config = config

src/transformers/modeling_utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,11 +3241,11 @@ def _get_resized_embeddings(
32413241

32423242
with deepspeed.zero.GatheredParameters([old_embeddings.weight], modifier_rank=None):
32433243
self._init_added_embeddings_weights_with_mean(
3244-
old_embeddings, new_embeddings, old_embedding_dim, old_num_tokens, added_num_tokens
3244+
old_embeddings, new_embeddings, old_num_tokens, added_num_tokens
32453245
)
32463246
else:
32473247
self._init_added_embeddings_weights_with_mean(
3248-
old_embeddings, new_embeddings, old_embedding_dim, old_num_tokens, added_num_tokens
3248+
old_embeddings, new_embeddings, old_num_tokens, added_num_tokens
32493249
)
32503250

32513251
# Copy token embeddings from the previous weights
@@ -3415,7 +3415,7 @@ def _get_resized_lm_head(
34153415
return new_lm_head
34163416

34173417
def _init_added_embeddings_weights_with_mean(
3418-
self, old_embeddings, new_embeddings, old_embedding_dim, old_num_tokens, added_num_tokens
3418+
self, old_embeddings, new_embeddings, old_num_tokens, added_num_tokens
34193419
):
34203420
old_embeddings_weight = old_embeddings.weight.data.to(torch.float32)
34213421
mean_embeddings = torch.mean(old_embeddings_weight, axis=0)
@@ -3454,9 +3454,7 @@ def _init_added_lm_head_weights_with_mean(
34543454
old_lm_head.weight.data = old_lm_head.weight.data.T
34553455

34563456
# The same initialization logic as Embeddings.
3457-
self._init_added_embeddings_weights_with_mean(
3458-
old_lm_head, new_lm_head, old_lm_head_dim, old_num_tokens, added_num_tokens
3459-
)
3457+
self._init_added_embeddings_weights_with_mean(old_lm_head, new_lm_head, old_num_tokens, added_num_tokens)
34603458

34613459
if transposed:
34623460
# Transpose again to the correct shape.

0 commit comments

Comments
 (0)