Skip to content

Commit e103ba0

Browse files
committed
Fix pylint warnings
Signed-off-by: Yuanyuan Chen <cyyever@outlook.com>
1 parent 46c6f01 commit e103ba0

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

src/transformers/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,6 @@
770770
from .utils import is_torch_npu_available as is_torch_npu_available
771771
from .utils import is_torch_xla_available as is_torch_xla_available
772772
from .utils import is_torch_xpu_available as is_torch_xpu_available
773-
from .utils import logging as logging
774773

775774
# bitsandbytes config
776775
from .utils.quantization_config import AqlmConfig as AqlmConfig

src/transformers/generation/watermarking.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,9 @@
2424
from torch.nn import BCELoss
2525

2626
from ..modeling_utils import PreTrainedModel
27-
from ..utils import ModelOutput, is_torch_available, logging
27+
from ..utils import ModelOutput, logging
2828
from .configuration_utils import PretrainedConfig, WatermarkingConfig
29-
30-
31-
if is_torch_available():
32-
from .logits_process import SynthIDTextWatermarkLogitsProcessor, WatermarkLogitsProcessor
29+
from .logits_process import SynthIDTextWatermarkLogitsProcessor, WatermarkLogitsProcessor
3330

3431

3532
logger = logging.get_logger(__name__)

src/transformers/tokenization_utils_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,7 @@ def _from_pretrained(
21382138
if template_file is None:
21392139
continue # I think this should never happen, but just in case
21402140
template_name = extra_chat_template.removeprefix("chat_template_")
2141-
with open(template_file) as chat_template_handle:
2141+
with open(template_file, "rt", encoding="utf8") as chat_template_handle:
21422142
chat_templates[template_name] = chat_template_handle.read()
21432143
if len(chat_templates) == 1 and "default" in chat_templates:
21442144
init_kwargs["chat_template"] = chat_templates["default"]

0 commit comments

Comments
 (0)