Skip to content

Commit 9e3fb05

Browse files
committed
Update to transformers 4.35 and update some rust TLS dependencies
Also updated patched transformers files with upstream updates
1 parent 7c48f48 commit 9e3fb05

File tree

7 files changed

+102
-123
lines changed

7 files changed

+102
-123
lines changed

Cargo.lock

Lines changed: 49 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

router/Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ moka = { version = "0.11.3", features = ["future"] }
2424
nohash-hasher = "^0.2.0"
2525
num = "^0.4.1"
2626
hyper = "^0.14.27" # Override to address CVE-2023-26964
27-
openssl = "^0.10.55" # Override to address WS-2023-0082, WS-2023-0083, WS-2023-0195
28-
openssl-sys = "^0.9.90" # Override to address WS-2023-0082, WS-2023-0083, WS-2023-0195
29-
rustls-webpki = "^0.100.2" # Override to address WS-2023-0305, CVE-2018-16875
30-
parking_lot = "^0.12.1"
27+
openssl = "^0.10.59" # Override to address WS-2023-0082, WS-2023-0083, WS-2023-0195
28+
openssl-sys = "^0.9.95" # Override to address WS-2023-0082, WS-2023-0083, WS-2023-0195
29+
rustls-webpki = "^0.101.7" # Override to address WS-2023-0305, CVE-2018-16875
3130
rand = "^0.8.5"
3231
serde = "^1.0.173"
3332
serde_json = "^1.0.103"
@@ -38,7 +37,7 @@ thiserror = "^1.0.50"
3837
tokenizers = "0.14.1"
3938
tokio = { version = "1.33.0", features = ["rt", "rt-multi-thread", "parking_lot", "signal", "sync", "fs"] }
4039
tokio-rustls = "^0.24.1"
41-
rustls = "0.21.5"
40+
rustls = "0.21.8"
4241
tracing = "^0.1.40"
4342
tracing-subscriber = { version = "0.3.17", features = ["json"] }
4443
prost = "^0.12.1"

server/poetry.lock

Lines changed: 9 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ safetensors = "^0.4.0"
2121
sentencepiece = "^0.1.99"
2222
datasets = { version = "^2.14.6", optional = true }
2323
texttable = { version = "^1.7.0", optional = true }
24-
transformers = "4.34.1"
24+
transformers = "4.35.0"
2525
optimum = { version = "1.13.2", extras = ["onnxruntime-gpu"], optional = true }
2626
onnxruntime = { version = "1.16.1", optional = true }
2727
onnxruntime-gpu = { version = "1.16.1", optional = true }

server/text_generation_server/models/custom_modeling/t5_modeling.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,11 @@ def forward(
10021002

10031003

10041004
class T5ForConditionalGeneration(T5PreTrainedModel):
1005+
_keys_to_ignore_on_load_unexpected = [
1006+
"decoder.block.0.layer.1.EncDecAttention.relative_attention_bias.weight",
1007+
]
1008+
_tied_weights_keys = ["encoder.embed_tokens.weight", "decoder.embed_tokens.weight", "lm_head.weight"]
1009+
10051010
def __init__(self, config: T5Config, weights):
10061011
super().__init__(config)
10071012
self.model_dim = config.d_model
@@ -1160,9 +1165,18 @@ def prepare_inputs_for_generation(
11601165
encoder_outputs=None,
11611166
**kwargs,
11621167
):
1163-
# cut decoder_input_ids if past is used
1168+
# cut decoder_input_ids if past_key_values is used
11641169
if past_key_values is not None:
1165-
input_ids = input_ids[:, -1:]
1170+
past_length = past_key_values[0][0].shape[2]
1171+
1172+
# Some generation methods already pass only the last input ID
1173+
if input_ids.shape[1] > past_length:
1174+
remove_prefix_length = past_length
1175+
else:
1176+
# Default to old behavior: keep only final ID
1177+
remove_prefix_length = input_ids.shape[1] - 1
1178+
1179+
input_ids = input_ids[:, remove_prefix_length:]
11661180

11671181
return {
11681182
"decoder_input_ids": input_ids,

0 commit comments

Comments
 (0)