Transformers documentation

Công cụ tiện ích chung

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v5.22.2).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

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

< >

( 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

< >

( 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

< >

( 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.add_start_docstrings

< >

( *docstr )

transformers.utils.add_start_docstrings_to_model_forward

< >

( *docstr )

transformers.add_end_docstrings

< >

( *docstr )

transformers.utils.add_code_sample_docstrings

< >

( *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 )

transformers.utils.replace_return_docstrings

< >

( output_type = Noneconfig_class = None )

Công cụ khác

lớp transformers.utils._LazyModule

< >

( 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.

Update on GitHub