File tree Expand file tree Collapse file tree 4 files changed +5
-9
lines changed Expand file tree Collapse file tree 4 files changed +5
-9
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 2424from torch .nn import BCELoss
2525
2626from ..modeling_utils import PreTrainedModel
27- from ..utils import ModelOutput , is_torch_available , logging
27+ from ..utils import ModelOutput , logging
2828from .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
3532logger = logging .get_logger (__name__ )
Original file line number Diff line number Diff line change @@ -2516,10 +2516,10 @@ def check_json_file_has_correct_format(file_path):
25162516 else :
25172517 # otherwise make sure json has correct format (at least 3 lines)
25182518 assert len (lines ) >= 3
2519- # each key one line, indent should be 2, min length is 3
2519+ # each key one line, ident should be 2, min length is 3
25202520 assert lines [0 ].strip () == "{"
25212521 for line in lines [1 :- 1 ]:
2522- left_indent = len (line ) - len (line .lstrip ())
2522+ left_indent = len (lines [ 1 ] ) - len (lines [ 1 ] .lstrip ())
25232523 assert left_indent == 2
25242524 assert lines [- 1 ].strip () == "}"
25252525
Original file line number Diff line number Diff 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" ]
You can’t perform that action at this time.
0 commit comments