Transformers documentation
Công cụ tiện ích chung
Công cụ tiện ích chung
Trang này liệt kê tất cả các hàm tiện ích chung của Transformers được tìm thấy trong tệp utils.py.
Phần lớn trong số đó chỉ hữu ích nếu bạn đang nghiên cứu mã nguồn chung của thư viện.
Enums và namedtuples
lớp transformers.utils.ExplicitEnum
< source >( valuenames = Nonemodule = Nonequalname = Nonetype = Nonestart = 1boundary = None )
Enum với thông báo lỗi rõ ràng hơn cho các giá trị bị thiếu.
lớp transformers.utils.PaddingStrategy
< source >( valuenames = Nonemodule = Nonequalname = Nonetype = Nonestart = 1boundary = None )
Các giá trị có thể có cho đối số padding trong PreTrainedTokenizerBase.call(). Hữu ích cho việc hoàn thành bằng phím Tab trong một
IDE.
lớp transformers.TensorType
< source >( valuenames = Nonemodule = Nonequalname = Nonetype = Nonestart = 1boundary = None )
Các giá trị có thể có cho đối số return_tensors trong PreTrainedTokenizerBase.call(). Hữu ích cho
tính năng hoàn thành bằng phím Tab trong IDE.
Trình trang trí đặc biệt
transformers.utils.add_code_sample_docstrings
< source >( *docstrprocessor_class = Nonecheckpoint = Noneoutput_type = Noneconfig_class = Nonemask = '[MASK]'qa_target_start_index = 14qa_target_end_index = 15model_cls = Nonemodality = Noneexpected_output = Noneexpected_loss = Nonereal_checkpoint = Nonerevision = None )
Công cụ khác
lớp transformers.utils._LazyModule
< source >( name: strmodule_file: strimport_structure: dictmodule_spec: _frozen_importlib.ModuleSpec | None = Noneextra_objects: dict[str, object] | None = Noneexplicit_import_shortcut: dict[str, list[str]] | None = None )
Lớp module hiển thị tất cả các đối tượng nhưng chỉ thực hiện các lệnh import liên quan khi các đối tượng đó được yêu cầu.