Skip to content

Commit 8d0c71c

Browse files
committed
Suppress tokenizer warning
1 parent e67125d commit 8d0c71c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "tibert"
3-
version = "0.0.2"
3+
version = "0.0.3"
44
description = "BERT for Coreference Resolution"
55
authors = ["Arthur Amalvy <[email protected]>"]
66
license = "GPL-3.0-only"

tibert/bertcoref.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ def torch_call(self, features) -> Union[dict, BatchEncoding]:
286286
coref_labels and mention_labels
287287
)
288288

289+
warning_state = self.tokenizer.deprecation_warnings.get(
290+
"Asking-to-pad-a-fast-tokenizer", False
291+
)
292+
self.tokenizer.deprecation_warnings["Asking-to-pad-a-fast-tokenizer"] = True
289293
batch = self.tokenizer.pad(
290294
features,
291295
padding=self.padding,
@@ -294,6 +298,9 @@ def torch_call(self, features) -> Union[dict, BatchEncoding]:
294298
# they are not of the same length yet.
295299
return_tensors="pt" if coref_labels is None else None,
296300
)
301+
self.tokenizer.deprecation_warnings[
302+
"Asking-to-pad-a-fast-tokenizer"
303+
] = warning_state
297304

298305
# keep encoding info
299306
batch._encodings = [f.encodings[0] for f in features]

0 commit comments

Comments
 (0)